Changeset 121285 in webkit for trunk/Source/WebCore/css/StyleResolver.cpp
- Timestamp:
- Jun 26, 2012, 1:23:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/StyleResolver.cpp
r121229 r121285 2758 2758 // this is mostly boring stuff on how to apply a certain rule to the renderstyle... 2759 2759 2760 Length StyleResolver::convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)2761 { 2762 return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, multiplier) : Length(Undefined);2763 } 2764 2765 Length StyleResolver::convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)2766 { 2767 return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, multiplier) : Length(Undefined);2760 Length StyleResolver::convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier) 2761 { 2762 return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, parentStyle, multiplier) : Length(Undefined); 2763 } 2764 2765 Length StyleResolver::convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier) 2766 { 2767 return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, parentStyle, multiplier) : Length(Undefined); 2768 2768 } 2769 2769 … … 3244 3244 static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, Length& length) 3245 3245 { 3246 Length workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(selector->style(), selector->rootElementStyle(), selector-> style()->effectiveZoom());3246 Length workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(selector->style(), selector->rootElementStyle(), selector->parentStyle(), selector->style()->effectiveZoom()); 3247 3247 if (workingLength.isUndefined()) 3248 3248 return false; … … 3707 3707 continue; 3708 3708 ShadowValue* item = static_cast<ShadowValue*>(currValue); 3709 int x = item->x->computeLength<int>(style(), m_rootElementStyle, zoomFactor);3710 int y = item->y->computeLength<int>(style(), m_rootElementStyle, zoomFactor);3711 int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle, zoomFactor) : 0;3712 int spread = item->spread ? item->spread->computeLength<int>(style(), m_rootElementStyle, zoomFactor) : 0;3709 int x = item->x->computeLength<int>(style(), m_rootElementStyle, m_parentStyle, zoomFactor); 3710 int y = item->y->computeLength<int>(style(), m_rootElementStyle, m_parentStyle, zoomFactor); 3711 int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle, m_parentStyle, zoomFactor) : 0; 3712 int spread = item->spread ? item->spread->computeLength<int>(style(), m_rootElementStyle, m_parentStyle, zoomFactor) : 0; 3713 3713 ShadowStyle shadowStyle = item->style && item->style->getIdent() == CSSValueInset ? Inset : Normal; 3714 3714 Color color; … … 3740 3740 reflection->setDirection(reflectValue->direction()); 3741 3741 if (reflectValue->offset()) 3742 reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(style(), m_rootElementStyle, zoomFactor));3742 reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(style(), m_rootElementStyle, m_parentStyle, zoomFactor)); 3743 3743 NinePieceImage mask; 3744 3744 mask.setMaskDefaults(); … … 3822 3822 } 3823 3823 } else { 3824 Length marqueeLength = convertToIntLength(primitiveValue, style(), m_rootElementStyle );3824 Length marqueeLength = convertToIntLength(primitiveValue, style(), m_rootElementStyle, m_parentStyle); 3825 3825 if (!marqueeLength.isUndefined()) 3826 3826 m_style->setMarqueeIncrement(marqueeLength); … … 3868 3868 DashboardRegion* first = region; 3869 3869 while (region) { 3870 Length top = convertToIntLength(region->top(), style(), m_rootElementStyle );3871 Length right = convertToIntLength(region->right(), style(), m_rootElementStyle );3872 Length bottom = convertToIntLength(region->bottom(), style(), m_rootElementStyle );3873 Length left = convertToIntLength(region->left(), style(), m_rootElementStyle );3870 Length top = convertToIntLength(region->top(), style(), m_rootElementStyle, m_parentStyle); 3871 Length right = convertToIntLength(region->right(), style(), m_rootElementStyle, m_parentStyle); 3872 Length bottom = convertToIntLength(region->bottom(), style(), m_rootElementStyle, m_parentStyle); 3873 Length left = convertToIntLength(region->left(), style(), m_rootElementStyle, m_parentStyle); 3874 3874 3875 3875 if (top.isUndefined()) … … 3906 3906 else if (primitiveValue->getIdent() == CSSValueThick) 3907 3907 result *= 5; 3908 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(style(), m_rootElementStyle, zoomFactor);3908 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(style(), m_rootElementStyle, m_parentStyle, zoomFactor); 3909 3909 break; 3910 3910 } 3911 3911 default: 3912 width = primitiveValue->computeLength<float>(style(), m_rootElementStyle, zoomFactor);3912 width = primitiveValue->computeLength<float>(style(), m_rootElementStyle, m_parentStyle, zoomFactor); 3913 3913 break; 3914 3914 } … … 3919 3919 HANDLE_INHERIT_AND_INITIAL(transform, Transform); 3920 3920 TransformOperations operations; 3921 createTransformOperations(value, style(), m_rootElementStyle, operations);3921 createTransformOperations(value, style(), m_rootElementStyle, m_parentStyle, operations); 3922 3922 m_style->setTransform(operations); 3923 3923 return; … … 3936 3936 float perspectiveValue; 3937 3937 if (primitiveValue->isLength()) 3938 perspectiveValue = primitiveValue->computeLength<float>(style(), m_rootElementStyle, zoomFactor);3938 perspectiveValue = primitiveValue->computeLength<float>(style(), m_rootElementStyle, m_parentStyle, zoomFactor); 3939 3939 else if (primitiveValue->isNumber()) { 3940 3940 // For backward compatibility, treat valueless numbers as px. 3941 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(style(), m_rootElementStyle, zoomFactor);3941 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(style(), m_rootElementStyle, m_parentStyle, zoomFactor); 3942 3942 } else 3943 3943 return; … … 4815 4815 } 4816 4816 4817 bool StyleResolver::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, TransformOperations& outOperations)4817 bool StyleResolver::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, TransformOperations& outOperations) 4818 4818 { 4819 4819 if (!inValue || !inValue->isValueList()) { … … 4899 4899 Length ty = Length(0, Fixed); 4900 4900 if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation) 4901 ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);4901 ty = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor); 4902 4902 else { 4903 tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);4903 tx = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor); 4904 4904 if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { 4905 4905 if (transformValue->length() > 1) { 4906 4906 CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1)); 4907 ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);4907 ty = convertToFloatLength(secondValue, style, rootStyle, parentStyle, zoomFactor); 4908 4908 } 4909 4909 } … … 4922 4922 Length tz = Length(0, Fixed); 4923 4923 if (transformValue->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation) 4924 tz = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);4924 tz = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor); 4925 4925 else if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation) 4926 ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);4926 ty = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor); 4927 4927 else { 4928 tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);4928 tx = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor); 4929 4929 if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { 4930 4930 if (transformValue->length() > 2) { 4931 4931 CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2)); 4932 tz = convertToFloatLength(thirdValue, style, rootStyle, zoomFactor);4932 tz = convertToFloatLength(thirdValue, style, rootStyle, parentStyle, zoomFactor); 4933 4933 } 4934 4934 if (transformValue->length() > 1) { 4935 4935 CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1)); 4936 ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);4936 ty = convertToFloatLength(secondValue, style, rootStyle, parentStyle, zoomFactor); 4937 4937 } 4938 4938 } … … 5037 5037 Length p = Length(0, Fixed); 5038 5038 if (firstValue->isLength()) 5039 p = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);5039 p = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor); 5040 5040 else { 5041 5041 // This is a quirk that should go away when 3d transforms are finalized. … … 5401 5401 Length stdDeviation = Length(0, Fixed); 5402 5402 if (filterValue->length() >= 1) 5403 stdDeviation = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);5403 stdDeviation = convertToFloatLength(firstValue, style, rootStyle, parentStyle(), zoomFactor); 5404 5404 if (stdDeviation.isUndefined()) 5405 5405 return false; … … 5417 5417 5418 5418 ShadowValue* item = static_cast<ShadowValue*>(cssValue); 5419 IntPoint location(item->x->computeLength<int>(style, rootStyle, zoomFactor),5420 item->y->computeLength<int>(style, rootStyle, zoomFactor));5421 int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, zoomFactor) : 0;5419 IntPoint location(item->x->computeLength<int>(style, rootStyle, m_parentStyle, zoomFactor), 5420 item->y->computeLength<int>(style, rootStyle, m_parentStyle, zoomFactor)); 5421 int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, m_parentStyle, zoomFactor) : 0; 5422 5422 Color color; 5423 5423 if (item->color)
Note:
See TracChangeset
for help on using the changeset viewer.