Ignore:
Timestamp:
Jun 26, 2012, 1:23:26 PM (13 years ago)
Author:
[email protected]
Message:

ietestcenter/css3/valuesandunits/units-000.htm asserts
https://bugs.webkit.org/show_bug.cgi?id=86176

Patch by Dave Tharp <[email protected]> on 2012-06-26
Reviewed by Beth Dakin.

Source/WebCore:

Modified computeLengthDouble() to handle vh, vw, and vmin units. Per the spec
(http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths) viewport -percentage
lengths are "relative to the size of the initial containing block", which I read to be
the size of the parent element. Since parentStyle was not available in computeLengthDouble,
most of the changes for this patch involved "pushing down" the parentStyle pointer through
the network of computeLength methods and dependencies.

Tests: css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html

css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html
css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html

  • css/CSSCalculationValue.cpp:

(WebCore::CSSCalcValue::computeLengthPx):
(WebCore::CSSCalcPrimitiveValue::toCalcValue):
(WebCore::CSSCalcPrimitiveValue::computeLengthPx):
(WebCore::CSSCalcBinaryOperation::toCalcValue):
(WebCore::CSSCalcBinaryOperation::computeLengthPx):

  • css/CSSCalculationValue.h:

(CSSCalcExpressionNode):
(WebCore::CSSCalcValue::toCalcValue):
(CSSCalcValue):

  • css/CSSGradientValue.cpp:

(WebCore::CSSGradientValue::addStops):
(WebCore::positionFromValue):
(WebCore::CSSGradientValue::computeEndPoint):
(WebCore::CSSLinearGradientValue::createGradient):
(WebCore::CSSRadialGradientValue::resolveRadius):
(WebCore::CSSRadialGradientValue::createGradient):

  • css/CSSGradientValue.h:

(CSSGradientValue):
(CSSRadialGradientValue):

  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::computeLength):
(WebCore::CSSPrimitiveValue::computeLengthDouble):

  • css/CSSPrimitiveValue.h:

(CSSPrimitiveValue):

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::convertToLength):

  • css/CSSToStyleMap.cpp:

(WebCore::CSSToStyleMap::parentStyle):
(WebCore):
(WebCore::CSSToStyleMap::mapFillSize):
(WebCore::CSSToStyleMap::mapFillXPosition):
(WebCore::CSSToStyleMap::mapFillYPosition):
(WebCore::CSSToStyleMap::mapNinePieceImageQuad):

  • css/CSSToStyleMap.h:

(CSSToStyleMap):

  • css/MediaQueryEvaluator.cpp:

(WebCore::computeLength):
(WebCore::device_heightMediaFeatureEval):
(WebCore::device_widthMediaFeatureEval):
(WebCore::heightMediaFeatureEval):
(WebCore::widthMediaFeatureEval):

  • css/SVGCSSStyleSelector.cpp:

(WebCore::StyleResolver::applySVGProperty):

  • css/StyleBuilder.cpp:

(WebCore::ApplyPropertyAuto::applyValue):
(WebCore::ApplyPropertyClip::convertToLength):
(WebCore::ApplyPropertyLength::applyValue):
(WebCore::ApplyPropertyBorderRadius::applyValue):
(WebCore::ApplyPropertyComputeLength::applyValue):
(WebCore::ApplyPropertyFontSize::applyValue):
(WebCore::ApplyPropertyLineHeight::applyValue):
(WebCore::ApplyPropertyPageSize::mmLength):
(WebCore::ApplyPropertyPageSize::inchLength):
(WebCore::ApplyPropertyPageSize::applyValue):
(WebCore::ApplyPropertyVerticalAlign::applyValue):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

  • css/StyleResolver.h:

(WebCore::StyleResolver::parentNode):
(StyleResolver):

  • css/WebKitCSSMatrix.cpp:

(WebCore::WebKitCSSMatrix::setMatrixValue):

LayoutTests:

Adding explicit tests for viewport border length tests. Inspired by IE Test center
units-000 test which highlighted that vw, vh, and vmin were not being handled in computeLengthDouble().
Also, adjusting test_expectations and Skipped for units-000, which no longer Asserts with this
patch implemented.

  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border-expected.html: Added.
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html: Added.
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border-expected.html: Added.
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html: Added.
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border-expected.htm: Added.
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html: Added.
  • ietestcenter/css3/valuesandunits/units-000.htm:
  • platform/chromium/TestExpectations:
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/mac/TestExpectations:
  • platform/qt/TestExpectations:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSCalculationValue.h

    r118900 r121285  
    6161    virtual ~CSSCalcExpressionNode() = 0;
    6262    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;
    6464    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;
    6666    virtual String customCssText() const = 0;
    6767   
     
    8585    static PassRefPtr<CSSCalcValue> create(CalculationValue*);
    8686
    87     PassRefPtr<CalculationValue> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom = 1.0) const
     87    PassRefPtr<CalculationValue> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom = 1.0) const
    8888    {
    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);
    9090    }
    9191    CalculationCategory category() const { return m_expression->category(); }
     
    9393    double doubleValue() const;
    9494    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;
    9696       
    9797    String customCssText() const;
Note: See TracChangeset for help on using the changeset viewer.