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.cpp

    r118900 r121285  
    9898}
    9999
    100 double CSSCalcValue::computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
    101 {
    102     return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize));
     100double 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));
    103103}
    104104   
     
    125125    }
    126126
    127     virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom) const
     127    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom) const
    128128    {
    129129        switch (m_category) {
     
    131131            return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
    132132        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)));
    134134        case CalcPercent:
    135135        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)));
    137137        // Only types that could be part of a Length expression can be converted
    138138        // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length.
     
    160160    }
    161161   
    162     virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
     162    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize) const
    163163    {
    164164        switch (m_category) {
    165165        case CalcLength:
    166             return m_value->computeLength<double>(currentStyle, rootStyle, multiplier, computingFontSize);
     166            return m_value->computeLength<double>(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize);
    167167        case CalcPercent:
    168168        case CalcNumber:
     
    238238    }
    239239
    240     virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom) const
    241     {
    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));
    243243        if (!left)
    244244            return nullptr;
    245         OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, zoom));
     245        OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, parentStyle, zoom));
    246246        if (!right)
    247247            return nullptr;
     
    254254    }
    255255   
    256     virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
    257     {
    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);
    260260        return evaluate(leftValue, rightValue);
    261261    }
Note: See TracChangeset for help on using the changeset viewer.