Changeset 121285 in webkit
- Timestamp:
- Jun 26, 2012 1:23:26 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r121280 r121285 1 2012-06-26 Dave Tharp <dtharp@codeaurora.org> 2 3 ietestcenter/css3/valuesandunits/units-000.htm asserts 4 https://bugs.webkit.org/show_bug.cgi?id=86176 5 6 Reviewed by Beth Dakin. 7 8 Adding explicit tests for viewport border length tests. Inspired by IE Test center 9 units-000 test which highlighted that vw, vh, and vmin were not being handled in computeLengthDouble(). 10 Also, adjusting test_expectations and Skipped for units-000, which no longer Asserts with this 11 patch implemented. 12 13 * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border-expected.html: Added. 14 * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html: Added. 15 * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border-expected.html: Added. 16 * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html: Added. 17 * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border-expected.htm: Added. 18 * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html: Added. 19 * ietestcenter/css3/valuesandunits/units-000.htm: 20 * platform/chromium/TestExpectations: 21 * platform/efl/TestExpectations: 22 * platform/gtk/TestExpectations: 23 * platform/mac/TestExpectations: 24 * platform/qt/TestExpectations: 25 1 26 2012-06-26 Filip Pizlo <fpizlo@apple.com> 2 27 -
trunk/LayoutTests/ietestcenter/css3/valuesandunits/units-000.htm
r116658 r121285 120 120 #div12 121 121 { 122 border-right: solid green 100vm ;122 border-right: solid green 100vmin; 123 123 height: 16px; 124 124 width: 0; -
trunk/LayoutTests/platform/chromium/TestExpectations
r121283 r121285 3462 3462 BUGWK85212 : ietestcenter/css3/flexbox/flexbox-layout-002.htm = IMAGE 3463 3463 // IETC CSS units 3464 BUGWK85308 DEBUG : ietestcenter/css3/valuesandunits/units-000.htm = CRASH 3465 BUGWK85308 RELEASE : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE 3464 BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE 3466 3465 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE 3467 3466 // IETC namespace failures -
trunk/LayoutTests/platform/efl/TestExpectations
r121257 r121285 578 578 579 579 // Tests imported in r116658 580 BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE CRASH580 BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE 581 581 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE 582 582 -
trunk/LayoutTests/platform/gtk/TestExpectations
r121252 r121285 356 356 BUGWK86443 : plugins/npruntime/delete-plugin-within-getProperty.html = CRASH 357 357 BUGWK86443 : plugins/npruntime/delete-plugin-within-invoke.html = CRASH 358 359 BUGWK86176 DEBUG : ietestcenter/css3/valuesandunits/units-000.htm = CRASH360 358 361 359 BUGWK89188 RELEASE : storage/websql/quota-tracking.html = CRASH PASS … … 1172 1170 BUGWK86061 : http/tests/security/referrer-policy-redirect-link.html = TEXT 1173 1171 1174 BUGWK85308 RELEASE : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE 1172 // IETC Units test failures 1173 BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE 1175 1174 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE 1176 1175 -
trunk/LayoutTests/platform/mac/TestExpectations
r121182 r121285 244 244 BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT 245 245 246 // Hits assert https://bugs.webkit.org/show_bug.cgi?id=86208247 BUGWK85308 SKIP: ietestcenter/css3/valuesandunits/units-000.htm = IMAGE246 // IETC units test failures 247 BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE 248 248 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE 249 249 -
trunk/LayoutTests/platform/qt/TestExpectations
r121182 r121285 60 60 BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT 61 61 62 // ietestcenter/css3/valuesandunits/units-000.htm asserts 63 // https://bugs.webkit.org/show_bug.cgi?id=86176 64 BUGWK85308 SKIP : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE 62 // IETC units test failures 63 BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE 65 64 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE 66 65 -
trunk/Source/WebCore/ChangeLog
r121284 r121285 1 2012-06-26 Dave Tharp <dtharp@codeaurora.org> 2 3 ietestcenter/css3/valuesandunits/units-000.htm asserts 4 https://bugs.webkit.org/show_bug.cgi?id=86176 5 6 Reviewed by Beth Dakin. 7 8 Modified computeLengthDouble() to handle vh, vw, and vmin units. Per the spec 9 (http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths) viewport -percentage 10 lengths are "relative to the size of the initial containing block", which I read to be 11 the size of the parent element. Since parentStyle was not available in computeLengthDouble, 12 most of the changes for this patch involved "pushing down" the parentStyle pointer through 13 the network of computeLength methods and dependencies. 14 15 Tests: css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html 16 css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html 17 css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html 18 19 * css/CSSCalculationValue.cpp: 20 (WebCore::CSSCalcValue::computeLengthPx): 21 (WebCore::CSSCalcPrimitiveValue::toCalcValue): 22 (WebCore::CSSCalcPrimitiveValue::computeLengthPx): 23 (WebCore::CSSCalcBinaryOperation::toCalcValue): 24 (WebCore::CSSCalcBinaryOperation::computeLengthPx): 25 * css/CSSCalculationValue.h: 26 (CSSCalcExpressionNode): 27 (WebCore::CSSCalcValue::toCalcValue): 28 (CSSCalcValue): 29 * css/CSSGradientValue.cpp: 30 (WebCore::CSSGradientValue::addStops): 31 (WebCore::positionFromValue): 32 (WebCore::CSSGradientValue::computeEndPoint): 33 (WebCore::CSSLinearGradientValue::createGradient): 34 (WebCore::CSSRadialGradientValue::resolveRadius): 35 (WebCore::CSSRadialGradientValue::createGradient): 36 * css/CSSGradientValue.h: 37 (CSSGradientValue): 38 (CSSRadialGradientValue): 39 * css/CSSPrimitiveValue.cpp: 40 (WebCore::CSSPrimitiveValue::computeLength): 41 (WebCore::CSSPrimitiveValue::computeLengthDouble): 42 * css/CSSPrimitiveValue.h: 43 (CSSPrimitiveValue): 44 * css/CSSPrimitiveValueMappings.h: 45 (WebCore::CSSPrimitiveValue::convertToLength): 46 * css/CSSToStyleMap.cpp: 47 (WebCore::CSSToStyleMap::parentStyle): 48 (WebCore): 49 (WebCore::CSSToStyleMap::mapFillSize): 50 (WebCore::CSSToStyleMap::mapFillXPosition): 51 (WebCore::CSSToStyleMap::mapFillYPosition): 52 (WebCore::CSSToStyleMap::mapNinePieceImageQuad): 53 * css/CSSToStyleMap.h: 54 (CSSToStyleMap): 55 * css/MediaQueryEvaluator.cpp: 56 (WebCore::computeLength): 57 (WebCore::device_heightMediaFeatureEval): 58 (WebCore::device_widthMediaFeatureEval): 59 (WebCore::heightMediaFeatureEval): 60 (WebCore::widthMediaFeatureEval): 61 * css/SVGCSSStyleSelector.cpp: 62 (WebCore::StyleResolver::applySVGProperty): 63 * css/StyleBuilder.cpp: 64 (WebCore::ApplyPropertyAuto::applyValue): 65 (WebCore::ApplyPropertyClip::convertToLength): 66 (WebCore::ApplyPropertyLength::applyValue): 67 (WebCore::ApplyPropertyBorderRadius::applyValue): 68 (WebCore::ApplyPropertyComputeLength::applyValue): 69 (WebCore::ApplyPropertyFontSize::applyValue): 70 (WebCore::ApplyPropertyLineHeight::applyValue): 71 (WebCore::ApplyPropertyPageSize::mmLength): 72 (WebCore::ApplyPropertyPageSize::inchLength): 73 (WebCore::ApplyPropertyPageSize::applyValue): 74 (WebCore::ApplyPropertyVerticalAlign::applyValue): 75 * css/StyleResolver.cpp: 76 (WebCore::StyleResolver::collectMatchingRulesForList): 77 * css/StyleResolver.h: 78 (WebCore::StyleResolver::parentNode): 79 (StyleResolver): 80 * css/WebKitCSSMatrix.cpp: 81 (WebCore::WebKitCSSMatrix::setMatrixValue): 82 1 83 2012-06-25 James Robinson <jamesr@chromium.org> 2 84 -
trunk/Source/WebCore/css/CSSCalculationValue.cpp
r118900 r121285 98 98 } 99 99 100 double CSSCalcValue::computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const101 { 102 return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize));100 double CSSCalcValue::computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize) const 101 { 102 return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize)); 103 103 } 104 104 … … 125 125 } 126 126 127 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom) const127 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom) const 128 128 { 129 129 switch (m_category) { … … 131 131 return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue())); 132 132 case CalcLength: 133 return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, zoom)));133 return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, parentStyle, zoom))); 134 134 case CalcPercent: 135 135 case CalcPercentLength: 136 return adoptPtr(new CalcExpressionLength(StyleResolver::convertToFloatLength(m_value.get(), style, rootStyle, zoom)));136 return adoptPtr(new CalcExpressionLength(StyleResolver::convertToFloatLength(m_value.get(), style, rootStyle, parentStyle, zoom))); 137 137 // Only types that could be part of a Length expression can be converted 138 138 // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length. … … 160 160 } 161 161 162 virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const162 virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize) const 163 163 { 164 164 switch (m_category) { 165 165 case CalcLength: 166 return m_value->computeLength<double>(currentStyle, rootStyle, multiplier, computingFontSize);166 return m_value->computeLength<double>(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize); 167 167 case CalcPercent: 168 168 case CalcNumber: … … 238 238 } 239 239 240 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom) const241 { 242 OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, zoom));240 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom) const 241 { 242 OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, parentStyle, zoom)); 243 243 if (!left) 244 244 return nullptr; 245 OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, zoom));245 OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, parentStyle, zoom)); 246 246 if (!right) 247 247 return nullptr; … … 254 254 } 255 255 256 virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const257 { 258 const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize);259 const double rightValue = m_rightSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize);256 virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize) const 257 { 258 const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize); 259 const double rightValue = m_rightSide->computeLengthPx(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize); 260 260 return evaluate(leftValue, rightValue); 261 261 } -
trunk/Source/WebCore/css/CSSCalculationValue.h
r118900 r121285 61 61 virtual ~CSSCalcExpressionNode() = 0; 62 62 virtual bool isZero() const = 0; 63 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle*, RenderStyle* rootStyle, double zoom = 1.0) const = 0;63 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom = 1.0) const = 0; 64 64 virtual double doubleValue() const = 0; 65 virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0;65 virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0; 66 66 virtual String customCssText() const = 0; 67 67 … … 85 85 static PassRefPtr<CSSCalcValue> create(CalculationValue*); 86 86 87 PassRefPtr<CalculationValue> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom = 1.0) const87 PassRefPtr<CalculationValue> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom = 1.0) const 88 88 { 89 return CalculationValue::create(m_expression->toCalcValue(style, rootStyle, zoom), m_nonNegative ? CalculationRangeNonNegative : CalculationRangeAll);89 return CalculationValue::create(m_expression->toCalcValue(style, rootStyle, parentStyle, zoom), m_nonNegative ? CalculationRangeNonNegative : CalculationRangeAll); 90 90 } 91 91 CalculationCategory category() const { return m_expression->category(); } … … 93 93 double doubleValue() const; 94 94 bool isNegative() const { return m_expression->doubleValue() < 0; } 95 double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const;95 double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1.0, bool computingFontSize = false) const; 96 96 97 97 String customCssText() const; -
trunk/Source/WebCore/css/CSSGradientValue.cpp
r115215 r121285 106 106 }; 107 107 108 void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, RenderStyle* rootStyle, float maxLengthForRepeat)108 void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, RenderStyle* rootStyle, RenderStyle* parentStyle, float maxLengthForRepeat) 109 109 { 110 110 RenderStyle* style = renderer->style(); … … 161 161 float length; 162 162 if (stop.m_position->isLength()) 163 length = stop.m_position->computeLength<float>(style, rootStyle, style->effectiveZoom());163 length = stop.m_position->computeLength<float>(style, rootStyle, parentStyle, style->effectiveZoom()); 164 164 else 165 length = stop.m_position->cssCalcValue()->toCalcValue(style, rootStyle, style->effectiveZoom())->evaluate(gradientLength);165 length = stop.m_position->cssCalcValue()->toCalcValue(style, rootStyle, parentStyle, style->effectiveZoom())->evaluate(gradientLength); 166 166 stops[i].offset = (gradientLength > 0) ? length / gradientLength : 0; 167 167 } else { … … 364 364 } 365 365 366 static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, RenderStyle* rootStyle, const IntSize& size, bool isHorizontal)366 static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, const IntSize& size, bool isHorizontal) 367 367 { 368 368 float zoomFactor = style->effectiveZoom(); … … 376 376 377 377 if (value->isCalculatedPercentageWithLength()) 378 return value->cssCalcValue()->toCalcValue(style, rootStyle, style->effectiveZoom())->evaluate(edgeDistance);378 return value->cssCalcValue()->toCalcValue(style, rootStyle, parentStyle, style->effectiveZoom())->evaluate(edgeDistance); 379 379 380 380 switch (value->getIdent()) { … … 393 393 } 394 394 395 return value->computeLength<float>(style, rootStyle, zoomFactor);396 } 397 398 FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* first, CSSPrimitiveValue* second, RenderStyle* style, RenderStyle* rootStyle, const IntSize& size)395 return value->computeLength<float>(style, rootStyle, parentStyle, zoomFactor); 396 } 397 398 FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* first, CSSPrimitiveValue* second, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, const IntSize& size) 399 399 { 400 400 FloatPoint result; 401 401 402 402 if (first) 403 result.setX(positionFromValue(first, style, rootStyle, size, true));403 result.setX(positionFromValue(first, style, rootStyle, parentStyle, size, true)); 404 404 405 405 if (second) 406 result.setY(positionFromValue(second, style, rootStyle, size, false));406 result.setY(positionFromValue(second, style, rootStyle, parentStyle, size, false)); 407 407 408 408 return result; … … 543 543 544 544 RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyle(); 545 RenderObject* parent = renderer->parent(); 546 RenderStyle* parentStyle = parent ? parent->style() : 0; 545 547 546 548 FloatPoint firstPoint; … … 550 552 endPointsFromAngle(angle, size, firstPoint, secondPoint); 551 553 } else { 552 firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);554 firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, parentStyle, size); 553 555 554 556 if (m_secondX || m_secondY) 555 secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size);557 secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, parentStyle, size); 556 558 else { 557 559 if (m_firstX) … … 565 567 566 568 // Now add the stops. 567 addStops(gradient.get(), renderer, rootStyle, 1);569 addStops(gradient.get(), renderer, rootStyle, parentStyle, 1); 568 570 569 571 return gradient.release(); … … 639 641 } 640 642 641 float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, RenderStyle* style, RenderStyle* rootStyle, float* widthOrHeight)643 float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float* widthOrHeight) 642 644 { 643 645 float zoomFactor = style->effectiveZoom(); … … 649 651 result = *widthOrHeight * radius->getFloatValue() / 100; 650 652 else 651 result = radius->computeLength<float>(style, rootStyle, zoomFactor);653 result = radius->computeLength<float>(style, rootStyle, parentStyle, zoomFactor); 652 654 653 655 return result; … … 736 738 737 739 RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyle(); 738 739 FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size); 740 RenderObject* parent = renderer->parent(); 741 RenderStyle* parentStyle = parent ? parent->style() : 0; 742 743 FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, parentStyle, size); 740 744 if (!m_firstX) 741 745 firstPoint.setX(size.width() / 2); … … 743 747 firstPoint.setY(size.height() / 2); 744 748 745 FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size);749 FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, parentStyle, size); 746 750 if (!m_secondX) 747 751 secondPoint.setX(size.width() / 2); … … 751 755 float firstRadius = 0; 752 756 if (m_firstRadius) 753 firstRadius = resolveRadius(m_firstRadius.get(), renderer->style(), rootStyle );757 firstRadius = resolveRadius(m_firstRadius.get(), renderer->style(), rootStyle, parentStyle); 754 758 755 759 float secondRadius = 0; 756 760 float aspectRatio = 1; // width / height. 757 761 if (m_secondRadius) 758 secondRadius = resolveRadius(m_secondRadius.get(), renderer->style(), rootStyle );762 secondRadius = resolveRadius(m_secondRadius.get(), renderer->style(), rootStyle, parentStyle); 759 763 else if (m_endHorizontalSize || m_endVerticalSize) { 760 764 float width = size.width(); 761 765 float height = size.height(); 762 secondRadius = resolveRadius(m_endHorizontalSize.get(), renderer->style(), rootStyle, &width);763 aspectRatio = secondRadius / resolveRadius(m_endVerticalSize.get(), renderer->style(), rootStyle, &height);766 secondRadius = resolveRadius(m_endHorizontalSize.get(), renderer->style(), rootStyle, parentStyle, &width); 767 aspectRatio = secondRadius / resolveRadius(m_endVerticalSize.get(), renderer->style(), rootStyle, parentStyle, &height); 764 768 } else { 765 769 enum GradientShape { Circle, Ellipse }; … … 862 866 863 867 // Now add the stops. 864 addStops(gradient.get(), renderer, rootStyle, maxExtent);868 addStops(gradient.get(), renderer, rootStyle, parentStyle, maxExtent); 865 869 866 870 return gradient.release(); -
trunk/Source/WebCore/css/CSSGradientValue.h
r100535 r121285 82 82 } 83 83 84 void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLengthForRepeat = 0);84 void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, RenderStyle* parentStyle, float maxLengthForRepeat = 0); 85 85 86 86 // Resolve points/radii to front end values. 87 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, const IntSize&);87 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, const IntSize&); 88 88 89 89 bool isCacheable() const; … … 155 155 156 156 // Resolve points/radii to front end values. 157 float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, float* widthOrHeight = 0);157 float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, float* widthOrHeight = 0); 158 158 159 159 // These may be null for non-deprecated gradients. -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r120849 r121285 456 456 } 457 457 458 template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)459 { 460 return roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));461 } 462 463 template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)464 { 465 return roundForImpreciseConversion<unsigned>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));466 } 467 468 template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)458 template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize) 459 { 460 return roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)); 461 } 462 463 template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize) 464 { 465 return roundForImpreciseConversion<unsigned>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)); 466 } 467 468 template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize) 469 469 { 470 470 #if ENABLE(SUBPIXEL_LAYOUT) 471 return Length(static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);471 return Length(static_cast<float>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)), Fixed); 472 472 #else 473 return Length(roundForImpreciseConversion<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);474 #endif 475 } 476 477 template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)478 { 479 return roundForImpreciseConversion<short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));480 } 481 482 template<> unsigned short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)483 { 484 return roundForImpreciseConversion<unsigned short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));485 } 486 487 template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)488 { 489 return static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));490 } 491 492 template<> double CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)493 { 494 return computeLengthDouble(style, rootStyle, multiplier, computingFontSize);495 } 496 497 double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)473 return Length(roundForImpreciseConversion<float>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)), Fixed); 474 #endif 475 } 476 477 template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize) 478 { 479 return roundForImpreciseConversion<short>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)); 480 } 481 482 template<> unsigned short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize) 483 { 484 return roundForImpreciseConversion<unsigned short>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)); 485 } 486 487 template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize) 488 { 489 return static_cast<float>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)); 490 } 491 492 template<> double CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize) 493 { 494 return computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize); 495 } 496 497 double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize) 498 498 { 499 499 double factor; … … 538 538 ASSERT_NOT_REACHED(); 539 539 return -1.0; 540 case CSS_VW: 541 factor = parentStyle ? 0.01 * parentStyle->width().getFloatValue() : 0; 542 break; 543 case CSS_VH: 544 factor = parentStyle ? 0.01 * parentStyle->height().getFloatValue() : 0; 545 break; 546 case CSS_VMIN: 547 factor = 0; 548 if (parentStyle) 549 factor = .01 * (float) min(parentStyle->width().getFloatValue(), parentStyle->height().getFloatValue()); 550 break; 540 551 default: 541 552 ASSERT_NOT_REACHED(); … … 546 557 if (m_primitiveUnitType == CSS_CALC) 547 558 // The multiplier is passed in as 1.0 here to ensure it is only applied once 548 computedValue = m_value.calc->computeLengthPx(style, rootStyle, 1.0, computingFontSize);559 computedValue = m_value.calc->computeLengthPx(style, rootStyle, parentStyle, 1.0, computingFontSize); 549 560 else 550 561 computedValue = getDoubleValue(); -
trunk/Source/WebCore/css/CSSPrimitiveValue.h
r120308 r121285 239 239 * and some tool to calibrate. 240 240 */ 241 template<typename T> T computeLength(RenderStyle* currStyle, RenderStyle* rootStyle, float multiplier = 1.0f, bool computingFontSize = false);241 template<typename T> T computeLength(RenderStyle* currStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier = 1.0f, bool computingFontSize = false); 242 242 243 243 // Converts to a Length, mapping various unit types appropriately. 244 template<int> Length convertToLength(RenderStyle* currStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false);244 template<int> Length convertToLength(RenderStyle* currStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1.0, bool computingFontSize = false); 245 245 246 246 // use with care!!! … … 343 343 bool getDoubleValueInternal(UnitTypes targetUnitType, double* result) const; 344 344 345 double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, float multiplier, bool computingFontSize);345 double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize); 346 346 347 347 union { -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r120735 r121285 3800 3800 }; 3801 3801 3802 template<int supported> Length CSSPrimitiveValue::convertToLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)3802 template<int supported> Length CSSPrimitiveValue::convertToLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize) 3803 3803 { 3804 3804 if ((supported & (FixedIntegerConversion | FixedFloatConversion)) && isFontRelativeLength() && (!style || !rootStyle)) 3805 3805 return Length(Undefined); 3806 3806 if ((supported & FixedIntegerConversion) && isLength()) 3807 return computeLength<Length>(style, rootStyle, multiplier, computingFontSize);3807 return computeLength<Length>(style, rootStyle, parentStyle, multiplier, computingFontSize); 3808 3808 if ((supported & FixedFloatConversion) && isLength()) 3809 return Length(computeLength<double>(style, rootStyle, multiplier), Fixed);3809 return Length(computeLength<double>(style, rootStyle, parentStyle, multiplier), Fixed); 3810 3810 if ((supported & PercentConversion) && isPercentage()) 3811 3811 return Length(getDoubleValue(), Percent); … … 3815 3815 return Length(Auto); 3816 3816 if ((supported & CalculatedConversion) && isCalculated()) 3817 return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier));3817 return Length(cssCalcValue()->toCalcValue(style, rootStyle, parentStyle, multiplier)); 3818 3818 if ((supported & ViewportPercentageConversion) && isViewportPercentageLength()) 3819 3819 return viewportPercentageLength(); -
trunk/Source/WebCore/css/CSSToStyleMap.cpp
r121164 r121285 52 52 } 53 53 54 RenderStyle* CSSToStyleMap::parentStyle() const 55 { 56 return m_resolver->parentStyle(); 57 } 58 54 59 bool CSSToStyleMap::useSVGZoomRules() const 55 60 { … … 199 204 CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first()); 200 205 CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second()); 201 firstLength = first->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);202 secondLength = second->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);206 firstLength = first->convertToLength<AnyConversion>(style(), rootElementStyle(), parentStyle(), zoomFactor); 207 secondLength = second->convertToLength<AnyConversion>(style(), rootElementStyle(), parentStyle(), zoomFactor); 203 208 } else { 204 firstLength = primitiveValue->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);209 firstLength = primitiveValue->convertToLength<AnyConversion>(style(), rootElementStyle(), parentStyle(), zoomFactor); 205 210 secondLength = Length(); 206 211 } … … 229 234 Length length; 230 235 if (primitiveValue->isLength()) 231 length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), zoomFactor);236 length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoomFactor); 232 237 else if (primitiveValue->isPercentage()) 233 238 length = Length(primitiveValue->getDoubleValue(), Percent); 234 239 else if (primitiveValue->isCalculatedPercentageWithLength()) 235 length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), zoomFactor));240 length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), parentStyle(), zoomFactor)); 236 241 else if (primitiveValue->isViewportPercentageLength()) 237 242 length = primitiveValue->viewportPercentageLength(); … … 256 261 Length length; 257 262 if (primitiveValue->isLength()) 258 length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), zoomFactor);263 length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoomFactor); 259 264 else if (primitiveValue->isPercentage()) 260 265 length = Length(primitiveValue->getDoubleValue(), Percent); 261 266 else if (primitiveValue->isCalculatedPercentageWithLength()) 262 length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), zoomFactor));267 length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), parentStyle(), zoomFactor)); 263 268 else if (primitiveValue->isViewportPercentageLength()) 264 269 length = primitiveValue->viewportPercentageLength(); … … 583 588 box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); 584 589 else if (slices->top()->getIdent() != CSSValueAuto) 585 box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), zoom);590 box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoom); 586 591 587 592 if (slices->right()->isNumber()) … … 590 595 box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); 591 596 else if (slices->right()->getIdent() != CSSValueAuto) 592 box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), zoom);597 box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoom); 593 598 594 599 if (slices->bottom()->isNumber()) … … 597 602 box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); 598 603 else if (slices->bottom()->getIdent() != CSSValueAuto) 599 box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), zoom);604 box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoom); 600 605 601 606 if (slices->left()->isNumber()) … … 604 609 box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); 605 610 else if (slices->left()->getIdent() != CSSValueAuto) 606 box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), zoom);611 box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoom); 607 612 608 613 return box; -
trunk/Source/WebCore/css/CSSToStyleMap.h
r121164 r121285 74 74 RenderStyle* style() const; 75 75 RenderStyle* rootElementStyle() const; 76 RenderStyle* parentStyle() const; 76 77 bool useSVGZoomRules() const; 77 78 -
trunk/Source/WebCore/css/MediaQueryEvaluator.cpp
r119045 r121285 308 308 } 309 309 310 static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, RenderStyle* rootStyle, int& result)310 static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, int& result) 311 311 { 312 312 if (!value->isPrimitiveValue()) … … 321 321 322 322 if (primitiveValue->isLength()) { 323 result = primitiveValue->computeLength<int>(style, rootStyle );323 result = primitiveValue->computeLength<int>(style, rootStyle, parentStyle); 324 324 return true; 325 325 } … … 333 333 FloatRect sg = screenRect(frame->page()->mainFrame()->view()); 334 334 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 335 ContainerNode* parentNode = frame->document()->documentElement()->parentNodeForRenderingAndStyle(); 336 RenderStyle* parentStyle = parentNode ? parentNode->renderStyle() : 0; 335 337 int length; 336 338 long height = sg.height(); 337 339 InspectorInstrumentation::applyScreenHeightOverride(frame, &height); 338 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(height), length, op);340 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, parentStyle, length) && compareValue(static_cast<int>(height), length, op); 339 341 } 340 342 // ({,min-,max-}device-height) … … 348 350 FloatRect sg = screenRect(frame->page()->mainFrame()->view()); 349 351 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 352 ContainerNode* parentNode = frame->document()->documentElement()->parentNodeForRenderingAndStyle(); 353 RenderStyle* parentStyle = parentNode ? parentNode->renderStyle() : 0; 350 354 int length; 351 355 long width = sg.width(); 352 356 InspectorInstrumentation::applyScreenWidthOverride(frame, &width); 353 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(width), length, op);357 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, parentStyle, length) && compareValue(static_cast<int>(width), length, op); 354 358 } 355 359 // ({,min-,max-}device-width) … … 364 368 if (value) { 365 369 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 370 ContainerNode* parentNode = frame->document()->documentElement()->parentNodeForRenderingAndStyle(); 371 RenderStyle* parentStyle = parentNode ? parentNode->renderStyle() : 0; 366 372 int length; 367 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(view->layoutHeight(), length, op);373 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, parentStyle, length) && compareValue(view->layoutHeight(), length, op); 368 374 } 369 375 … … 377 383 if (value) { 378 384 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 385 ContainerNode* parentNode = frame->document()->documentElement()->parentNodeForRenderingAndStyle(); 386 RenderStyle* parentStyle = parentNode ? parentNode->renderStyle() : 0; 379 387 int length; 380 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(view->layoutWidth(), length, op);388 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, parentStyle, length) && compareValue(view->layoutWidth(), length, op); 381 389 } 382 390 -
trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp
r115432 r121285 560 560 return; 561 561 ShadowValue* item = static_cast<ShadowValue*>(firstValue); 562 IntPoint location(item->x->computeLength<int>(style(), m_rootElementStyle ),563 item->y->computeLength<int>(style(), m_rootElementStyle ));564 int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle ) : 0;562 IntPoint location(item->x->computeLength<int>(style(), m_rootElementStyle, m_parentStyle), 563 item->y->computeLength<int>(style(), m_rootElementStyle, m_parentStyle)); 564 int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle, m_parentStyle) : 0; 565 565 Color color; 566 566 if (item->color) -
trunk/Source/WebCore/css/StyleBuilder.cpp
r121164 r121285 35 35 #include "Document.h" 36 36 #include "Element.h" 37 #include "NodeRenderStyle.h" 37 38 #include "Pair.h" 38 39 #include "Rect.h" … … 213 214 setValue(styleResolver->style(), *primitiveValue); 214 215 else if (valueType == ComputeLength) 215 setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver-> style()->effectiveZoom()));216 setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom())); 216 217 } 217 218 … … 223 224 static Length convertToLength(StyleResolver* styleResolver, CSSPrimitiveValue* value) 224 225 { 225 return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver-> style()->effectiveZoom());226 return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom()); 226 227 } 227 228 public: … … 380 381 setValue(styleResolver->style(), Length()); 381 382 else if (primitiveValue->isLength()) { 382 Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver-> style()->effectiveZoom());383 Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom()); 383 384 length.setQuirk(primitiveValue->isQuirkValue()); 384 385 setValue(styleResolver->style(), length); … … 386 387 setValue(styleResolver->style(), Length(primitiveValue->getDoubleValue(), Percent)); 387 388 else if (primitiveValue->isCalculatedPercentageWithLength()) 388 setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver-> style()->effectiveZoom())));389 setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom()))); 389 390 else if (primitiveValue->isViewportPercentageLength()) 390 391 setValue(styleResolver->style(), primitiveValue->viewportPercentageLength()); … … 446 447 return; 447 448 } else 448 radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver-> style()->effectiveZoom());449 radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom()); 449 450 if (pair->second()->isPercentage()) 450 451 radiusHeight = Length(pair->second()->getDoubleValue(), Percent); … … 456 457 return; 457 458 } else 458 radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver-> style()->effectiveZoom());459 radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom()); 459 460 int width = radiusWidth.value(); 460 461 int height = radiusHeight.value(); … … 601 602 } else if (ident == CSSValueInvalid) { 602 603 float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom(); 603 length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), zoom);604 length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), zoom); 604 605 } else { 605 606 ASSERT_NOT_REACHED(); … … 739 740 fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize 740 741 || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength())); 742 743 RenderStyle* gpStyle = 0; 744 ContainerNode* parentNode = styleResolver->parentNode(); 745 if (parentNode) { 746 ContainerNode* gpNode = parentNode->parentNodeForRenderingAndStyle(); 747 gpStyle = gpNode ? gpNode->renderStyle() : 0; 748 } 749 741 750 if (primitiveValue->isLength()) 742 size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0, true);751 size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), gpStyle, 1.0, true); 743 752 else if (primitiveValue->isPercentage()) 744 753 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f; 745 754 else if (primitiveValue->isCalculatedPercentageWithLength()) 746 size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle() )->evaluate(parentSize);755 size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle(), gpStyle)->evaluate(parentSize); 747 756 else if (primitiveValue->isViewportPercentageLength()) 748 757 size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document()->renderView()); … … 1201 1210 multiplier *= frame->textZoomFactor(); 1202 1211 } 1203 lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);1212 lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), multiplier); 1204 1213 } else if (primitiveValue->isPercentage()) { 1205 1214 // FIXME: percentage should not be restricted to an integer here. … … 1223 1232 class ApplyPropertyPageSize { 1224 1233 private: 1225 static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0 ); }1226 static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0 ); }1234 static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0, 0); } 1235 static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0, 0); } 1227 1236 static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height) 1228 1237 { … … 1319 1328 if (!second->isLength()) 1320 1329 return; 1321 width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle() );1322 height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle() );1330 width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle()); 1331 height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle()); 1323 1332 } else { 1324 1333 // <page-size> <orientation> … … 1338 1347 // <length> 1339 1348 pageSizeType = PAGE_SIZE_RESOLVED; 1340 width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle() );1349 width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle()); 1341 1350 } else { 1342 1351 switch (primitiveValue->getIdent()) { … … 1572 1581 return styleResolver->style()->setVerticalAlign(*primitiveValue); 1573 1582 1574 styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver-> style()->effectiveZoom()));1583 styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom())); 1575 1584 } 1576 1585 -
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) -
trunk/Source/WebCore/css/StyleResolver.h
r121164 r121285 157 157 void setTextSizeAdjust(bool b) { m_fontDirty |= style()->setTextSizeAdjust(b); } 158 158 bool hasParentNode() const { return m_parentNode; } 159 159 ContainerNode* parentNode() const { return m_parentNode; } 160 160 161 void appendAuthorStylesheets(unsigned firstNew, const Vector<RefPtr<StyleSheet> >&); 161 162 … … 245 246 bool usesLinkRules() const { return m_features.usesLinkRules; } 246 247 247 static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, TransformOperations& outOperations);248 static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, TransformOperations& outOperations); 248 249 249 250 void invalidateMatchedPropertiesCache(); … … 410 411 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; } 411 412 412 static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);413 static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);413 static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1); 414 static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1); 414 415 415 416 CSSToStyleMap* styleMap() { return &m_styleMap; } -
trunk/Source/WebCore/css/WebKitCSSMatrix.cpp
r115972 r121285 67 67 68 68 TransformOperations operations; 69 if (!StyleResolver::createTransformOperations(value.get(), 0, 0, operations)) {69 if (!StyleResolver::createTransformOperations(value.get(), 0, 0, 0, operations)) { 70 70 ec = SYNTAX_ERR; 71 71 return;
Note: See TracChangeset
for help on using the changeset viewer.