vw/vh units used as font/line-height values don't scale with the viewport
authorbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 May 2014 01:33:26 +0000 (01:33 +0000)
committerbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 May 2014 01:33:26 +0000 (01:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=87846

Reviewed by Darin Adler.

Source/WebCore:
This patch moves the resolution of viewport units to style recalc
time. Currently viewport units are left unresolved during style
recalcs, which leads to many problems with viewport units. Moving the
resolution will fix these problems, as well as reduce the plumbing
that goes on.

This patch touches a lot of files since the valueForLength functions
no longer need a RenderView. The interesting changes are in:

- CSSToLengthConversionData -> CSSPrimitiveValue: for moving
    resolution to style recalc time.
- Length / LengthFunctions: no longer needs to know about viewport
    units.
- FrameView -> Document -> StyleResolver: for scheduling style recalcs
    upon resize

Note that getComputedStyle will now return pixel values when viewport
units are used. This behavior matches Firefox and the css3-cascade
spec.

This is based on a Blink patch by timloh@chromium.org.

Tests: css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html
       css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html
       css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html
       css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html
       css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html

* WebCore.exp.in: Remove RenderView argument to floatValueForLength.
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(getAttributeSetForAccessibilityObject): Remove RenderView argument.
* css/BasicShapeFunctions.cpp:
(WebCore::convertToLength): Ditto.
(WebCore::floatValueForCenterCoordinate): Ditto.
* css/BasicShapeFunctions.h: Ditto.
* css/CSSCalculationValue.cpp:
(WebCore::unitCategory): Remove special handling for viewport units,
    as they get resolved to pixels.
(WebCore::createCSS): Ditto.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::positionOffsetValue): Remove RendewView argument.
(WebCore::getBorderRadiusCornerValues): Remove handling of viewport
    units, as they are already resolve to pixels here.
(WebCore::getBorderRadiusCornerValue): Remove RenderView argument.
(WebCore::getBorderRadiusShorthandValue): Ditto.
(WebCore::specifiedValueForGridTrackBreadth): Remove handling of
    viewport units, as they are already resolved to pixels here.
(WebCore::specifiedValueForGridTrackSize): Remove RenderView argument.
(WebCore::valueForGridTrackList): Ditto.
(WebCore::lineHeightFromStyle): Ditto.
(WebCore::ComputedStyleExtractor::propertyValue): Ditto.
* css/CSSGradientValue.cpp:
(WebCore::CSSLinearGradientValue::createGradient): Pass RenderView to
    CSSToLengthConversionData constructor.
(WebCore::CSSRadialGradientValue::createGradient): Ditto.
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::unitCategory): Remove handling of
    viewport units, as they get resolved to pixels.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Ditto.
(WebCore::CSSPrimitiveValue::init): Ditto.
(WebCore::CSSPrimitiveValue::computeLengthDouble): Resolve viewport
    units to pixels.
(WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory): Remove
handling of viewport units, since they get resolved to pixels.
(WebCore::CSSPrimitiveValue::viewportPercentageLength): Deleted.
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::isLength): Remove special handling of
    viewport units, since they get resolved to pixels.
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::convertToLength): Ditto.
* css/CSSToLengthConversionData.cpp:
(WebCore::CSSToLengthConversionData::viewportWidthFactor): Caclulate
    conversion factor for viewport units to pixels. Note this does not
    set hasViewportUnits on the RenderStyle if computing the font
    size, because in the font size case, the RenderStyle is the
    parent's style, not the current renderer's style.
(WebCore::CSSToLengthConversionData::viewportHeightFactor): Ditto.
(WebCore::CSSToLengthConversionData::viewportMinFactor): Ditto.
(WebCore::CSSToLengthConversionData::viewportMaxFactor): Ditto.
* css/CSSToLengthConversionData.h:
(WebCore::CSSToLengthConversionData::CSSToLengthConversionData): Add
    RenderView parameter, and make RenderStyle non-const so that
    hasViewportUnits can be set on the Style..
(WebCore::CSSToLengthConversionData::style): style is now non-const.
(WebCore::CSSToLengthConversionData::copyWithAdjustedZoom): Handle
    RenderView argument.
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapFillXPosition): Remove handling of
    viewport units, as they are already resolved to pixels here.
(WebCore::CSSToStyleMap::mapFillYPosition): Ditto.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyLength::applyValue): Ditto.
(WebCore::ApplyPropertyBorderRadius::applyValue): Ditto.
(WebCore::ApplyPropertyComputeLength::applyValue): Ditto.
(WebCore::ApplyPropertyFontSize::applyValue): Ditto.
(WebCore::ApplyPropertyLineHeight::applyValue): Ditto.
(WebCore::ApplyPropertyLineHeightForIOSTextAutosizing::applyValue): Ditto.
(WebCore::ApplyPropertyWordSpacing::applyValue): Ditto.
(WebCore::ApplyPropertyVerticalAlign::applyValue): Ditto.
(WebCore::ApplyPropertyTextIndent::applyValue): Ditto.
* css/LengthFunctions.cpp:
(WebCore::minimumIntValueForLength): Remove RenderView argument.
(WebCore::intValueForLength): Remove RenderView argument and
    roundPecentages.
(WebCore::minimumValueForLength): Remove RenderView argument, and
    special handling of viewport units.
(WebCore::valueForLength): Ditto.
(WebCore::floatValueForLength): Ditto.
(WebCore::floatSizeForLengthSize): Remove RenderView argument.
* css/LengthFunctions.h: Ditto.
* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::eval): Add RenderView argument for
    CSSToLengthConversionData constuctor.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::clear): Change to 0 arg constructor
    for CSSToLengthConversionData.
(WebCore::StyleResolver::State::updateConversionData): In order to get
    the RenderView, we need to have a valid Element set on the state.
    Since this means that we need to set the conversion data in more
    places, move the contruction of conversion data into this helper
    method.
(WebCore::StyleResolver::State::initElement): Make sure conversion
    data is up to date.
(WebCore::StyleResolver::State::initForStyleResolve): Ditto.
(WebCore::StyleResolver::State::setStyle): When the style is set, we
    need to make sure to update the conversion data.
(WebCore::StyleResolver::styleForElement): If the style has viewport
    units, flage the document so that we can make sure to recalc the
    viewport unit values when the viewport is resized.
(WebCore::StyleResolver::pseudoStyleForElement): Ditto.
(WebCore::StyleResolver::updateFont): Make sure the font having
    viewport units updates the style.
(WebCore::StyleResolver::convertToIntLength): Remove handling of
viewport units, as they are resolved to pixels.
(WebCore::StyleResolver::convertToFloatLength): Ditto.
(WebCore::StyleResolver::clearCachedPropertiesAffectedByViewportUnits):
    Invalidate the matched properties cache for styles with viewport
    units when the viewport is resized.
(WebCore::createGridTrackBreadth): Remove handling of viewport units,
    as they are resolved to pixels.
(WebCore::StyleResolver::applyProperty): Ditto.
(WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange):
    Rename to be less confusing, since it has nothing to do with
    viewport units.
(WebCore::StyleResolver::createFilterOperations): Remove handling of
    viewport units, as they are resolved to pixels.
(WebCore::StyleResolver::affectedByViewportChange): Deleted.
(WebCore::StyleResolver::viewportPercentageValue): Deleted.
* css/StyleResolver.h:
(WebCore::StyleResolver::State::State): C++11 cleanup: 0 -> nullptr.
(WebCore::StyleResolver::State::setFontSizeHasViewportUnits): Set if
    the font size is specified in viewport units.
(WebCore::StyleResolver::State::fontSizeHasViewportUnits): Ditto.
(WebCore::StyleResolver::State::setStyle): Deleted.
* css/TransformFunctions.cpp:
(WebCore::convertToFloatLength): Remove handling of viewport units,
    since they are resolved to pixels.
* dom/Document.cpp:
(WebCore::Document::Document): Add flag to determine if some style in
    the document has viewport units.
(WebCore::Document::pageSizeAndMarginsInPixels): Remove RenderView
    argument.
(WebCore::Document::updateViewportUnitsOnResize): Mark elements with
    viewport units for style recalc when the viewport size has
    changed.
* dom/Document.h:
(WebCore::Document::setHasStyleWithViewportUnits): Flag to determine
    if some style in the document has viewport units.
(WebCore::Document::hasStyleWithViewportUnits): Ditto.
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::getRegion): Remove RenderView argument.
* page/FrameView.cpp:
(WebCore::FrameView::layout): When the viewport is resized, call
    updateViewportUnitsOnResize on the document.
* platform/Length.h:
(WebCore::Length::isSpecified): Remove handling of viewport units,
    since they are now resolved to pixels.
(WebCore::Length::viewportPercentageLength): Deleted.
(WebCore::Length::isViewportPercentage): Deleted.
* rendering/ClipPathOperation.h:
(WebCore::ShapeClipPathOperation::pathForReferenceRect): Remove
    RenderView argument.
(WebCore::BoxClipPathOperation::pathForReferenceRect): Ditto.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateBlockChildDirtyBitsBeforeLayout): Remove
    handling of viewport units, since they get updated by
    updateViewportUnitsOnResize when the viewport is resized.
(WebCore::RenderBlock::nodeAtPoint): Remove RenderView argument.
(WebCore::RenderBlock::lineHeight): Ditto.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintBoxDecorations): Remove RenderView argument.
(WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
    Remove handling of viewport units, as they are resolved to pixels.
(WebCore::RenderBox::computePercentageLogicalHeight): Ditto.
(WebCore::RenderBox::computeReplacedLogicalWidthUsing): Ditto.
(WebCore::RenderBox::computeReplacedLogicalHeightUsing): Ditto.
(WebCore::RenderBox::hasViewportPercentageLogicalHeight): Deleted.
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::getBackgroundRoundedRect): Remove
    RenderView argument.
(WebCore::RenderBoxModelObject::calculateFillTileSize): Remove
    handling of viewport units, as they are resolved to pixels.
(WebCore::computeBorderImageSide): Remove RenderView argument.
(WebCore::RenderBoxModelObject::paintNinePieceImage): Ditto.
(WebCore::RenderBoxModelObject::paintBorder): Ditto.
(WebCore::RenderBoxModelObject::paintBoxShadow): Ditto.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::repaintAfterLayoutIfNeeded): Ditto.
* rendering/RenderElement.h:
(WebCore::RenderElement::valueForLength): Remove unused
    roundPercentages argument.
(WebCore::RenderElement::minimumValueForLength): Remove unused
    RoundPercentages and RenderView arguments.
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutGridItems): Remove handling of viewport
    units as they are resolved to pixels.
* rendering/RenderInline.cpp:
(WebCore::computeMargin): Ditto.
(WebCore::RenderInline::lineHeight): Remove RenderView argument.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::setupClipPath): Ditto.
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::lineHeight): Ditto.
* rendering/RenderScrollbarPart.cpp:
(WebCore::calcScrollbarThicknessUsing): Ditto.
(WebCore::RenderScrollbarPart::computeScrollbarWidth): Ditto.
(WebCore::RenderScrollbarPart::computeScrollbarHeight): Ditto.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
    Remove handling of viewport units, since they are resolved to
    pixels.
(WebCore::RenderTable::computePreferredLogicalWidths): Now that
    viewport unit values are resolved to pixels at style recalc time,
    no special checking is needed to handle them, so update the
    comment to reflect that.
* rendering/RenderThemeIOS.mm:
(WebCore::applyCommonButtonPaddingToStyle): Add RenderView argument to
    CSSToLengthConversionData constructor.
(WebCore::RenderThemeIOS::adjustButtonStyle): Ditto.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuListButtonGradients): Remove
    RenderView argument.
* rendering/RenderView.cpp:
(WebCore::RenderView::layout): Remove handling of viewport units,
    since they are resolved to pixels.
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::ascentAndDescentForBox): Remove RenderView
    argument.
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createShape): Remove RenderView argument.
* rendering/shapes/Shape.h:
* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::ShapeOutsideInfo::computedShape): Ditto.
* rendering/style/BasicShapes.cpp:
(WebCore::BasicShapeCircle::floatValueForRadiusInBox): Ditto.
(WebCore::BasicShapeCircle::path): Ditto.
(WebCore::BasicShapeEllipse::floatValueForRadiusInBox): Ditto.
(WebCore::BasicShapeEllipse::path): Ditto.
(WebCore::BasicShapePolygon::path): Ditto.
(WebCore::floatSizeForLengthSize): Ditto.
(WebCore::BasicShapeInset::path): Ditto.
* rendering/style/BasicShapes.h:
* rendering/style/RenderStyle.cpp:
(WebCore::calcRadiiFor): Ditto.
(WebCore::RenderStyle::getRoundedBorderFor): Ditto.
(WebCore::RenderStyle::computedLineHeight): Remove handling of
    viewport units since they are resolved to pixels.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setHasViewportUnits): Set if this style has
a property set with viewport units.
(WebCore::RenderStyle::hasViewportUnits): Ditto.
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::resolveLengthAttributeForSVG): Remove RenderView argument.
(WebCore::RenderSVGRoot::computeReplacedLogicalWidth): Ditto.
(WebCore::RenderSVGRoot::computeReplacedLogicalHeight): Ditto.
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::prepareToRenderSVGContent): Ditto.

LayoutTests:
Update existing tests to work with the proper behavior of viewport
units.

Add tests for some of the things fixed by this patch: handling of
viewport units in font sizes, with calc, and when the viewport is
resized without a reload.

The anonymous block and percent size child tests make sure that the
viewport unit updates still work properly when there is another
relative unit the depends on the size specified in viewport units.

* css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle-expected.txt:
* css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html:
* css3/viewport-percentage-lengths/resources/resize-test.js: Added.
(resizeTest):
(standardResizeTest):
* css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block-expected.txt: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-calc-expected.txt: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child-expected.txt: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt: Added.
* css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html: Added.
* fast/canvas/draw-focus-if-needed-expected.txt: Removed.
* fast/canvas/draw-focus-if-needed.html: Removed.
* fast/masking/parsing-clip-path-shape-expected.txt:
* fast/masking/parsing-clip-path-shape.html:
* fast/shapes/parsing/parsing-shape-lengths-expected.txt:
* fast/shapes/parsing/parsing-shape-lengths.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169407 268f45cc-cd09-0410-ab3c-d52691b4dbfc

73 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle-expected.txt
LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html
LayoutTests/css3/viewport-percentage-lengths/resources/resize-test.js [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block-expected.txt [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-calc-expected.txt [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child-expected.txt [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html [new file with mode: 0644]
LayoutTests/fast/canvas/draw-focus-if-needed-expected.txt [deleted file]
LayoutTests/fast/canvas/draw-focus-if-needed.html [deleted file]
LayoutTests/fast/masking/parsing-clip-path-shape-expected.txt
LayoutTests/fast/masking/parsing-clip-path-shape.html
LayoutTests/fast/shapes/parsing/parsing-shape-lengths-expected.txt
LayoutTests/fast/shapes/parsing/parsing-shape-lengths.html
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
Source/WebCore/css/BasicShapeFunctions.cpp
Source/WebCore/css/BasicShapeFunctions.h
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSGradientValue.h
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSToLengthConversionData.cpp
Source/WebCore/css/CSSToLengthConversionData.h
Source/WebCore/css/CSSToStyleMap.cpp
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/css/LengthFunctions.cpp
Source/WebCore/css/LengthFunctions.h
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/css/TransformFunctions.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLAreaElement.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/Length.h
Source/WebCore/rendering/ClipPathOperation.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLineBreak.cpp
Source/WebCore/rendering/RenderScrollbarPart.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/shapes/Shape.cpp
Source/WebCore/rendering/shapes/Shape.h
Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
Source/WebCore/rendering/style/BasicShapes.cpp
Source/WebCore/rendering/style/BasicShapes.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/SVGRenderingContext.cpp

index e7bde8b..de825d7 100644 (file)
@@ -1,3 +1,43 @@
+2014-05-27  Bem Jones-Bey  <bjonesbe@adobe.com>
+
+        vw/vh units used as font/line-height values don't scale with the viewport
+        https://bugs.webkit.org/show_bug.cgi?id=87846
+
+        Reviewed by Darin Adler.
+
+        Update existing tests to work with the proper behavior of viewport
+        units.
+
+        Add tests for some of the things fixed by this patch: handling of
+        viewport units in font sizes, with calc, and when the viewport is
+        resized without a reload.
+
+        The anonymous block and percent size child tests make sure that the
+        viewport unit updates still work properly when there is another
+        relative unit the depends on the size specified in viewport units.
+
+        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle-expected.txt:
+        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html:
+        * css3/viewport-percentage-lengths/resources/resize-test.js: Added.
+        (resizeTest):
+        (standardResizeTest):
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block-expected.txt: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-calc-expected.txt: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child-expected.txt: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt: Added.
+        * css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html: Added.
+        * fast/canvas/draw-focus-if-needed-expected.txt: Removed.
+        * fast/canvas/draw-focus-if-needed.html: Removed.
+        * fast/masking/parsing-clip-path-shape-expected.txt:
+        * fast/masking/parsing-clip-path-shape.html:
+        * fast/shapes/parsing/parsing-shape-lengths-expected.txt:
+        * fast/shapes/parsing/parsing-shape-lengths.html:
+
 2014-05-27  Zoltan Horvath  <zoltan@webkit.org>
 
         [CSS Shapes] serialization of the computed value should omit the default radii
index cb5dc83..450c823 100644 (file)
@@ -8,7 +8,7 @@ PASS style.getPropertyValue("height") is '240px'
 PASS style.getPropertyValue("width") is '240px'
 PASS style.getPropertyValue("font-size") is '24px'
 PASS style.getPropertyValue("line-height") is '32px'
-PASS style.getPropertyValue("text-indent") is '2vw'
+PASS style.getPropertyValue("text-indent") is '16px'
 PASS style.getPropertyValue("margin-left") is '16px'
 PASS style.getPropertyValue("margin-right") is '16px'
 PASS style.getPropertyValue("margin-top") is '16px'
@@ -17,10 +17,10 @@ PASS style.getPropertyValue("border-top-left-radius") is '8px'
 PASS style.getPropertyValue("border-top-right-radius") is '8px'
 PASS style.getPropertyValue("border-bottom-left-radius") is '8px'
 PASS style.getPropertyValue("border-bottom-right-radius") is '8px'
-PASS style.getPropertyValue("min-height") is '10vw'
-PASS style.getPropertyValue("min-width") is '10vw'
-PASS style.getPropertyValue("max-height") is '60vw'
-PASS style.getPropertyValue("max-width") is '60vw'
+PASS style.getPropertyValue("min-height") is '80px'
+PASS style.getPropertyValue("min-width") is '80px'
+PASS style.getPropertyValue("max-height") is '480px'
+PASS style.getPropertyValue("max-width") is '480px'
 PASS style.getPropertyValue("top") is '80px'
 PASS style.getPropertyValue("bottom") is '80px'
 PASS style.getPropertyValue("left") is '80px'
@@ -35,7 +35,7 @@ PASS style.getPropertyValue("height") is '180px'
 PASS style.getPropertyValue("width") is '180px'
 PASS style.getPropertyValue("font-size") is '18px'
 PASS style.getPropertyValue("line-height") is '24px'
-PASS style.getPropertyValue("text-indent") is '2vh'
+PASS style.getPropertyValue("text-indent") is '12px'
 PASS style.getPropertyValue("margin-left") is '12px'
 PASS style.getPropertyValue("margin-right") is '12px'
 PASS style.getPropertyValue("margin-top") is '12px'
@@ -44,10 +44,10 @@ PASS style.getPropertyValue("border-top-left-radius") is '6px'
 PASS style.getPropertyValue("border-top-right-radius") is '6px'
 PASS style.getPropertyValue("border-bottom-left-radius") is '6px'
 PASS style.getPropertyValue("border-bottom-right-radius") is '6px'
-PASS style.getPropertyValue("min-height") is '10vh'
-PASS style.getPropertyValue("min-width") is '10vh'
-PASS style.getPropertyValue("max-height") is '60vh'
-PASS style.getPropertyValue("max-width") is '60vh'
+PASS style.getPropertyValue("min-height") is '60px'
+PASS style.getPropertyValue("min-width") is '60px'
+PASS style.getPropertyValue("max-height") is '360px'
+PASS style.getPropertyValue("max-width") is '360px'
 PASS style.getPropertyValue("top") is '60px'
 PASS style.getPropertyValue("bottom") is '60px'
 PASS style.getPropertyValue("left") is '60px'
@@ -62,7 +62,7 @@ PASS style.getPropertyValue("height") is '180px'
 PASS style.getPropertyValue("width") is '180px'
 PASS style.getPropertyValue("font-size") is '18px'
 PASS style.getPropertyValue("line-height") is '24px'
-PASS style.getPropertyValue("text-indent") is '2vmin'
+PASS style.getPropertyValue("text-indent") is '12px'
 PASS style.getPropertyValue("margin-left") is '12px'
 PASS style.getPropertyValue("margin-right") is '12px'
 PASS style.getPropertyValue("margin-top") is '12px'
@@ -71,10 +71,10 @@ PASS style.getPropertyValue("border-top-left-radius") is '6px'
 PASS style.getPropertyValue("border-top-right-radius") is '6px'
 PASS style.getPropertyValue("border-bottom-left-radius") is '6px'
 PASS style.getPropertyValue("border-bottom-right-radius") is '6px'
-PASS style.getPropertyValue("min-height") is '10vmin'
-PASS style.getPropertyValue("min-width") is '10vmin'
-PASS style.getPropertyValue("max-height") is '60vmin'
-PASS style.getPropertyValue("max-width") is '60vmin'
+PASS style.getPropertyValue("min-height") is '60px'
+PASS style.getPropertyValue("min-width") is '60px'
+PASS style.getPropertyValue("max-height") is '360px'
+PASS style.getPropertyValue("max-width") is '360px'
 PASS style.getPropertyValue("top") is '60px'
 PASS style.getPropertyValue("bottom") is '60px'
 PASS style.getPropertyValue("left") is '60px'
@@ -89,7 +89,7 @@ PASS style.getPropertyValue("height") is '240px'
 PASS style.getPropertyValue("width") is '240px'
 PASS style.getPropertyValue("font-size") is '24px'
 PASS style.getPropertyValue("line-height") is '32px'
-PASS style.getPropertyValue("text-indent") is '2vmax'
+PASS style.getPropertyValue("text-indent") is '16px'
 PASS style.getPropertyValue("margin-left") is '16px'
 PASS style.getPropertyValue("margin-right") is '16px'
 PASS style.getPropertyValue("margin-top") is '16px'
@@ -98,10 +98,10 @@ PASS style.getPropertyValue("border-top-left-radius") is '8px'
 PASS style.getPropertyValue("border-top-right-radius") is '8px'
 PASS style.getPropertyValue("border-bottom-left-radius") is '8px'
 PASS style.getPropertyValue("border-bottom-right-radius") is '8px'
-PASS style.getPropertyValue("min-height") is '10vmax'
-PASS style.getPropertyValue("min-width") is '10vmax'
-PASS style.getPropertyValue("max-height") is '60vmax'
-PASS style.getPropertyValue("max-width") is '60vmax'
+PASS style.getPropertyValue("min-height") is '80px'
+PASS style.getPropertyValue("min-width") is '80px'
+PASS style.getPropertyValue("max-height") is '480px'
+PASS style.getPropertyValue("max-width") is '480px'
 PASS style.getPropertyValue("top") is '80px'
 PASS style.getPropertyValue("bottom") is '80px'
 PASS style.getPropertyValue("left") is '80px'
index 6603617..38e483e 100644 (file)
@@ -149,130 +149,146 @@ description("Test for Bug: 27160/91440 - Implement vw/vh/vmin/vmax (viewport siz
 // These have to be global for the test helpers to see them.
 var element, style;
 
+function vw(x) {
+    return "'" + Math.floor(x * window.innerWidth / 100) + "px'";
+}
+
+function vh(x) {
+    return "'" + Math.floor(x * window.innerHeight / 100) + "px'";
+}
+
+function vmin(x) {
+    return "'" + Math.floor(x * Math.min(window.innerWidth, window.innerHeight) / 100) + "px'";
+}
+
+function vmax(x) {
+    return "'" + Math.floor(x * Math.max(window.innerWidth, window.innerHeight) / 100) + "px'";
+}
+
 function getTheStyle() {
     debug("Test for vw")
     element = document.getElementById("element-container-vw");
     style = window.getComputedStyle(element,null);
     var viewportWidth = window.innerWidth;
-    shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("text-indent")', "'2vw'");
-    shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("min-height")', "'10vw'");
-    shouldBe('style.getPropertyValue("min-width")', "'10vw'");
-    shouldBe('style.getPropertyValue("max-height")', "'60vw'");
-    shouldBe('style.getPropertyValue("max-width")', "'60vw'");
+    shouldBe('style.getPropertyValue("height")', vw(30));
+    shouldBe('style.getPropertyValue("width")', vw(30));
+    shouldBe('style.getPropertyValue("font-size")', vw(3));
+    shouldBe('style.getPropertyValue("line-height")', vw(4));
+    shouldBe('style.getPropertyValue("text-indent")', vw(2));
+    shouldBe('style.getPropertyValue("margin-left")', vw(2));
+    shouldBe('style.getPropertyValue("margin-right")', vw(2));
+    shouldBe('style.getPropertyValue("margin-top")', vw(2));
+    shouldBe('style.getPropertyValue("margin-bottom")', vw(2));
+    shouldBe('style.getPropertyValue("border-top-left-radius")', vw(1));
+    shouldBe('style.getPropertyValue("border-top-right-radius")', vw(1));
+    shouldBe('style.getPropertyValue("border-bottom-left-radius")', vw(1));
+    shouldBe('style.getPropertyValue("border-bottom-right-radius")', vw(1));
+    shouldBe('style.getPropertyValue("min-height")', vw(10));
+    shouldBe('style.getPropertyValue("min-width")', vw(10));
+    shouldBe('style.getPropertyValue("max-height")', vw(60));
+    shouldBe('style.getPropertyValue("max-width")', vw(60));
     element.id = "element-container-absolute-vw";
-    shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
+    shouldBe('style.getPropertyValue("top")', vw(10));
+    shouldBe('style.getPropertyValue("bottom")', vw(10));
+    shouldBe('style.getPropertyValue("left")', vw(10));
+    shouldBe('style.getPropertyValue("right")', vw(10));
+    shouldBe('style.getPropertyValue("padding-left")', vw(2));
+    shouldBe('style.getPropertyValue("padding-right")', vw(2));
+    shouldBe('style.getPropertyValue("padding-top")', vw(2));
+    shouldBe('style.getPropertyValue("padding-bottom")', vw(2));
 
     debug("\nTest for vh")
     element.id = "element-container-vh";
     style = window.getComputedStyle(element,null);
     var viewportHeight = window.innerHeight;
-    shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("text-indent")', "'2vh'");
-    shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("min-height")', "'10vh'");
-    shouldBe('style.getPropertyValue("min-width")', "'10vh'");
-    shouldBe('style.getPropertyValue("max-height")', "'60vh'");
-    shouldBe('style.getPropertyValue("max-width")', "'60vh'");
+    shouldBe('style.getPropertyValue("height")', vh(30));
+    shouldBe('style.getPropertyValue("width")', vh(30));
+    shouldBe('style.getPropertyValue("font-size")', vh(3));
+    shouldBe('style.getPropertyValue("line-height")', vh(4));
+    shouldBe('style.getPropertyValue("text-indent")', vh(2));
+    shouldBe('style.getPropertyValue("margin-left")', vh(2));
+    shouldBe('style.getPropertyValue("margin-right")', vh(2));
+    shouldBe('style.getPropertyValue("margin-top")', vh(2));
+    shouldBe('style.getPropertyValue("margin-bottom")', vh(2));
+    shouldBe('style.getPropertyValue("border-top-left-radius")', vh(1));
+    shouldBe('style.getPropertyValue("border-top-right-radius")', vh(1));
+    shouldBe('style.getPropertyValue("border-bottom-left-radius")', vh(1));
+    shouldBe('style.getPropertyValue("border-bottom-right-radius")', vh(1));
+    shouldBe('style.getPropertyValue("min-height")', vh(10));
+    shouldBe('style.getPropertyValue("min-width")', vh(10));
+    shouldBe('style.getPropertyValue("max-height")', vh(60));
+    shouldBe('style.getPropertyValue("max-width")', vh(60));
     element.id = "element-container-absolute-vh";
-    shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
+    shouldBe('style.getPropertyValue("top")', vh(10));
+    shouldBe('style.getPropertyValue("bottom")', vh(10));
+    shouldBe('style.getPropertyValue("left")', vh(10));
+    shouldBe('style.getPropertyValue("right")', vh(10));
+    shouldBe('style.getPropertyValue("padding-left")', vh(2));
+    shouldBe('style.getPropertyValue("padding-right")', vh(2));
+    shouldBe('style.getPropertyValue("padding-top")', vh(2));
+    shouldBe('style.getPropertyValue("padding-bottom")', vh(2));
 
     debug("\nTest for vmin")
     element.id = "element-container-vmin";
     style = window.getComputedStyle(element,null);
     var viewportMinLength = Math.min(window.innerWidth, window.innerHeight);
-    shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("text-indent")', "'2vmin'");
-    shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("min-height")', "'10vmin'");
-    shouldBe('style.getPropertyValue("min-width")', "'10vmin'");
-    shouldBe('style.getPropertyValue("max-height")', "'60vmin'");
-    shouldBe('style.getPropertyValue("max-width")', "'60vmin'");
+    shouldBe('style.getPropertyValue("height")', vmin(30));
+    shouldBe('style.getPropertyValue("width")', vmin(30));
+    shouldBe('style.getPropertyValue("font-size")', vmin(3));
+    shouldBe('style.getPropertyValue("line-height")', vmin(4));
+    shouldBe('style.getPropertyValue("text-indent")', vmin(2));
+    shouldBe('style.getPropertyValue("margin-left")', vmin(2));
+    shouldBe('style.getPropertyValue("margin-right")', vmin(2));
+    shouldBe('style.getPropertyValue("margin-top")', vmin(2));
+    shouldBe('style.getPropertyValue("margin-bottom")', vmin(2));
+    shouldBe('style.getPropertyValue("border-top-left-radius")', vmin(1));
+    shouldBe('style.getPropertyValue("border-top-right-radius")', vmin(1));
+    shouldBe('style.getPropertyValue("border-bottom-left-radius")', vmin(1));
+    shouldBe('style.getPropertyValue("border-bottom-right-radius")', vmin(1));
+    shouldBe('style.getPropertyValue("min-height")', vmin(10));
+    shouldBe('style.getPropertyValue("min-width")', vmin(10));
+    shouldBe('style.getPropertyValue("max-height")', vmin(60));
+    shouldBe('style.getPropertyValue("max-width")', vmin(60));
     element.id = "element-container-absolute-vmin";
-    shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
+    shouldBe('style.getPropertyValue("top")', vmin(10));
+    shouldBe('style.getPropertyValue("bottom")', vmin(10));
+    shouldBe('style.getPropertyValue("left")', vmin(10));
+    shouldBe('style.getPropertyValue("right")', vmin(10));
+    shouldBe('style.getPropertyValue("padding-left")', vmin(2));
+    shouldBe('style.getPropertyValue("padding-right")', vmin(2));
+    shouldBe('style.getPropertyValue("padding-top")', vmin(2));
+    shouldBe('style.getPropertyValue("padding-bottom")', vmin(2));
 
     debug("\nTest for vmax")
     element.id = "element-container-vmax";
     style = window.getComputedStyle(element,null);
     var viewportMaxLength = Math.max(window.innerWidth, window.innerHeight);
-    shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("text-indent")', "'2vmax'");
-    shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("min-height")', "'10vmax'");
-    shouldBe('style.getPropertyValue("min-width")', "'10vmax'");
-    shouldBe('style.getPropertyValue("max-height")', "'60vmax'");
-    shouldBe('style.getPropertyValue("max-width")', "'60vmax'");
+    shouldBe('style.getPropertyValue("height")', vmax(30));
+    shouldBe('style.getPropertyValue("width")', vmax(30));
+    shouldBe('style.getPropertyValue("font-size")', vmax(3));
+    shouldBe('style.getPropertyValue("line-height")', vmax(4));
+    shouldBe('style.getPropertyValue("text-indent")', vmax(2));
+    shouldBe('style.getPropertyValue("margin-left")', vmax(2));
+    shouldBe('style.getPropertyValue("margin-right")', vmax(2));
+    shouldBe('style.getPropertyValue("margin-top")', vmax(2));
+    shouldBe('style.getPropertyValue("margin-bottom")', vmax(2));
+    shouldBe('style.getPropertyValue("border-top-left-radius")', vmax(1));
+    shouldBe('style.getPropertyValue("border-top-right-radius")', vmax(1));
+    shouldBe('style.getPropertyValue("border-bottom-left-radius")', vmax(1));
+    shouldBe('style.getPropertyValue("border-bottom-right-radius")', vmax(1));
+    shouldBe('style.getPropertyValue("min-height")', vmax(10));
+    shouldBe('style.getPropertyValue("min-width")', vmax(10));
+    shouldBe('style.getPropertyValue("max-height")', vmax(60));
+    shouldBe('style.getPropertyValue("max-width")', vmax(60));
     element.id = "element-container-absolute-vmax";
-    shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
-    shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
+    shouldBe('style.getPropertyValue("top")', vmax(10));
+    shouldBe('style.getPropertyValue("bottom")', vmax(10));
+    shouldBe('style.getPropertyValue("left")', vmax(10));
+    shouldBe('style.getPropertyValue("right")', vmax(10));
+    shouldBe('style.getPropertyValue("padding-left")', vmax(2));
+    shouldBe('style.getPropertyValue("padding-right")', vmax(2));
+    shouldBe('style.getPropertyValue("padding-top")', vmax(2));
+    shouldBe('style.getPropertyValue("padding-bottom")', vmax(2));
 }
 getTheStyle();
 </script>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/resources/resize-test.js b/LayoutTests/css3/viewport-percentage-lengths/resources/resize-test.js
new file mode 100644 (file)
index 0000000..349fb77
--- /dev/null
@@ -0,0 +1,27 @@
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function resizeTest(sizes, testfn) {
+    if (!sizes.length) {
+        if (window.testRunner)
+            testRunner.notifyDone();
+        return;
+    }
+
+    var size = sizes.shift();
+    var width = size[0];
+    var height = size[1];
+    window.resizeTo(width, height);
+    window.setTimeout(function () {
+        shouldBe("window.outerWidth", "" + width);
+        shouldBe("window.outerHeight", "" + height);
+        testfn(size);
+        resizeTest(sizes, testfn);
+    }, 0);
+}
+
+function standardResizeTest(testfn) {
+    resizeTest([[800, 600], [900, 600], [900, 640], [500, 640], [800, 600]], testfn);
+}
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block-expected.txt b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block-expected.txt
new file mode 100644 (file)
index 0000000..630c1e1
--- /dev/null
@@ -0,0 +1,46 @@
+Test viewport unit sizes work when an anonymous block is involved.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS window.outerWidth is 800
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(random).width is '200px'
+PASS window.innerWidth/2 is >= document.getElementById('firstContent').offsetWidth
+PASS window.innerWidth/2 is >= document.getElementById('secondContent').offsetWidth
+PASS window.outerWidth is 900
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(random).width is '200px'
+PASS window.innerWidth/2 is >= document.getElementById('firstContent').offsetWidth
+PASS window.innerWidth/2 is >= document.getElementById('secondContent').offsetWidth
+PASS window.outerWidth is 900
+PASS window.outerHeight is 640
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(random).width is '200px'
+PASS window.innerWidth/2 is >= document.getElementById('firstContent').offsetWidth
+PASS window.innerWidth/2 is >= document.getElementById('secondContent').offsetWidth
+PASS window.outerWidth is 500
+PASS window.outerHeight is 640
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(random).width is '200px'
+PASS window.innerWidth/2 is >= document.getElementById('firstContent').offsetWidth
+PASS window.innerWidth/2 is >= document.getElementById('secondContent').offsetWidth
+PASS window.outerWidth is 800
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(random).width is '200px'
+PASS window.innerWidth/2 is >= document.getElementById('firstContent').offsetWidth
+PASS window.innerWidth/2 is >= document.getElementById('secondContent').offsetWidth
+This is enough text content that it will wrap around in this container. We need lots of it to account for variances in font sizes.
+This is some content in an inner div.
+And here is some more content that will also wrap around in this container. We need lots of it to account for variances in font sizes.
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html
new file mode 100644 (file)
index 0000000..b2171c6
--- /dev/null
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<style>
+    #container {
+        width: 50vw;
+        height: 50vh;
+        border: 1px solid black;
+    }
+    #random {
+        width: 50%;
+        background-color: orange;
+    }
+</style>
+<body>
+    <div id="container">
+        <span id="firstContent">This is enough text content that it will wrap around in this container. We need lots of it to account for variances in font sizes.</span>
+        <div id="random">
+            This is some content in an inner div.
+        </div>
+        <span id="secondContent">And here is some more content that will also wrap around in this container. We need lots of it to account for variances in font sizes.</span>
+    </div>
+</body>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+description("Test viewport unit sizes work when an anonymous block is involved.");
+
+function resizeTest(sizes) {
+    if (!sizes.length) {
+        testRunner.notifyDone();
+        return;
+    }
+
+    var size = sizes.shift();
+    var width = size[0];
+    var height = size[1];
+    window.resizeTo(width, height);
+    window.setTimeout(function () {
+        var min = Math.min(window.innerWidth, window.innerHeight);
+        var max = Math.max(window.innerWidth, window.innerHeight);
+        shouldBe("window.outerWidth", "" + width);
+        shouldBe("window.outerHeight", "" + height);
+        shouldBe("getComputedStyle(container).width", "'" + window.innerWidth/2 + "px'");
+        shouldBe("getComputedStyle(container).height", "'" + window.innerHeight/2 + "px'");
+        shouldBe("getComputedStyle(random).width", "'" + window.innerWidth/4 + "px'");
+        shouldBeGreaterThanOrEqual("window.innerWidth/2", "document.getElementById('firstContent').offsetWidth");
+        shouldBeGreaterThanOrEqual("window.innerWidth/2", "document.getElementById('secondContent').offsetWidth");
+        resizeTest(sizes);
+    }, 0);
+}
+
+resizeTest([[800, 600], [900, 600], [900, 640], [500, 640], [800, 600]]);
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-calc-expected.txt b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-calc-expected.txt
new file mode 100644 (file)
index 0000000..729c876
--- /dev/null
@@ -0,0 +1,15 @@
+Test for calc support with viewport units.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS style.getPropertyValue("width") is '400px'
+PASS style.getPropertyValue("height") is '450px'
+PASS style.getPropertyValue("margin-top") is '160px'
+PASS style.getPropertyValue("margin-bottom") is '190px'
+PASS style.getPropertyValue("margin-left") is '400px'
+PASS style.getPropertyValue("margin-right") is '200px'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html
new file mode 100644 (file)
index 0000000..2c26e9f
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<style>
+    body {
+        width: 100vw;
+        height: 100vh;
+    }
+    #target {
+        width: calc(100vw - 50vw);
+        height: calc(25vh + 50vh);
+        margin-top: calc(25vh + 10px);
+        margin-bottom: calc(25vw - 10px);
+        margin-left: calc(25vw + 25%);
+        margin-right: calc(50vw - 25%);
+    }
+</style>
+<html>
+    <div id="target"></div>
+</html>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+function vw(x) {
+    return x * window.innerWidth / 100;
+}
+
+function vh(x) {
+    return x * window.innerHeight / 100;
+}
+
+function px(n) {
+    return "'" + n + "px'";
+}
+
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+description("Test for calc support with viewport units.");
+
+target = document.getElementById("target");
+style = window.getComputedStyle(target,null);
+shouldBe('style.getPropertyValue("width")', px(vw(100) - vw(50)));
+shouldBe('style.getPropertyValue("height")', px(vh(25) + vh(50)));
+shouldBe('style.getPropertyValue("margin-top")', px(vh(25) + 10));
+shouldBe('style.getPropertyValue("margin-bottom")', px(vw(25) - 10));
+shouldBe('style.getPropertyValue("margin-left")', px(vw(25) + vw(25)));
+shouldBe('style.getPropertyValue("margin-right")', px(vw(50) - vw(25)));
+</script>
+<script src="../../resources/js-test-post.js"></script>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child-expected.txt b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child-expected.txt
new file mode 100644 (file)
index 0000000..e318bd9
--- /dev/null
@@ -0,0 +1,39 @@
+Test that percentage dimensions work in a child with a parent with viewport unit dimensions.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS window.outerWidth is 800
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(percent).width is '200px'
+PASS getComputedStyle(percent).height is '150px'
+PASS window.outerWidth is 900
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(percent).width is '200px'
+PASS getComputedStyle(percent).height is '150px'
+PASS window.outerWidth is 900
+PASS window.outerHeight is 640
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(percent).width is '200px'
+PASS getComputedStyle(percent).height is '150px'
+PASS window.outerWidth is 500
+PASS window.outerHeight is 640
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(percent).width is '200px'
+PASS getComputedStyle(percent).height is '150px'
+PASS window.outerWidth is 800
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).width is '400px'
+PASS getComputedStyle(container).height is '300px'
+PASS getComputedStyle(percent).width is '200px'
+PASS getComputedStyle(percent).height is '150px'
+
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html
new file mode 100644 (file)
index 0000000..8e6cd85
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<style>
+    #container {
+        width: 50vw;
+        height: 50vh;
+    }
+    #percent {
+        width: 50%;
+        height: 50%;
+    }
+</style>
+<body>
+    <div id="container">
+        <div id="percent"></div>
+    </div>
+</body>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="resources/resize-test.js"></script>
+<script>
+description("Test that percentage dimensions work in a child with a parent with viewport unit dimensions.");
+
+standardResizeTest(function (sizes) {
+    shouldBe("getComputedStyle(container).width", "'" + window.innerWidth/2 + "px'");
+    shouldBe("getComputedStyle(container).height", "'" + window.innerHeight/2 + "px'");
+    shouldBe("getComputedStyle(percent).width", "'" + window.innerWidth/4 + "px'");
+    shouldBe("getComputedStyle(percent).height", "'" + window.innerHeight/4 + "px'");
+});
+</script>
+<script src="../../resources/js-test-post.js"></script>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt
new file mode 100644 (file)
index 0000000..5354e8f
--- /dev/null
@@ -0,0 +1,34 @@
+Test that relative font sizes work when the parent is in viewport units.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS window.outerWidth is 800
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).fontSize is '40px'
+PASS getComputedStyle(ems).fontSize is '160px'
+PASS getComputedStyle(percent).fontSize is '20px'
+PASS window.outerWidth is 900
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).fontSize is '40px'
+PASS getComputedStyle(ems).fontSize is '160px'
+PASS getComputedStyle(percent).fontSize is '20px'
+PASS window.outerWidth is 900
+PASS window.outerHeight is 640
+PASS getComputedStyle(container).fontSize is '40px'
+PASS getComputedStyle(ems).fontSize is '160px'
+PASS getComputedStyle(percent).fontSize is '20px'
+PASS window.outerWidth is 500
+PASS window.outerHeight is 640
+PASS getComputedStyle(container).fontSize is '40px'
+PASS getComputedStyle(ems).fontSize is '160px'
+PASS getComputedStyle(percent).fontSize is '20px'
+PASS window.outerWidth is 800
+PASS window.outerHeight is 600
+PASS getComputedStyle(container).fontSize is '40px'
+PASS getComputedStyle(ems).fontSize is '160px'
+PASS getComputedStyle(percent).fontSize is '20px'
+
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html
new file mode 100644 (file)
index 0000000..984b66c
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<style>
+    #container {
+        font-size: 5vw;
+    }
+    #ems {
+        font-size: 4em;
+    }
+    #percent {
+        font-size: 50%;
+    }
+</style>
+<body>
+    <div id="container">
+        <div id="ems"></div>
+        <div id="percent"></div>
+    </div>
+</body>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="resources/resize-test.js"></script>
+<script>
+description("Test that relative font sizes work when the parent is in viewport units.");
+
+standardResizeTest(function (size) {
+        shouldBe("getComputedStyle(container).fontSize", "'" + Math.round(window.innerWidth/20) + "px'");
+        shouldBe("getComputedStyle(ems).fontSize", "'" + Math.round(window.innerWidth/5) + "px'");
+        shouldBe("getComputedStyle(percent).fontSize", "'" + Math.round(window.innerWidth/40) + "px'");
+});
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt
new file mode 100644 (file)
index 0000000..0dad02c
--- /dev/null
@@ -0,0 +1,39 @@
+Test that viewport lengths and font sizes properly resize with the viewport.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS window.outerWidth is 800
+PASS window.outerHeight is 600
+PASS getComputedStyle(test).fontSize is '30px'
+PASS getComputedStyle(test).width is '400px'
+PASS getComputedStyle(testpseudo, ':after').marginLeft is '120px'
+PASS getComputedStyle(testpseudo, ':after').paddingRight is '200px'
+PASS window.outerWidth is 900
+PASS window.outerHeight is 600
+PASS getComputedStyle(test).fontSize is '30px'
+PASS getComputedStyle(test).width is '400px'
+PASS getComputedStyle(testpseudo, ':after').marginLeft is '120px'
+PASS getComputedStyle(testpseudo, ':after').paddingRight is '200px'
+PASS window.outerWidth is 900
+PASS window.outerHeight is 640
+PASS getComputedStyle(test).fontSize is '30px'
+PASS getComputedStyle(test).width is '400px'
+PASS getComputedStyle(testpseudo, ':after').marginLeft is '120px'
+PASS getComputedStyle(testpseudo, ':after').paddingRight is '200px'
+PASS window.outerWidth is 500
+PASS window.outerHeight is 640
+PASS getComputedStyle(test).fontSize is '30px'
+PASS getComputedStyle(test).width is '400px'
+PASS getComputedStyle(testpseudo, ':after').marginLeft is '120px'
+PASS getComputedStyle(testpseudo, ':after').paddingRight is '200px'
+PASS window.outerWidth is 800
+PASS window.outerHeight is 600
+PASS getComputedStyle(test).fontSize is '30px'
+PASS getComputedStyle(test).width is '400px'
+PASS getComputedStyle(testpseudo, ':after').marginLeft is '120px'
+PASS getComputedStyle(testpseudo, ':after').paddingRight is '200px'
+
diff --git a/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html b/LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html
new file mode 100644 (file)
index 0000000..b5810df
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<style>
+#test {
+    font-size: 5vh;
+    width: 50vw;
+}
+#testpseudo:after {
+    margin-left: 20vmin;
+    padding-right: 25vmax;
+    content: '';
+}
+</style>
+<body>
+    <div id="test"></div>
+    <div id="testpseudo"></div>
+</body>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="resources/resize-test.js"></script>
+<script>
+description("Test that viewport lengths and font sizes properly resize with the viewport.");
+standardResizeTest(function (size) {
+        var min = Math.min(window.innerWidth, window.innerHeight);
+        var max = Math.max(window.innerWidth, window.innerHeight);
+        shouldBe("getComputedStyle(test).fontSize", "'" + window.innerHeight/20 + "px'");
+        shouldBe("getComputedStyle(test).width", "'" + window.innerWidth/2 + "px'");
+        shouldBe("getComputedStyle(testpseudo, ':after').marginLeft", "'" + min/5 + "px'");
+        shouldBe("getComputedStyle(testpseudo, ':after').paddingRight", "'" + max/4 + "px'");
+});
+</script>
+<script src="../../resources/js-test-post.js"></script>
diff --git a/LayoutTests/fast/canvas/draw-focus-if-needed-expected.txt b/LayoutTests/fast/canvas/draw-focus-if-needed-expected.txt
deleted file mode 100644 (file)
index 163e9f9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-This test ensures that a focus ring is drawn. 
-TEST PASSED
diff --git a/LayoutTests/fast/canvas/draw-focus-if-needed.html b/LayoutTests/fast/canvas/draw-focus-if-needed.html
deleted file mode 100644 (file)
index f9dc01f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-This test ensures that a focus ring is drawn.
-<canvas id="canvas" class="output" width="30" height="30">
-    <button id="button1"></button>
-</canvas>
-<div id="console"></div>
-<script>
-if (window.testRunner)
-    testRunner.dumpAsText();
-
-var button1 = document.getElementById("button1");
-var canvas = document.getElementById("canvas").getContext("2d");
-canvas.beginPath();
-canvas.rect(10, 10, 10, 10);
-canvas.drawFocusIfNeeded(button1);
-var imagedata = canvas.getImageData(0, 0, 30, 30);
-var total = 0;
-for(var x = 0; x < 30 * 30 * 4; x++)
-    total += imagedata.data[x];
-
-if (total != 0)
-    document.getElementById("console").innerHTML = "TEST PASSED";
-else
-{
-    button1.focus();
-    canvas.drawFocusIfNeeded(button1);
-    imagedata = canvas.getImageData(0, 0, 30, 30);
-    for(var x = 0; x < 30 * 30* 4; x++)
-        total += imagedata.data[x];
-
-    if (total != 0)
-        document.getElementById("console").innerHTML = "TEST PASSED";
-    else
-        document.getElementById("console").innerHTML = "TEST FAILED";
-}
-</script>
index 6773ad2..719ff45 100644 (file)
@@ -17,9 +17,9 @@ PASS computedStyle("-webkit-clip-path", "circle(1.5rem at .5rem 1rem)") is "circ
 PASS innerStyle("-webkit-clip-path", "circle(1vw at 1vw 1vw)") is "circle(1vw at 1vw 1vw)"
 PASS innerStyle("-webkit-clip-path", "circle(1vh at 1vh 1vh)") is "circle(1vh at 1vh 1vh)"
 PASS innerStyle("-webkit-clip-path", "circle(1vmin at 1vmin 1vmin)") is "circle(1vmin at 1vmin 1vmin)"
-PASS computedStyle("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)") is "circle(1.5vw at 0.5vw 1vw)"
-PASS computedStyle("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)") is "circle(1.5vh at 0.5vh 1vh)"
-PASS computedStyle("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)") is "circle(1.5vmin at 0.5vmin 1vmin)"
+PASS computedStyle("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)") is "circle(12px at 4px 8px)"
+PASS computedStyle("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)") is "circle(9px at 3px 6px)"
+PASS computedStyle("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)") is "circle(9px at 3px 6px)"
 PASS computedStyle("-webkit-clip-path", "circle(150% at 50% 100%)") is "circle(150% at 50% 100%)"
 PASS computedStyle("-webkit-clip-path", "inset(45% 45% 90% 60% round 25% 10%)") is "inset(45% 45% 90% 60% round 25% 10%)"
 PASS computedStyle("-webkit-clip-path", "ellipse(100% 100% at 100% 100%)") is "ellipse(100% 100% at 100% 100%)"
index 23a39f7..5c4fc7b 100644 (file)
@@ -63,9 +63,9 @@ testInner("-webkit-clip-path", "circle(1vw at 1vw 1vw)", "circle(1vw at 1vw 1vw)
 testInner("-webkit-clip-path", "circle(1vh at 1vh 1vh)", "circle(1vh at 1vh 1vh)");
 testInner("-webkit-clip-path", "circle(1vmin at 1vmin 1vmin)", "circle(1vmin at 1vmin 1vmin)");
 
-testComputed("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)", "circle(1.5vw at 0.5vw 1vw)");
-testComputed("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)", "circle(1.5vh at 0.5vh 1vh)");
-testComputed("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)", "circle(1.5vmin at 0.5vmin 1vmin)");
+testComputed("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)", "circle(12px at 4px 8px)");
+testComputed("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)", "circle(9px at 3px 6px)");
+testComputed("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)", "circle(9px at 3px 6px)");
 
 // percentage lengths - units
 testComputed("-webkit-clip-path", "circle(150% at 50% 100%)", "circle(150% at 50% 100%)");
index 0093eda..22be38f 100644 (file)
@@ -22,9 +22,9 @@ PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5rem at .5rem 1rem
 PASS getStyleValue("-webkit-shape-outside", "circle(1vw at 1vw 1vw)") is "circle(1vw at 1vw 1vw)"
 PASS getStyleValue("-webkit-shape-outside", "circle(1vh at 1vh 1vh)") is "circle(1vh at 1vh 1vh)"
 PASS getStyleValue("-webkit-shape-outside", "circle(1vmin at 1vmin 1vmin)") is "circle(1vmin at 1vmin 1vmin)"
-PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vw at .5vw 1vw)") is "circle(1.5vw at 0.5vw 1vw)"
-PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vh at .5vh 1vh)") is "circle(1.5vh at 0.5vh 1vh)"
-PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vmin at .5vmin 1vmin)") is "circle(1.5vmin at 0.5vmin 1vmin)"
+PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vw at .5vw 1vw)") is "circle(12px at 4px 8px)"
+PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vh at .5vh 1vh)") is "circle(9px at 3px 6px)"
+PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vmin at .5vmin 1vmin)") is "circle(9px at 3px 6px)"
 PASS getStyleValue("-webkit-shape-outside", "circle(100% at 100% 100%)") is "circle(100% at 100% 100%)"
 PASS getStyleValue("-webkit-shape-outside", "inset(45% 45% 90% 60% round 25% 10%)") is "inset(45% 45% 90% 60% round 25% 10%)"
 PASS getStyleValue("-webkit-shape-outside", "ellipse(100% 100% at 100% 100%)") is "ellipse(100% 100% at 100% 100%)"
index 482d73d..f7f69fa 100644 (file)
@@ -64,9 +64,9 @@ testStyleValue("circle(1vw at 1vw 1vw)", "circle(1vw at 1vw 1vw)");
 testStyleValue("circle(1vh at 1vh 1vh)", "circle(1vh at 1vh 1vh)");
 testStyleValue("circle(1vmin at 1vmin 1vmin)", "circle(1vmin at 1vmin 1vmin)");
 
-testComputedStyleValue("circle(1.5vw at .5vw 1vw)", "circle(1.5vw at 0.5vw 1vw)");
-testComputedStyleValue("circle(1.5vh at .5vh 1vh)", "circle(1.5vh at 0.5vh 1vh)");
-testComputedStyleValue("circle(1.5vmin at .5vmin 1vmin)", "circle(1.5vmin at 0.5vmin 1vmin)");
+testComputedStyleValue("circle(1.5vw at .5vw 1vw)", "circle(12px at 4px 8px)");
+testComputedStyleValue("circle(1.5vh at .5vh 1vh)", "circle(9px at 3px 6px)");
+testComputedStyleValue("circle(1.5vmin at .5vmin 1vmin)", "circle(9px at 3px 6px)");
 
 // percentage lengths - units
 testStyleValue("circle(100% at 100% 100%)", "circle(100% at 100% 100%)");
index 7136dd8..3aad573 100644 (file)
@@ -1,3 +1,289 @@
+2014-05-27  Bem Jones-Bey  <bjonesbe@adobe.com>
+
+        vw/vh units used as font/line-height values don't scale with the viewport
+        https://bugs.webkit.org/show_bug.cgi?id=87846
+
+        Reviewed by Darin Adler.
+
+        This patch moves the resolution of viewport units to style recalc
+        time. Currently viewport units are left unresolved during style
+        recalcs, which leads to many problems with viewport units. Moving the
+        resolution will fix these problems, as well as reduce the plumbing
+        that goes on.
+
+        This patch touches a lot of files since the valueForLength functions
+        no longer need a RenderView. The interesting changes are in:
+
+        - CSSToLengthConversionData -> CSSPrimitiveValue: for moving
+            resolution to style recalc time.
+        - Length / LengthFunctions: no longer needs to know about viewport
+            units.
+        - FrameView -> Document -> StyleResolver: for scheduling style recalcs
+            upon resize
+
+        Note that getComputedStyle will now return pixel values when viewport
+        units are used. This behavior matches Firefox and the css3-cascade
+        spec.
+
+        This is based on a Blink patch by timloh@chromium.org.
+
+        Tests: css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html
+               css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html
+               css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html
+               css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html
+               css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html
+
+        * WebCore.exp.in: Remove RenderView argument to floatValueForLength.
+        * accessibility/atk/WebKitAccessibleInterfaceText.cpp: 
+        (getAttributeSetForAccessibilityObject): Remove RenderView argument.
+        * css/BasicShapeFunctions.cpp:
+        (WebCore::convertToLength): Ditto.
+        (WebCore::floatValueForCenterCoordinate): Ditto.
+        * css/BasicShapeFunctions.h: Ditto.
+        * css/CSSCalculationValue.cpp:
+        (WebCore::unitCategory): Remove special handling for viewport units,
+            as they get resolved to pixels.
+        (WebCore::createCSS): Ditto.
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::positionOffsetValue): Remove RendewView argument.
+        (WebCore::getBorderRadiusCornerValues): Remove handling of viewport
+            units, as they are already resolve to pixels here.
+        (WebCore::getBorderRadiusCornerValue): Remove RenderView argument.
+        (WebCore::getBorderRadiusShorthandValue): Ditto.
+        (WebCore::specifiedValueForGridTrackBreadth): Remove handling of
+            viewport units, as they are already resolved to pixels here.
+        (WebCore::specifiedValueForGridTrackSize): Remove RenderView argument.
+        (WebCore::valueForGridTrackList): Ditto.
+        (WebCore::lineHeightFromStyle): Ditto.
+        (WebCore::ComputedStyleExtractor::propertyValue): Ditto.
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSLinearGradientValue::createGradient): Pass RenderView to
+            CSSToLengthConversionData constructor.
+        (WebCore::CSSRadialGradientValue::createGradient): Ditto.
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::unitCategory): Remove handling of
+            viewport units, as they get resolved to pixels.
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Ditto.
+        (WebCore::CSSPrimitiveValue::init): Ditto.
+        (WebCore::CSSPrimitiveValue::computeLengthDouble): Resolve viewport
+            units to pixels.
+        (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory): Remove
+        handling of viewport units, since they get resolved to pixels.
+        (WebCore::CSSPrimitiveValue::viewportPercentageLength): Deleted.
+        * css/CSSPrimitiveValue.h:
+        (WebCore::CSSPrimitiveValue::isLength): Remove special handling of
+            viewport units, since they get resolved to pixels.
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::convertToLength): Ditto.
+        * css/CSSToLengthConversionData.cpp:
+        (WebCore::CSSToLengthConversionData::viewportWidthFactor): Caclulate
+            conversion factor for viewport units to pixels. Note this does not
+            set hasViewportUnits on the RenderStyle if computing the font
+            size, because in the font size case, the RenderStyle is the
+            parent's style, not the current renderer's style.
+        (WebCore::CSSToLengthConversionData::viewportHeightFactor): Ditto.
+        (WebCore::CSSToLengthConversionData::viewportMinFactor): Ditto.
+        (WebCore::CSSToLengthConversionData::viewportMaxFactor): Ditto.
+        * css/CSSToLengthConversionData.h:
+        (WebCore::CSSToLengthConversionData::CSSToLengthConversionData): Add
+            RenderView parameter, and make RenderStyle non-const so that
+            hasViewportUnits can be set on the Style..
+        (WebCore::CSSToLengthConversionData::style): style is now non-const.
+        (WebCore::CSSToLengthConversionData::copyWithAdjustedZoom): Handle
+            RenderView argument.
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::mapFillXPosition): Remove handling of
+            viewport units, as they are already resolved to pixels here.
+        (WebCore::CSSToStyleMap::mapFillYPosition): Ditto.
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::ApplyPropertyLength::applyValue): Ditto.
+        (WebCore::ApplyPropertyBorderRadius::applyValue): Ditto.
+        (WebCore::ApplyPropertyComputeLength::applyValue): Ditto.
+        (WebCore::ApplyPropertyFontSize::applyValue): Ditto.
+        (WebCore::ApplyPropertyLineHeight::applyValue): Ditto.
+        (WebCore::ApplyPropertyLineHeightForIOSTextAutosizing::applyValue): Ditto.
+        (WebCore::ApplyPropertyWordSpacing::applyValue): Ditto.
+        (WebCore::ApplyPropertyVerticalAlign::applyValue): Ditto.
+        (WebCore::ApplyPropertyTextIndent::applyValue): Ditto.
+        * css/LengthFunctions.cpp:
+        (WebCore::minimumIntValueForLength): Remove RenderView argument.
+        (WebCore::intValueForLength): Remove RenderView argument and
+            roundPecentages.
+        (WebCore::minimumValueForLength): Remove RenderView argument, and
+            special handling of viewport units.
+        (WebCore::valueForLength): Ditto.
+        (WebCore::floatValueForLength): Ditto.
+        (WebCore::floatSizeForLengthSize): Remove RenderView argument.
+        * css/LengthFunctions.h: Ditto.
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::MediaQueryEvaluator::eval): Add RenderView argument for
+            CSSToLengthConversionData constuctor.
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::clear): Change to 0 arg constructor
+            for CSSToLengthConversionData.
+        (WebCore::StyleResolver::State::updateConversionData): In order to get
+            the RenderView, we need to have a valid Element set on the state.
+            Since this means that we need to set the conversion data in more
+            places, move the contruction of conversion data into this helper
+            method.
+        (WebCore::StyleResolver::State::initElement): Make sure conversion
+            data is up to date.
+        (WebCore::StyleResolver::State::initForStyleResolve): Ditto.
+        (WebCore::StyleResolver::State::setStyle): When the style is set, we
+            need to make sure to update the conversion data.
+        (WebCore::StyleResolver::styleForElement): If the style has viewport
+            units, flage the document so that we can make sure to recalc the
+            viewport unit values when the viewport is resized.
+        (WebCore::StyleResolver::pseudoStyleForElement): Ditto.
+        (WebCore::StyleResolver::updateFont): Make sure the font having
+            viewport units updates the style.
+        (WebCore::StyleResolver::convertToIntLength): Remove handling of
+        viewport units, as they are resolved to pixels.
+        (WebCore::StyleResolver::convertToFloatLength): Ditto.
+        (WebCore::StyleResolver::clearCachedPropertiesAffectedByViewportUnits):
+            Invalidate the matched properties cache for styles with viewport
+            units when the viewport is resized.
+        (WebCore::createGridTrackBreadth): Remove handling of viewport units,
+            as they are resolved to pixels.
+        (WebCore::StyleResolver::applyProperty): Ditto.
+        (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange):
+            Rename to be less confusing, since it has nothing to do with
+            viewport units.
+        (WebCore::StyleResolver::createFilterOperations): Remove handling of
+            viewport units, as they are resolved to pixels.
+        (WebCore::StyleResolver::affectedByViewportChange): Deleted.
+        (WebCore::StyleResolver::viewportPercentageValue): Deleted.
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::State::State): C++11 cleanup: 0 -> nullptr.
+        (WebCore::StyleResolver::State::setFontSizeHasViewportUnits): Set if
+            the font size is specified in viewport units.
+        (WebCore::StyleResolver::State::fontSizeHasViewportUnits): Ditto.
+        (WebCore::StyleResolver::State::setStyle): Deleted.
+        * css/TransformFunctions.cpp:
+        (WebCore::convertToFloatLength): Remove handling of viewport units,
+            since they are resolved to pixels.
+        * dom/Document.cpp:
+        (WebCore::Document::Document): Add flag to determine if some style in
+            the document has viewport units.
+        (WebCore::Document::pageSizeAndMarginsInPixels): Remove RenderView
+            argument.
+        (WebCore::Document::updateViewportUnitsOnResize): Mark elements with
+            viewport units for style recalc when the viewport size has
+            changed.
+        * dom/Document.h:
+        (WebCore::Document::setHasStyleWithViewportUnits): Flag to determine
+            if some style in the document has viewport units.
+        (WebCore::Document::hasStyleWithViewportUnits): Ditto.
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::getRegion): Remove RenderView argument.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout): When the viewport is resized, call
+            updateViewportUnitsOnResize on the document.
+        * platform/Length.h:
+        (WebCore::Length::isSpecified): Remove handling of viewport units,
+            since they are now resolved to pixels.
+        (WebCore::Length::viewportPercentageLength): Deleted.
+        (WebCore::Length::isViewportPercentage): Deleted.
+        * rendering/ClipPathOperation.h:
+        (WebCore::ShapeClipPathOperation::pathForReferenceRect): Remove
+            RenderView argument.
+        (WebCore::BoxClipPathOperation::pathForReferenceRect): Ditto.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::updateBlockChildDirtyBitsBeforeLayout): Remove
+            handling of viewport units, since they get updated by
+            updateViewportUnitsOnResize when the viewport is resized.
+        (WebCore::RenderBlock::nodeAtPoint): Remove RenderView argument.
+        (WebCore::RenderBlock::lineHeight): Ditto.
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintBoxDecorations): Remove RenderView argument.
+        (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
+            Remove handling of viewport units, as they are resolved to pixels.
+        (WebCore::RenderBox::computePercentageLogicalHeight): Ditto.
+        (WebCore::RenderBox::computeReplacedLogicalWidthUsing): Ditto.
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing): Ditto.
+        (WebCore::RenderBox::hasViewportPercentageLogicalHeight): Deleted.
+        * rendering/RenderBox.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::getBackgroundRoundedRect): Remove
+            RenderView argument.
+        (WebCore::RenderBoxModelObject::calculateFillTileSize): Remove
+            handling of viewport units, as they are resolved to pixels.
+        (WebCore::computeBorderImageSide): Remove RenderView argument.
+        (WebCore::RenderBoxModelObject::paintNinePieceImage): Ditto.
+        (WebCore::RenderBoxModelObject::paintBorder): Ditto.
+        (WebCore::RenderBoxModelObject::paintBoxShadow): Ditto.
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::repaintAfterLayoutIfNeeded): Ditto.
+        * rendering/RenderElement.h:
+        (WebCore::RenderElement::valueForLength): Remove unused
+            roundPercentages argument.
+        (WebCore::RenderElement::minimumValueForLength): Remove unused
+            RoundPercentages and RenderView arguments.
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::layoutGridItems): Remove handling of viewport
+            units as they are resolved to pixels.
+        * rendering/RenderInline.cpp:
+        (WebCore::computeMargin): Ditto.
+        (WebCore::RenderInline::lineHeight): Remove RenderView argument.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::setupClipPath): Ditto.
+        * rendering/RenderLineBreak.cpp:
+        (WebCore::RenderLineBreak::lineHeight): Ditto.
+        * rendering/RenderScrollbarPart.cpp:
+        (WebCore::calcScrollbarThicknessUsing): Ditto.
+        (WebCore::RenderScrollbarPart::computeScrollbarWidth): Ditto.
+        (WebCore::RenderScrollbarPart::computeScrollbarHeight): Ditto.
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
+            Remove handling of viewport units, since they are resolved to
+            pixels.
+        (WebCore::RenderTable::computePreferredLogicalWidths): Now that
+            viewport unit values are resolved to pixels at style recalc time,
+            no special checking is needed to handle them, so update the
+            comment to reflect that.
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::applyCommonButtonPaddingToStyle): Add RenderView argument to
+            CSSToLengthConversionData constructor.
+        (WebCore::RenderThemeIOS::adjustButtonStyle): Ditto.
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintMenuListButtonGradients): Remove
+            RenderView argument.
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::layout): Remove handling of viewport units,
+            since they are resolved to pixels.
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::ascentAndDescentForBox): Remove RenderView
+            argument.
+        * rendering/shapes/Shape.cpp:
+        (WebCore::Shape::createShape): Remove RenderView argument.
+        * rendering/shapes/Shape.h:
+        * rendering/shapes/ShapeOutsideInfo.cpp:
+        (WebCore::ShapeOutsideInfo::computedShape): Ditto.
+        * rendering/style/BasicShapes.cpp:
+        (WebCore::BasicShapeCircle::floatValueForRadiusInBox): Ditto.
+        (WebCore::BasicShapeCircle::path): Ditto.
+        (WebCore::BasicShapeEllipse::floatValueForRadiusInBox): Ditto.
+        (WebCore::BasicShapeEllipse::path): Ditto.
+        (WebCore::BasicShapePolygon::path): Ditto.
+        (WebCore::floatSizeForLengthSize): Ditto.
+        (WebCore::BasicShapeInset::path): Ditto.
+        * rendering/style/BasicShapes.h:
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::calcRadiiFor): Ditto.
+        (WebCore::RenderStyle::getRoundedBorderFor): Ditto.
+        (WebCore::RenderStyle::computedLineHeight): Remove handling of
+            viewport units since they are resolved to pixels.
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setHasViewportUnits): Set if this style has
+        a property set with viewport units.
+        (WebCore::RenderStyle::hasViewportUnits): Ditto.
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::resolveLengthAttributeForSVG): Remove RenderView argument.
+        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth): Ditto.
+        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): Ditto.
+        * rendering/svg/SVGRenderingContext.cpp:
+        (WebCore::SVGRenderingContext::prepareToRenderSVGContent): Ditto.
+
 2014-05-27  Zoltan Horvath  <zoltan@webkit.org>
 
         [CSS Shapes] serialization of the computed value should omit the default radii
index f4bfe2b..b511322 100644 (file)
@@ -824,7 +824,7 @@ __ZN7WebCore19TextResourceDecoder6decodeEPKcm
 __ZN7WebCore19TextResourceDecoderC1ERKN3WTF6StringERKNS_12TextEncodingEb
 __ZN7WebCore19TextResourceDecoderD1Ev
 __ZN7WebCore19enclosingLayoutRectERKNS_9FloatRectE
-__ZN7WebCore19floatValueForLengthERKNS_6LengthEfPNS_10RenderViewE
+__ZN7WebCore19floatValueForLengthERKNS_6LengthEf
 __ZN7WebCore19getFileCreationTimeERKN3WTF6StringERl
 __ZN7WebCore19toInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE
 __ZN7WebCore20ApplicationCacheHost17maybeLoadResourceEPNS_14ResourceLoaderERKNS_15ResourceRequestERKNS_3URLE
index 2b9b550..249bae6 100644 (file)
@@ -125,7 +125,7 @@ static AtkAttributeSet* getAttributeSetForAccessibilityObject(const Accessibilit
     }
 
     if (!style->textIndent().isUndefined()) {
-        int indentation = valueForLength(style->textIndent(), object->size().width(), &renderer->view());
+        int indentation = valueForLength(style->textIndent(), object->size().width());
         buffer.reset(g_strdup_printf("%i", indentation));
         result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
     }
index bef0a46..0606631 100644 (file)
@@ -36,7 +36,6 @@
 #include "CSSValuePool.h"
 #include "Pair.h"
 #include "RenderStyle.h"
-#include "RenderView.h"
 
 namespace WebCore {
 
@@ -130,7 +129,7 @@ PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle* style, const BasicSha
 
 static Length convertToLength(const CSSToLengthConversionData& conversionData, CSSPrimitiveValue* value)
 {
-    return value->convertToLength<FixedIntegerConversion | FixedFloatConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(conversionData);
+    return value->convertToLength<FixedIntegerConversion | FixedFloatConversion | PercentConversion | CalculatedConversion>(conversionData);
 }
 
 static LengthSize convertToLengthSize(const CSSToLengthConversionData& conversionData, CSSPrimitiveValue* value)
@@ -265,9 +264,9 @@ PassRefPtr<BasicShape> basicShapeForValue(const CSSToLengthConversionData& conve
     return basicShape.release();
 }
 
-float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate& center, float boxDimension, RenderView* view)
+float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate& center, float boxDimension)
 {
-    float offset = floatValueForLength(center.length(), boxDimension, view);
+    float offset = floatValueForLength(center.length(), boxDimension);
     if (center.direction() == BasicShapeCenterCoordinate::TopLeft)
         return offset;
     return boxDimension - offset;
index 41072fd..2f06ad7 100644 (file)
 namespace WebCore {
 
 class CSSBasicShape;
+class CSSToLengthConversionData;
 class CSSPrimitiveValue;
 class CSSToLengthConversionData;
 class CSSValue;
 class RenderStyle;
-class RenderView;
 
 PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle*, const BasicShape*);
 PassRefPtr<BasicShape> basicShapeForValue(const CSSToLengthConversionData&, const CSSBasicShape*);
 
-float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate&, float, RenderView*);
+float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate&, float);
 }
 
 #endif
index ee9c631..5ac6f49 100644 (file)
@@ -66,6 +66,10 @@ static CalculationCategory unitCategory(CSSPrimitiveValue::UnitTypes type)
     case CSSPrimitiveValue::CSS_PC:
     case CSSPrimitiveValue::CSS_REMS:
     case CSSPrimitiveValue::CSS_CHS:
+    case CSSPrimitiveValue::CSS_VW:
+    case CSSPrimitiveValue::CSS_VH:
+    case CSSPrimitiveValue::CSS_VMIN:
+    case CSSPrimitiveValue::CSS_VMAX:
         return CalcLength;
     case CSSPrimitiveValue::CSS_PERCENTAGE:
         return CalcPercent;
@@ -721,10 +725,6 @@ static PassRefPtr<CSSCalcExpressionNode> createCSS(const Length& length, const R
 {
     switch (length.type()) {
     case Percent:
-    case ViewportPercentageWidth:
-    case ViewportPercentageHeight:
-    case ViewportPercentageMin:
-    case ViewportPercentageMax:
     case Fixed:
         return CSSCalcPrimitiveValue::create(CSSPrimitiveValue::create(length, &style), length.value() == trunc(length.value()));
     case Calculated:
index ae27406..9879ec9 100644 (file)
@@ -57,7 +57,6 @@
 #include "Rect.h"
 #include "RenderBox.h"
 #include "RenderStyle.h"
-#include "RenderView.h"
 #include "SVGElement.h"
 #include "StyleInheritedData.h"
 #include "StyleProperties.h"
@@ -654,7 +653,7 @@ static PassRef<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID
     return positionList;
 }
 
-static PassRefPtr<CSSValue> positionOffsetValue(RenderStyle* style, CSSPropertyID propertyID, RenderView* renderView)
+static PassRefPtr<CSSValue> positionOffsetValue(RenderStyle* style, CSSPropertyID propertyID)
 {
     if (!style)
         return nullptr;
@@ -680,8 +679,7 @@ static PassRefPtr<CSSValue> positionOffsetValue(RenderStyle* style, CSSPropertyI
     if (style->hasOutOfFlowPosition()) {
         if (l.isFixed())
             return zoomAdjustedPixelValue(l.value(), style);
-        if (l.isViewportPercentage())
-            return zoomAdjustedPixelValue(valueForLength(l, 0, renderView), style);
+
         return cssValuePool().createValue(l);
     }
 
@@ -703,31 +701,31 @@ PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::currentColorOrValidColor(R
     return cssValuePool().createColorValue(color.rgb());
 }
 
-static PassRef<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
+static PassRef<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style)
 {
     auto list = CSSValueList::createSpaceSeparated();
     if (radius.width().isPercentNotCalculated())
         list.get().append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
     else
-        list.get().append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style));
+        list.get().append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0), style));
     if (radius.height().isPercentNotCalculated())
         list.get().append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
     else
-        list.get().append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style));
+        list.get().append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0), style));
     return list;
 }
 
-static PassRef<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
+static PassRef<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style)
 {
     if (radius.width() == radius.height()) {
         if (radius.width().isPercentNotCalculated())
             return cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
-        return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style);
+        return zoomAdjustedPixelValue(valueForLength(radius.width(), 0), style);
     }
-    return getBorderRadiusCornerValues(radius, style, renderView);
+    return getBorderRadiusCornerValues(radius, style);
 }
 
-static PassRef<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, RenderView* renderView)
+static PassRef<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style)
 {
     auto list = CSSValueList::createSlashSeparated();
     bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width();
@@ -738,10 +736,10 @@ static PassRef<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* st
     bool showVerticalBottomRight = showVerticalBottomLeft || (style->borderBottomRightRadius().height() != style->borderTopLeftRadius().height());
     bool showVerticalTopRight = showVerticalBottomRight || (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height());
 
-    RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, renderView);
-    RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, renderView);
-    RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, renderView);
-    RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, renderView);
+    RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style);
+    RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style);
+    RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style);
+    RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style);
 
     RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
     horizontalRadii->append(topLeftRadius->item(0));
@@ -958,7 +956,7 @@ PassRef<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle* styl
 #endif
 
 #if ENABLE(CSS_GRID_LAYOUT)
-static PassRef<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style, RenderView* renderView)
+static PassRef<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style)
 {
     if (!trackBreadth.isLength())
         return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
@@ -966,20 +964,18 @@ static PassRef<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& tra
     const Length& trackBreadthLength = trackBreadth.length();
     if (trackBreadthLength.isAuto())
         return cssValuePool().createIdentifierValue(CSSValueAuto);
-    if (trackBreadthLength.isViewportPercentage())
-        return zoomAdjustedPixelValue(valueForLength(trackBreadthLength, 0, renderView), style);
     return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
 }
 
-static PassRefPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
+static PassRefPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style)
 {
     switch (trackSize.type()) {
     case LengthTrackSizing:
-        return specifiedValueForGridTrackBreadth(trackSize.length(), style, renderView);
+        return specifiedValueForGridTrackBreadth(trackSize.length(), style);
     case MinMaxTrackSizing:
         RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
-        minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
-        minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
+        minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), style));
+        minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.maxTrackBreadth(), style));
         return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
     }
     ASSERT_NOT_REACHED();
@@ -998,7 +994,7 @@ static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLinesMap& or
     list.append(lineNames.release());
 }
 
-static PassRef<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle* style, RenderView* renderView)
+static PassRef<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle* style)
 {
     const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style->gridColumns() : style->gridRows();
     const OrderedNamedGridLinesMap& orderedNamedGridLines = direction == ForColumns ? style->orderedNamedGridColumnLines() : style->orderedNamedGridRowLines();
@@ -1023,7 +1019,7 @@ static PassRef<CSSValue> valueForGridTrackList(GridTrackSizingDirection directio
     } else {
         for (unsigned i = 0; i < trackSizes.size(); ++i) {
             addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, list.get());
-            list.get().append(specifiedValueForGridTrackSize(trackSizes[i], style, renderView));
+            list.get().append(specifiedValueForGridTrackSize(trackSizes[i], style));
         }
     }
 
@@ -1449,7 +1445,7 @@ static PassRef<CSSValueList> fontFamilyFromStyle(RenderStyle* style)
     return list;
 }
 
-static PassRef<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, RenderView* renderView)
+static PassRef<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style)
 {
     Length length = style->lineHeight();
     if (length.isNegative())
@@ -1461,7 +1457,7 @@ static PassRef<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, Render
         // that here either.
         return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
     }
-    return zoomAdjustedPixelValue(floatValueForLength(length, 0, renderView), style);
+    return zoomAdjustedPixelValue(floatValueForLength(length, 0), style);
 }
 
 static PassRef<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle* style)
@@ -1878,7 +1874,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         case CSSPropertyBorderLeftWidth:
             return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
         case CSSPropertyBottom:
-            return positionOffsetValue(style.get(), CSSPropertyBottom, m_node->document().renderView());
+            return positionOffsetValue(style.get(), CSSPropertyBottom);
         case CSSPropertyWebkitBoxAlign:
             return cssValuePool().createValue(style->boxAlign());
 #if ENABLE(CSS_BOX_DECORATION_BREAK)
@@ -2022,7 +2018,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
             computedFont->variant = fontVariantFromStyle(style.get());
             computedFont->weight = fontWeightFromStyle(style.get());
             computedFont->size = fontSizeFromStyle(style.get());
-            computedFont->lineHeight = lineHeightFromStyle(style.get(), m_node->document().renderView());
+            computedFont->lineHeight = lineHeightFromStyle(style.get());
             computedFont->family = fontFamilyFromStyle(style.get());
             return computedFont.release();
         }
@@ -2063,14 +2059,14 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         // depending on the size of the explicit grid or the number of implicit tracks added to the grid. See
         // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html
         case CSSPropertyWebkitGridAutoColumns:
-            return specifiedValueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document().renderView());
+            return specifiedValueForGridTrackSize(style->gridAutoColumns(), style.get());
         case CSSPropertyWebkitGridAutoRows:
-            return specifiedValueForGridTrackSize(style->gridAutoRows(), style.get(), m_node->document().renderView());
+            return specifiedValueForGridTrackSize(style->gridAutoRows(), style.get());
 
         case CSSPropertyWebkitGridTemplateColumns:
-            return valueForGridTrackList(ForColumns, renderer, style.get(), m_node->document().renderView());
+            return valueForGridTrackList(ForColumns, renderer, style.get());
         case CSSPropertyWebkitGridTemplateRows:
-            return valueForGridTrackList(ForRows, renderer, style.get(), m_node->document().renderView());
+            return valueForGridTrackList(ForRows, renderer, style.get());
 
         case CSSPropertyWebkitGridColumnStart:
             return valueForGridPosition(style->gridItemColumnStart());
@@ -2141,7 +2137,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
             return cssValuePool().createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
 #endif
         case CSSPropertyLeft:
-            return positionOffsetValue(style.get(), CSSPropertyLeft, m_node->document().renderView());
+            return positionOffsetValue(style.get(), CSSPropertyLeft);
         case CSSPropertyLetterSpacing:
             if (!style->letterSpacing())
                 return cssValuePool().createIdentifierValue(CSSValueNormal);
@@ -2151,7 +2147,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
                 return cssValuePool().createIdentifierValue(CSSValueNone);
             return cssValuePool().createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
         case CSSPropertyLineHeight:
-            return lineHeightFromStyle(style.get(), m_node->document().renderView());
+            return lineHeightFromStyle(style.get());
         case CSSPropertyListStyleImage:
             if (style->listStyleImage())
                 return style->listStyleImage()->cssValue();
@@ -2171,11 +2167,11 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
             if (marginRight.isFixed() || !renderer || !renderer->isBox())
                 return zoomAdjustedPixelValueForLength(marginRight, style.get());
             float value;
-            if (marginRight.isPercent() || marginRight.isViewportPercentage()) {
+            if (marginRight.isPercent()) {
                 // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
                 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
                 // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
-                value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document().renderView());
+                value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent());
             } else
                 value = toRenderBox(renderer)->marginRight();
             return zoomAdjustedPixelValue(value, style.get());
@@ -2266,7 +2262,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         case CSSPropertyPosition:
             return cssValuePool().createValue(style->position());
         case CSSPropertyRight:
-            return positionOffsetValue(style.get(), CSSPropertyRight, m_node->document().renderView());
+            return positionOffsetValue(style.get(), CSSPropertyRight);
         case CSSPropertyWebkitRubyPosition:
             return cssValuePool().createValue(style->rubyPosition());
         case CSSPropertyTableLayout:
@@ -2367,7 +2363,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         case CSSPropertyTextTransform:
             return cssValuePool().createValue(style->textTransform());
         case CSSPropertyTop:
-            return positionOffsetValue(style.get(), CSSPropertyTop, m_node->document().renderView());
+            return positionOffsetValue(style.get(), CSSPropertyTop);
         case CSSPropertyUnicodeBidi:
             return cssValuePool().createValue(style->unicodeBidi());
         case CSSPropertyVerticalAlign:
@@ -2633,9 +2629,8 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
                 if (renderer->isBox())
                     box = toRenderBox(renderer)->borderBoxRect();
 
-                RenderView* renderView = m_node->document().renderView();
-                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get()));
-                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get()));
+                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width()), style.get()));
+                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height()), style.get()));
             }
             else {
                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get()));
@@ -2665,13 +2660,13 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         case CSSPropertyWebkitUserSelect:
             return cssValuePool().createValue(style->userSelect());
         case CSSPropertyBorderBottomLeftRadius:
-            return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), m_node->document().renderView());
+            return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get());
         case CSSPropertyBorderBottomRightRadius:
-            return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), m_node->document().renderView());
+            return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get());
         case CSSPropertyBorderTopLeftRadius:
-            return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), m_node->document().renderView());
+            return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get());
         case CSSPropertyBorderTopRightRadius:
-            return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), m_node->document().renderView());
+            return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get());
         case CSSPropertyClip: {
             if (!style->hasClip())
                 return cssValuePool().createIdentifierValue(CSSValueAuto);
@@ -2693,9 +2688,8 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
                 if (renderer->isBox())
                     box = toRenderBox(renderer)->borderBoxRect();
 
-                RenderView* renderView = m_node->document().renderView();
-                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
-                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get()));
+                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width()), style.get()));
+                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height()), style.get()));
                 if (style->transformOriginZ() != 0)
                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
             } else {
@@ -2856,7 +2850,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         case CSSPropertyBorderImage:
             return valueForNinePieceImage(style->borderImage());
         case CSSPropertyBorderRadius:
-            return getBorderRadiusShorthandValue(style.get(), m_node->document().renderView());
+            return getBorderRadiusShorthandValue(style.get());
         case CSSPropertyBorderRight:
             return getCSSPropertyValuesForShorthandProperties(borderRightShorthand());
         case CSSPropertyBorderStyle:
index 827a215..5bf133a 100644 (file)
@@ -36,6 +36,7 @@
 #include "Image.h"
 #include "NodeRenderStyle.h"
 #include "RenderElement.h"
+#include "RenderView.h"
 #include "StyleResolver.h"
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
@@ -129,7 +130,7 @@ PassRefPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(StyleR
     return result.release();
 }
 
-void CSSGradientValue::addStops(Gradient& gradient, RenderView& renderView, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat)
+void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat)
 {
     if (m_gradientType == CSSDeprecatedLinearGradient || m_gradientType == CSSDeprecatedRadialGradient) {
         sortStopsIfNeeded();
@@ -182,8 +183,6 @@ void CSSGradientValue::addStops(Gradient& gradient, RenderView& renderView, cons
                 float length;
                 if (positionValue.isLength())
                     length = positionValue.computeLength<float>(conversionData);
-                else if (positionValue.isViewportPercentageLength())
-                    length = valueForLength(positionValue.viewportPercentageLength(), 0, &renderView);
                 else {
                     Ref<CalculationValue> calculationValue { positionValue.cssCalcValue()->createCalculationValue(conversionData) };
                     length = calculationValue->evaluate(gradientLength);
@@ -647,7 +646,7 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderElement& rende
 {
     ASSERT(!size.isEmpty());
 
-    CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle());
+    CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle(), &renderer.view());
 
     FloatPoint firstPoint;
     FloatPoint secondPoint;
@@ -704,7 +703,7 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderElement& rende
     RefPtr<Gradient> gradient = Gradient::create(firstPoint, secondPoint);
 
     // Now add the stops.
-    addStops(*gradient, renderer.view(), conversionData, 1);
+    addStops(*gradient, conversionData, 1);
 
     return gradient.release();
 }
@@ -985,7 +984,7 @@ PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderElement& rende
 {
     ASSERT(!size.isEmpty());
 
-    CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle());
+    CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle(), &renderer.view());
 
     FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size);
     if (!m_firstX)
@@ -1118,7 +1117,7 @@ PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderElement& rende
     }
 
     // Now add the stops.
-    addStops(*gradient, renderer.view(), conversionData, maxExtent);
+    addStops(*gradient, conversionData, maxExtent);
 
     return gradient.release();
 }
index f465a54..61dbb5a 100644 (file)
@@ -110,7 +110,7 @@ protected:
     {
     }
 
-    void addStops(Gradient&, RenderView&, const CSSToLengthConversionData&, float maxLengthForRepeat = 0);
+    void addStops(Gradient&, const CSSToLengthConversionData&, float maxLengthForRepeat = 0);
 
     // Resolve points/radii to front end values.
     FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, const CSSToLengthConversionData&, const FloatSize&);
index 1dad8db..640262f 100644 (file)
@@ -159,11 +159,6 @@ CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValu
     case CSS_HZ:
     case CSS_KHZ:
         return UFrequency;
-    case CSS_VW:
-    case CSS_VH:
-    case CSS_VMIN:
-    case CSS_VMAX:
-        return UViewportPercentageLength;
 #if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
     case CSS_DPPX:
     case CSS_DPI:
@@ -301,10 +296,6 @@ CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, const RenderStyle* st
     case FillAvailable:
     case FitContent:
     case Percent:
-    case ViewportPercentageWidth:
-    case ViewportPercentageHeight:
-    case ViewportPercentageMin:
-    case ViewportPercentageMax:
         init(length);
         return;
     case Fixed:
@@ -370,22 +361,6 @@ void CSSPrimitiveValue::init(const Length& length)
         ASSERT(std::isfinite(length.percent()));
         m_value.num = length.percent();
         return;
-    case ViewportPercentageWidth:
-        m_primitiveUnitType = CSS_VW;
-        m_value.num = length.viewportPercentageLength();
-        return;
-    case ViewportPercentageHeight:
-        m_primitiveUnitType = CSS_VH;
-        m_value.num = length.viewportPercentageLength();
-        return;
-    case ViewportPercentageMin:
-        m_primitiveUnitType = CSS_VMIN;
-        m_value.num = length.viewportPercentageLength();
-        return;
-    case ViewportPercentageMax:
-        m_primitiveUnitType = CSS_VMAX;
-        m_value.num = length.viewportPercentageLength();
-        return;
     case Calculated:
     case Relative:
     case Undefined:
@@ -657,10 +632,16 @@ double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& c
         ASSERT_NOT_REACHED();
         return -1.0;
     case CSS_VH:
+        factor = conversionData.viewportHeightFactor();
+        break;
     case CSS_VW:
+        factor = conversionData.viewportWidthFactor();
+        break;
     case CSS_VMAX:
+        factor = conversionData.viewportMaxFactor();
+        break;
     case CSS_VMIN:
-        factor = 1.0;
+        factor = conversionData.viewportMinFactor();
         break;
     default:
         ASSERT_NOT_REACHED();
@@ -779,8 +760,6 @@ CSSPrimitiveValue::UnitTypes CSSPrimitiveValue::canonicalUnitTypeForCategory(Uni
         return CSS_DEG;
     case UFrequency:
         return CSS_HZ;
-    case UViewportPercentageLength:
-        return CSS_UNKNOWN; // Cannot convert between numbers and relative lengths.
 #if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
     case UResolution:
         return CSS_DPPX;
@@ -1224,29 +1203,6 @@ void CSSPrimitiveValue::addSubresourceStyleURLs(ListHashSet<URL>& urls, const St
         addSubresourceURL(urls, styleSheet->completeURL(m_value.string));
 }
 
-Length CSSPrimitiveValue::viewportPercentageLength() const
-{
-    ASSERT(isViewportPercentageLength());
-    Length viewportLength;
-    switch (m_primitiveUnitType) {
-    case CSS_VW:
-        viewportLength = Length(getDoubleValue(), ViewportPercentageWidth);
-        break;
-    case CSS_VH:
-        viewportLength = Length(getDoubleValue(), ViewportPercentageHeight);
-        break;
-    case CSS_VMIN:
-        viewportLength = Length(getDoubleValue(), ViewportPercentageMin);
-        break;
-    case CSS_VMAX:
-        viewportLength = Length(getDoubleValue(), ViewportPercentageMax);
-        break;
-    default:
-        break;
-    }
-    return viewportLength;
-}
-
 PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::cloneForCSSOM() const
 {
     RefPtr<CSSPrimitiveValue> result;
index 2a1fd6d..4602aab 100644 (file)
@@ -148,7 +148,6 @@ public:
         UAngle,
         UTime,
         UFrequency,
-        UViewportPercentageLength,
 #if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
         UResolution,
 #endif
@@ -176,7 +175,7 @@ public:
     bool isLength() const
     {
         unsigned short type = primitiveType();
-        return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS;
+        return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS || isViewportPercentageLength();
     }
     bool isNumber() const { return primitiveType() == CSS_NUMBER; }
     bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; }
@@ -329,8 +328,6 @@ public:
 
     void addSubresourceStyleURLs(ListHashSet<URL>&, const StyleSheetContents*) const;
 
-    Length viewportPercentageLength() const;
-
     PassRefPtr<CSSPrimitiveValue> cloneForCSSOM() const;
     void setCSSOMSafe() { m_isCSSOMSafe = true; }
 
index 22259b0..7ec7839 100644 (file)
@@ -4624,8 +4624,7 @@ enum LengthConversion {
     AutoConversion = 1 << 2,
     PercentConversion = 1 << 3,
     FractionConversion = 1 << 4,
-    CalculatedConversion = 1 << 5,
-    ViewportPercentageConversion = 1 << 6
+    CalculatedConversion = 1 << 5
 };
 
 template<int supported> Length CSSPrimitiveValue::convertToLength(const CSSToLengthConversionData& conversionData) const
@@ -4644,8 +4643,6 @@ template<int supported> Length CSSPrimitiveValue::convertToLength(const CSSToLen
         return Length(Auto);
     if ((supported & CalculatedConversion) && isCalculated())
         return Length(cssCalcValue()->createCalculationValue(conversionData));
-    if ((supported & ViewportPercentageConversion) && isViewportPercentageLength())
-        return viewportPercentageLength();
     return Length(Undefined);
 }
 
index dfc4ae5..5c7b7f3 100644 (file)
@@ -32,6 +32,7 @@
 #include "CSSToLengthConversionData.h"
 
 #include "RenderStyle.h"
+#include "RenderView.h"
 
 namespace WebCore {
 
@@ -42,4 +43,46 @@ float CSSToLengthConversionData::zoom() const
     return m_zoom;
 }
 
+double CSSToLengthConversionData::viewportWidthFactor() const
+{
+    if (m_style && !m_computingFontSize)
+        m_style->setHasViewportUnits();
+    return m_renderView ? m_renderView->viewportSizeForCSSViewportUnits().width() / 100.0 : 0.0;
+}
+
+double CSSToLengthConversionData::viewportHeightFactor() const
+{
+    if (m_style && !m_computingFontSize)
+        m_style->setHasViewportUnits();
+
+    if (!m_renderView)
+        return 0.0;
+
+    return m_renderView ? m_renderView->viewportSizeForCSSViewportUnits().height() / 100.0 : 0.0;
+}
+
+double CSSToLengthConversionData::viewportMinFactor() const
+{
+    if (m_style && !m_computingFontSize)
+        m_style->setHasViewportUnits();
+
+    if (!m_renderView)
+        return 0.0;
+
+    IntSize viewportSizeForCSSViewportUnits = m_renderView->viewportSizeForCSSViewportUnits();
+    return std::min(viewportSizeForCSSViewportUnits.width(), viewportSizeForCSSViewportUnits.height()) / 100.0;
+}
+
+double CSSToLengthConversionData::viewportMaxFactor() const
+{
+    if (m_style && !m_computingFontSize)
+        m_style->setHasViewportUnits();
+
+    if (!m_renderView)
+        return 0.0;
+
+    IntSize viewportSizeForCSSViewportUnits = m_renderView->viewportSizeForCSSViewportUnits();
+    return std::max(viewportSizeForCSSViewportUnits.width(), viewportSizeForCSSViewportUnits.height()) / 100.0;
+}
+
 } // namespace WebCore
index b5f39fb..10780b9 100644 (file)
 namespace WebCore {
 
 class RenderStyle;
+class RenderView;
 
 class CSSToLengthConversionData {
 public:
-    CSSToLengthConversionData(const RenderStyle* style, const RenderStyle* rootStyle, float zoom, bool computingFontSize = false)
+    CSSToLengthConversionData(RenderStyle* style, const RenderStyle* rootStyle, const RenderView* renderView, float zoom, bool computingFontSize = false)
         : m_style(style)
         , m_rootStyle(rootStyle)
+        , m_renderView(renderView)
         , m_zoom(zoom)
         , m_useEffectiveZoom(false)
         , m_computingFontSize(computingFontSize)
     {
         ASSERT(zoom > 0);
     }
-    CSSToLengthConversionData(const RenderStyle* style = nullptr, const RenderStyle* rootStyle = nullptr, bool computingFontSize = false)
+    CSSToLengthConversionData(RenderStyle* style, const RenderStyle* rootStyle, const RenderView* renderView, bool computingFontSize = false)
         : m_style(style)
         , m_rootStyle(rootStyle)
+        , m_renderView(renderView)
         , m_useEffectiveZoom(true)
         , m_computingFontSize(computingFontSize)
     {
     }
+    CSSToLengthConversionData()
+        : CSSToLengthConversionData(nullptr, nullptr, nullptr)
+    {
+    }
 
-    const RenderStyle* style() const { return m_style; }
+    RenderStyle* style() const { return m_style; }
     const RenderStyle* rootStyle() const { return m_rootStyle; }
     float zoom() const;
     bool computingFontSize() const { return m_computingFontSize; }
 
+    double viewportWidthFactor() const;
+    double viewportHeightFactor() const;
+    double viewportMinFactor() const;
+    double viewportMaxFactor() const;
+
     CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const
     {
-        return CSSToLengthConversionData(m_style, m_rootStyle, newZoom, m_computingFontSize);
+        return CSSToLengthConversionData(m_style, m_rootStyle, m_renderView, newZoom, m_computingFontSize);
     }
 
 private:
-    const RenderStyle* m_style;
+    RenderStyle* m_style;
     const RenderStyle* m_rootStyle;
+    const RenderView* m_renderView;
     float m_zoom;
     bool m_useEffectiveZoom;
     bool m_computingFontSize;
index 28f64e8..513c4d9 100644 (file)
@@ -37,6 +37,7 @@
 #include "FillLayer.h"
 #include "Pair.h"
 #include "Rect.h"
+#include "RenderView.h"
 #include "StyleResolver.h"
 
 namespace WebCore {
@@ -50,7 +51,7 @@ RenderStyle* CSSToStyleMap::style() const
 {
     return m_resolver->style();
 }
-    
+
 RenderStyle* CSSToStyleMap::rootElementStyle() const
 {
     return m_resolver->rootElementStyle();
@@ -60,7 +61,7 @@ bool CSSToStyleMap::useSVGZoomRules() const
 {
     return m_resolver->useSVGZoomRules();
 }
-    
+
 PassRefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue* value)
 {
     return m_resolver->styleImage(propertyId, value);
@@ -253,8 +254,6 @@ void CSSToStyleMap::mapFillXPosition(CSSPropertyID propertyID, FillLayer* layer,
         length = Length(primitiveValue->getDoubleValue(), Percent);
     else if (primitiveValue->isCalculatedPercentageWithLength())
         length = Length(primitiveValue->cssCalcValue()->createCalculationValue(m_resolver->state().cssToLengthConversionData()));
-    else if (primitiveValue->isViewportPercentageLength())
-        length = primitiveValue->viewportPercentageLength();
     else
         return;
 
@@ -287,8 +286,6 @@ void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer* layer,
         length = Length(primitiveValue->getDoubleValue(), Percent);
     else if (primitiveValue->isCalculatedPercentageWithLength())
         length = Length(primitiveValue->cssCalcValue()->createCalculationValue(m_resolver->state().cssToLengthConversionData()));
-    else if (primitiveValue->isViewportPercentageLength())
-        length = primitiveValue->viewportPercentageLength();
     else
         return;
 
index 0c77360..c53887f 100644 (file)
@@ -394,8 +394,6 @@ public:
             setValue(styleResolver->style(), Length(primitiveValue->getDoubleValue(), Percent));
         else if (primitiveValue->isCalculatedPercentageWithLength())
             setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->createCalculationValue(styleResolver->state().cssToLengthConversionData())));
-        else if (primitiveValue->isViewportPercentageLength())
-            setValue(styleResolver->style(), primitiveValue->viewportPercentageLength());
     }
 
     static PropertyHandler createHandler()
@@ -446,8 +444,6 @@ public:
         Length radiusWidth;
         if (pair->first()->isPercentage())
             radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
-        else if (pair->first()->isViewportPercentageLength())
-            radiusWidth = Length(styleResolver->viewportPercentageValue(*pair->first(), pair->first()->getIntValue()), Fixed);
         else if (pair->first()->isCalculatedPercentageWithLength())
             radiusWidth = Length(pair->first()->cssCalcValue()->createCalculationValue(conversionData));
         else
@@ -456,8 +452,6 @@ public:
         Length radiusHeight;
         if (pair->second()->isPercentage())
             radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
-        else if (pair->second()->isViewportPercentageLength())
-            radiusHeight = Length(styleResolver->viewportPercentageValue(*pair->second(), pair->second()->getIntValue()), Fixed);
         else if (pair->second()->isCalculatedPercentageWithLength())
             radiusHeight = Length(pair->second()->cssCalcValue()->createCalculationValue(conversionData));
         else
@@ -622,8 +616,6 @@ public:
                 if (originalLength >= 1.0)
                     length = 1.0;
             }
-            if (primitiveValue->isViewportPercentageLength())
-                length = styleResolver->viewportPercentageValue(*primitiveValue, length);
         } else {
             ASSERT_NOT_REACHED();
             length = 0;
@@ -868,16 +860,15 @@ public:
         } else {
             fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
                                               || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
-            if (primitiveValue->isLength())
-                size = primitiveValue->computeLength<float>(CSSToLengthConversionData(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0f, true));
-            else if (primitiveValue->isPercentage())
+            if (primitiveValue->isLength()) {
+                size = primitiveValue->computeLength<float>(CSSToLengthConversionData(styleResolver->parentStyle(), styleResolver->rootElementStyle(), styleResolver->document().renderView(), 1.0f, true));
+                styleResolver->state().setFontSizeHasViewportUnits(primitiveValue->isViewportPercentageLength());
+            } else if (primitiveValue->isPercentage())
                 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
             else if (primitiveValue->isCalculatedPercentageWithLength()) {
                 Ref<CalculationValue> calculationValue { primitiveValue->cssCalcValue()->createCalculationValue(styleResolver->state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f)) };
                 size = calculationValue->evaluate(parentSize);
-            } else if (primitiveValue->isViewportPercentageLength())
-                size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document().renderView());
-            else
+            } else
                 return;
         }
 
@@ -1458,9 +1449,7 @@ public:
         } else if (primitiveValue->isNumber()) {
             // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
             lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
-        } else if (primitiveValue->isViewportPercentageLength())
-            lineHeight = primitiveValue->viewportPercentageLength();
-        else
+        } else
             return;
         styleResolver->style()->setLineHeight(lineHeight);
     }
@@ -1498,9 +1487,7 @@ public:
                 lineHeight = Length(primitiveValue->getDoubleValue() * styleResolver->style()->textSizeAdjust().multiplier() * 100.0, Percent);
             else
                 lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
-        } else if (primitiveValue->isViewportPercentageLength())
-            lineHeight = primitiveValue->viewportPercentageLength();
-        else
+        } else
             return;
         styleResolver->style()->setLineHeight(lineHeight);
         styleResolver->style()->setSpecifiedLineHeight(lineHeight);
@@ -1543,8 +1530,6 @@ public:
             wordSpacing = Length(primitiveValue->getDoubleValue(), Percent);
         else if (primitiveValue->isNumber())
             wordSpacing = Length(primitiveValue->getDoubleValue(), Fixed);
-        else if (primitiveValue->isViewportPercentageLength())
-            wordSpacing = Length(styleResolver->viewportPercentageValue(*primitiveValue, primitiveValue->getDoubleValue()), Fixed);
         else
             return;
         styleResolver->style()->setWordSpacing(wordSpacing);
@@ -1960,7 +1945,7 @@ public:
         if (primitiveValue->getValueID())
             return styleResolver->style()->setVerticalAlign(*primitiveValue);
 
-        styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->state().cssToLengthConversionData()));
+        styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(styleResolver->state().cssToLengthConversionData()));
     }
 
     static PropertyHandler createHandler()
@@ -2300,7 +2285,7 @@ public:
 
             CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
             if (!primitiveValue->getValueID())
-                lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->state().cssToLengthConversionData());
+                lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(styleResolver->state().cssToLengthConversionData());
 #if ENABLE(CSS3_TEXT)
             else if (primitiveValue->getValueID() == CSSValueWebkitEachLine)
                 textIndentLineValue = TextIndentEachLine;
index 56400d4..cf1c021 100644 (file)
 #include "config.h"
 #include "LengthFunctions.h"
 
+#include "FloatSize.h"
 #include "LayoutUnit.h"
 #include "LengthSize.h"
-#include "RenderView.h"
 
 namespace WebCore {
 
-int minimumIntValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
+int minimumIntValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages)
 {
-    return static_cast<int>(minimumValueForLength(length, maximumValue, renderView, roundPercentages));
+    return static_cast<int>(minimumValueForLength(length, maximumValue, roundPercentages));
 }
 
-int intValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
+int intValueForLength(const Length& length, LayoutUnit maximumValue)
 {
-    return static_cast<int>(valueForLength(length, maximumValue, renderView, roundPercentages));
+    return static_cast<int>(valueForLength(length, maximumValue));
 }
 
-LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
+LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages)
 {
     switch (length.type()) {
     case Fixed:
@@ -52,26 +52,6 @@ LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue,
         return LayoutUnit(static_cast<float>(maximumValue * length.percent() / 100.0f));
     case Calculated:
         return length.nonNanCalculatedValue(maximumValue);
-    case ViewportPercentageWidth:
-        if (renderView)
-            return LayoutUnit(renderView->viewportSizeForCSSViewportUnits().width() * length.viewportPercentageLength() / 100.0f);
-        return 0;
-    case ViewportPercentageHeight:
-        if (renderView)
-            return LayoutUnit(renderView->viewportSizeForCSSViewportUnits().height() * length.viewportPercentageLength() / 100.0f);
-        return 0;
-    case ViewportPercentageMin:
-        if (renderView) {
-            IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
-            return LayoutUnit(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
-        }
-        return 0;
-    case ViewportPercentageMax:
-        if (renderView) {
-            IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
-            return LayoutUnit(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
-        }
-        return 0;
     case FillAvailable:
     case Auto:
         return 0;
@@ -89,17 +69,13 @@ LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue,
     return 0;
 }
 
-LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
+LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue)
 {
     switch (length.type()) {
     case Fixed:
     case Percent:
     case Calculated:
-    case ViewportPercentageWidth:
-    case ViewportPercentageHeight:
-    case ViewportPercentageMin:
-    case ViewportPercentageMax:
-        return minimumValueForLength(length, maximumValue, renderView, roundPercentages);
+        return minimumValueForLength(length, maximumValue);
     case FillAvailable:
     case Auto:
         return maximumValue;
@@ -118,7 +94,7 @@ LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue, RenderV
 }
 
 // FIXME: when subpixel layout is supported this copy of floatValueForLength() can be removed. See bug 71143.
-float floatValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView)
+float floatValueForLength(const Length& length, LayoutUnit maximumValue)
 {
     switch (length.type()) {
     case Fixed:
@@ -129,27 +105,7 @@ float floatValueForLength(const Length& length, LayoutUnit maximumValue, RenderV
     case Auto:
         return static_cast<float>(maximumValue);
     case Calculated:
-        return length.nonNanCalculatedValue(maximumValue);                
-    case ViewportPercentageWidth:
-        if (renderView)
-            return static_cast<int>(renderView->viewportSizeForCSSViewportUnits().width() * length.viewportPercentageLength() / 100.0f);
-        return 0;
-    case ViewportPercentageHeight:
-        if (renderView)
-            return static_cast<int>(renderView->viewportSizeForCSSViewportUnits().height() * length.viewportPercentageLength() / 100.0f);
-        return 0;
-    case ViewportPercentageMin:
-        if (renderView) {
-            IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
-            return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
-        }
-        return 0;
-    case ViewportPercentageMax:
-        if (renderView) {
-            IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
-            return static_cast<int>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
-        }
-        return 0;
+        return length.nonNanCalculatedValue(maximumValue);
     case Relative:
     case Intrinsic:
     case MinIntrinsic:
@@ -164,7 +120,7 @@ float floatValueForLength(const Length& length, LayoutUnit maximumValue, RenderV
     return 0;
 }
 
-float floatValueForLength(const Length& length, float maximumValue, RenderView* renderView)
+float floatValueForLength(const Length& length, float maximumValue)
 {
     switch (length.type()) {
     case Fixed:
@@ -176,26 +132,6 @@ float floatValueForLength(const Length& length, float maximumValue, RenderView*
         return static_cast<float>(maximumValue);
     case Calculated:
         return length.nonNanCalculatedValue(maximumValue);
-    case ViewportPercentageWidth:
-        if (renderView)
-            return static_cast<int>(renderView->viewportSizeForCSSViewportUnits().width() * length.viewportPercentageLength() / 100.0f);
-        return 0;
-    case ViewportPercentageHeight:
-        if (renderView)
-            return static_cast<int>(renderView->viewportSizeForCSSViewportUnits().height() * length.viewportPercentageLength() / 100.0f);
-        return 0;
-    case ViewportPercentageMin:
-        if (renderView) {
-            IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
-            return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
-        }
-        return 0;
-    case ViewportPercentageMax:
-        if (renderView) {
-            IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
-            return static_cast<int>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
-        }
-        return 0;
     case Relative:
     case Intrinsic:
     case MinIntrinsic:
@@ -210,9 +146,9 @@ float floatValueForLength(const Length& length, float maximumValue, RenderView*
     return 0;
 }
 
-FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize, RenderView* view)
+FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize)
 {
-    return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width(), view), floatValueForLength(lengthSize.height(), boxSize.height(), view));
+    return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), floatValueForLength(lengthSize.height(), boxSize.height()));
 }
 
 } // namespace WebCore
index be198c1..13428d7 100644 (file)
@@ -32,13 +32,13 @@ class RenderView;
 struct Length;
 struct LengthSize;
 
-int minimumIntValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
-int intValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
-LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
-LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
-float floatValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0);
-float floatValueForLength(const Length&, float maximumValue, RenderView* = 0);
-FloatSize floatSizeForLengthSize(const LengthSize&, const FloatSize&, RenderView* = 0);
+int minimumIntValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false);
+int intValueForLength(const Length&, LayoutUnit maximumValue);
+LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false);
+LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue);
+float floatValueForLength(const Length&, LayoutUnit maximumValue);
+float floatValueForLength(const Length&, float maximumValue);
+FloatSize floatSizeForLengthSize(const LengthSize&, const FloatSize&);
 
 } // namespace WebCore
 
index 79927ee..4c5d3e5 100644 (file)
@@ -725,7 +725,9 @@ bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const
     // used
     EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
     if (func) {
-        CSSToLengthConversionData conversionData(m_style.get(), m_frame->document()->documentElement()->renderStyle());
+        CSSToLengthConversionData conversionData(m_style.get(),
+            m_frame->document()->documentElement()->renderStyle(),
+            m_frame->document()->renderView());
         return func(expr->value(), conversionData, m_frame, NoPrefix);
     }
 
index a549b3a..fcd40c2 100644 (file)
@@ -235,7 +235,7 @@ inline void StyleResolver::State::clear()
 #if ENABLE(CSS_FILTERS)
     m_filtersWithPendingSVGDocuments.clear();
 #endif
-    m_cssToLengthConversionData = CSSToLengthConversionData(nullptr, nullptr);
+    m_cssToLengthConversionData = CSSToLengthConversionData();
 }
 
 void StyleResolver::MatchResult::addMatchedProperties(const StyleProperties& properties, StyleRule* rule, unsigned linkMatchType, PropertyWhitelistType propertyWhitelistType)
@@ -380,11 +380,17 @@ bool StyleResolver::classNamesAffectedByRules(const SpaceSplitString& classNames
     return false;
 }
 
+inline void StyleResolver::State::updateConversionData()
+{
+    m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle, m_element ? document().renderView() : nullptr);
+}
+
 inline void StyleResolver::State::initElement(Element* e)
 {
     m_element = e;
     m_styledElement = e && e->isStyledElement() ? toStyledElement(e) : nullptr;
     m_elementLinkState = e ? e->document().visitedLinkState().determineLinkState(e) : NotInsideLink;
+    updateConversionData();
 }
 
 inline void StyleResolver::initElement(Element* e)
@@ -416,7 +422,13 @@ inline void StyleResolver::State::initForStyleResolve(Document& document, Elemen
     m_pendingImageProperties.clear();
     m_fontDirty = false;
 
-    m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle);
+    updateConversionData();
+}
+
+inline void StyleResolver::State::setStyle(PassRef<RenderStyle> style)
+{
+    m_style = std::move(style);
+    updateConversionData();
 }
 
 static const unsigned cStyleSearchThreshold = 10;
@@ -795,6 +807,9 @@ PassRef<RenderStyle> StyleResolver::styleForElement(Element* element, RenderStyl
     // Clean up our style object's display and text decorations (among other fixups).
     adjustRenderStyle(*state.style(), *state.parentStyle(), element);
 
+    if (state.style()->hasViewportUnits())
+        document().setHasStyleWithViewportUnits();
+
     state.clear(); // Clear out for the next resolve.
 
     // Now return the style.
@@ -964,6 +979,9 @@ PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* element, c
     // Clean up our style object's display and text decorations (among other fixups).
     adjustRenderStyle(*state.style(), *m_state.parentStyle(), 0);
 
+    if (state.style()->hasViewportUnits())
+        document().setHasStyleWithViewportUnits();
+
     // Start loading resources referenced by this style.
     loadPendingResources();
 
@@ -1392,6 +1410,8 @@ void StyleResolver::updateFont()
     checkForZoomChange(style, m_state.parentStyle());
     checkForOrientationChange(style);
     style->font().update(m_fontSelector);
+    if (m_state.fontSizeHasViewportUnits())
+        style->setHasViewportUnits(true);
     m_state.setFontDirty(false);
 }
 
@@ -1437,12 +1457,12 @@ Vector<RefPtr<StyleRule>> StyleResolver::pseudoStyleRulesForElement(Element* ele
 
 Length StyleResolver::convertToIntLength(const CSSPrimitiveValue* primitiveValue, const CSSToLengthConversionData& conversionData)
 {
-    return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(conversionData) : Length(Undefined);
+    return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | FractionConversion>(conversionData) : Length(Undefined);
 }
 
 Length StyleResolver::convertToFloatLength(const CSSPrimitiveValue* primitiveValue, const CSSToLengthConversionData& conversionData)
 {
-    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(conversionData) : Length(Undefined);
+    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion>(conversionData) : Length(Undefined);
 }
 
 static bool shouldApplyPropertyInParseOrder(CSSPropertyID propertyID)
@@ -1565,6 +1585,17 @@ void StyleResolver::invalidateMatchedPropertiesCache()
     m_matchedPropertiesCache.clear();
 }
 
+void StyleResolver::clearCachedPropertiesAffectedByViewportUnits()
+{
+    Vector<unsigned, 16> toRemove;
+    for (auto& cacheKeyValue : m_matchedPropertiesCache) {
+        if (cacheKeyValue.value.renderStyle->hasViewportUnits())
+            toRemove.append(cacheKeyValue.key);
+    }
+    for (auto key : toRemove)
+        m_matchedPropertiesCache.remove(key);
+}
+
 static bool isCacheableInMatchedPropertiesCache(const Element* element, const RenderStyle* style, const RenderStyle* parentStyle)
 {
     // FIXME: CSSPropertyWebkitWritingMode modifies state when applying to document element. We can't skip the applying by caching.
@@ -1843,7 +1874,7 @@ static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const Styl
         return true;
     }
 
-    workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | CalculatedConversion | AutoConversion>(state.cssToLengthConversionData());
+    workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | AutoConversion>(state.cssToLengthConversionData());
     if (workingLength.length().isUndefined())
         return false;
 
@@ -2287,17 +2318,9 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
                 continue;
             CSSShadowValue* item = toCSSShadowValue(currValue);
             int x = item->x->computeLength<int>(state.cssToLengthConversionData());
-            if (item->x->isViewportPercentageLength())
-                x = viewportPercentageValue(*item->x, x);
             int y = item->y->computeLength<int>(state.cssToLengthConversionData());
-            if (item->y->isViewportPercentageLength())
-                y = viewportPercentageValue(*item->y, y);
             int blur = item->blur ? item->blur->computeLength<int>(state.cssToLengthConversionData()) : 0;
-            if (item->blur && item->blur->isViewportPercentageLength())
-                blur = viewportPercentageValue(*item->blur, blur);
             int spread = item->spread ? item->spread->computeLength<int>(state.cssToLengthConversionData()) : 0;
-            if (item->spread && item->spread->isViewportPercentageLength())
-                spread = viewportPercentageValue(*item->spread, spread);
             ShadowStyle shadowStyle = item->style && item->style->getValueID() == CSSValueInset ? Inset : Normal;
             Color color;
             if (item->color)
@@ -3236,7 +3259,7 @@ void StyleResolver::addViewportDependentMediaQueryResult(const MediaQueryExp* ex
     m_viewportDependentMediaQueryResults.append(std::make_unique<MediaQueryResult>(*expr, result));
 }
 
-bool StyleResolver::affectedByViewportChange() const
+bool StyleResolver::hasMediaQueriesAffectedByViewportChange() const
 {
     unsigned s = m_viewportDependentMediaQueryResults.size();
     for (unsigned i = 0; i < s; i++) {
@@ -3415,15 +3438,9 @@ bool StyleResolver::createFilterOperations(CSSValue* inValue, FilterOperations&
 
             CSSShadowValue* item = toCSSShadowValue(cssValue);
             int x = item->x->computeLength<int>(state.cssToLengthConversionData());
-            if (item->x->isViewportPercentageLength())
-                x = viewportPercentageValue(*item->x, x);
             int y = item->y->computeLength<int>(state.cssToLengthConversionData());
-            if (item->y->isViewportPercentageLength())
-                y = viewportPercentageValue(*item->y, y);
             IntPoint location(x, y);
             int blur = item->blur ? item->blur->computeLength<int>(state.cssToLengthConversionData()) : 0;
-            if (item->blur && item->blur->isViewportPercentageLength())
-                blur = viewportPercentageValue(*item->blur, blur);
             Color color;
             if (item->color)
                 color = colorFromPrimitiveValue(item->color.get());
@@ -3623,24 +3640,6 @@ StyleResolver::MatchedProperties::~MatchedProperties()
 {
 }
 
-int StyleResolver::viewportPercentageValue(CSSPrimitiveValue& unit, int percentage)
-{
-    int viewPortHeight = document().renderView()->viewportSizeForCSSViewportUnits().height() * percentage / 100.0f;
-    int viewPortWidth = document().renderView()->viewportSizeForCSSViewportUnits().width() * percentage / 100.0f;
-
-    if (unit.isViewportPercentageHeight())
-        return viewPortHeight;
-    if (unit.isViewportPercentageWidth())
-        return viewPortWidth;
-    if (unit.isViewportPercentageMax())
-        return std::max(viewPortWidth, viewPortHeight);
-    if (unit.isViewportPercentageMin())
-        return std::min(viewPortWidth, viewPortHeight);
-
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
 StyleResolver::CascadedProperties::CascadedProperties(TextDirection direction, WritingMode writingMode)
     : m_direction(direction)
     , m_writingMode(writingMode)
index c72c43d..3bb710a 100644 (file)
@@ -220,7 +220,7 @@ public:
 
     void addViewportDependentMediaQueryResult(const MediaQueryExp*, bool result);
     bool hasViewportDependentMediaQueries() const { return !m_viewportDependentMediaQueryResults.isEmpty(); }
-    bool affectedByViewportChange() const;
+    bool hasMediaQueriesAffectedByViewportChange() const;
 
     void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>);
 
@@ -232,6 +232,8 @@ public:
     
     void invalidateMatchedPropertiesCache();
 
+    void clearCachedPropertiesAffectedByViewportUnits();
+
 #if ENABLE(CSS_FILTERS)
     bool createFilterOperations(CSSValue* inValue, FilterOperations& outOperations);
     void loadPendingSVGDocuments();
@@ -239,8 +241,6 @@ public:
 
     void loadPendingResources();
 
-    int viewportPercentageValue(CSSPrimitiveValue& unit, int percentage);
-
     struct RuleRange {
         RuleRange(int& firstRuleIndex, int& lastRuleIndex): firstRuleIndex(firstRuleIndex), lastRuleIndex(lastRuleIndex) { }
         int& firstRuleIndex;
@@ -333,19 +333,22 @@ public:
         WTF_MAKE_NONCOPYABLE(State);
     public:
         State()
-        : m_element(0)
-        , m_styledElement(0)
-        , m_parentStyle(0)
-        , m_rootElementStyle(0)
-        , m_regionForStyling(0)
-        , m_elementLinkState(NotInsideLink)
-        , m_elementAffectedByClassRules(false)
-        , m_applyPropertyToRegularStyle(true)
-        , m_applyPropertyToVisitedLinkStyle(false)
-        , m_lineHeightValue(0)
-        , m_fontDirty(false)
-        , m_hasUAAppearance(false)
-        , m_backgroundData(BackgroundFillLayer) { }
+            : m_element(nullptr)
+            , m_styledElement(nullptr)
+            , m_parentStyle(nullptr)
+            , m_rootElementStyle(nullptr)
+            , m_regionForStyling(nullptr)
+            , m_elementLinkState(NotInsideLink)
+            , m_elementAffectedByClassRules(false)
+            , m_applyPropertyToRegularStyle(true)
+            , m_applyPropertyToVisitedLinkStyle(false)
+            , m_lineHeightValue(nullptr)
+            , m_fontDirty(false)
+            , m_fontSizeHasViewportUnits(false)
+            , m_hasUAAppearance(false)
+            , m_backgroundData(BackgroundFillLayer)
+        {
+        }
 
     public:
         void initElement(Element*);
@@ -355,11 +358,7 @@ public:
         Document& document() const { return m_element->document(); }
         Element* element() const { return m_element; }
         StyledElement* styledElement() const { return m_styledElement; }
-        void setStyle(PassRef<RenderStyle> style)
-        {
-            m_style = std::move(style);
-            m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle);
-        }
+        void setStyle(PassRef<RenderStyle>);
         RenderStyle* style() const { return m_style.get(); }
         PassRef<RenderStyle> takeStyle() { return m_style.releaseNonNull(); }
 
@@ -385,6 +384,8 @@ public:
         CSSValue* lineHeightValue() { return m_lineHeightValue; }
         void setFontDirty(bool isDirty) { m_fontDirty = isDirty; }
         bool fontDirty() const { return m_fontDirty; }
+        void setFontSizeHasViewportUnits(bool hasViewportUnits) { m_fontSizeHasViewportUnits = hasViewportUnits; }
+        bool fontSizeHasViewportUnits() const { return m_fontSizeHasViewportUnits; }
 
         void cacheBorderAndBackground();
         bool hasUAAppearance() const { return m_hasUAAppearance; }
@@ -405,9 +406,8 @@ public:
         CSSToLengthConversionData cssToLengthConversionData() const { return m_cssToLengthConversionData; }
 
     private:
-        // FIXME(bug 108563): to make it easier to review, these member
-        // variables are public. However we should add methods to access
-        // these variables.
+        void updateConversionData();
+
         Element* m_element;
         RefPtr<RenderStyle> m_style;
         StyledElement* m_styledElement;
@@ -430,6 +430,7 @@ public:
 #endif
         CSSValue* m_lineHeightValue;
         bool m_fontDirty;
+        bool m_fontSizeHasViewportUnits;
 
         bool m_hasUAAppearance;
         BorderData m_borderData;
index 837ea51..74c0d28 100644 (file)
@@ -78,7 +78,7 @@ static TransformOperation::OperationType transformOperationType(WebKitCSSTransfo
 
 static Length convertToFloatLength(const CSSPrimitiveValue* primitiveValue, const CSSToLengthConversionData& conversionData)
 {
-    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(conversionData) : Length(Undefined);
+    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion>(conversionData) : Length(Undefined);
 }
 
 bool transformsForValue(CSSValue* value, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations)
index c7ae5fe..eb45ab8 100644 (file)
 #include "PointerLockController.h"
 #include "PopStateEvent.h"
 #include "ProcessingInstruction.h"
+#include "RenderChildIterator.h"
 #include "RenderLayerCompositor.h"
 #include "RenderView.h"
 #include "RenderWidget.h"
@@ -513,6 +514,7 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig
     , m_disabledFieldsetElementsCount(0)
     , m_hasInjectedPlugInsScript(false)
     , m_renderTreeBeingDestroyed(false)
+    , m_hasStyleWithViewportUnits(false)
 {
     allDocuments().add(this);
 
@@ -1872,7 +1874,6 @@ bool Document::isPageBoxVisible(int pageIndex)
 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
 {
     RefPtr<RenderStyle> style = ensureStyleResolver().styleForPage(pageIndex);
-    RenderView* view = renderView();
 
     int width = pageSize.width();
     int height = pageSize.height();
@@ -1891,8 +1892,8 @@ void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
         LengthSize size = style->pageSize();
         ASSERT(size.width().isFixed());
         ASSERT(size.height().isFixed());
-        width = valueForLength(size.width(), 0, view);
-        height = valueForLength(size.height(), 0, view);
+        width = valueForLength(size.width(), 0);
+        height = valueForLength(size.height(), 0);
         break;
     }
     default:
@@ -1902,10 +1903,10 @@ void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
 
     // The percentage is calculated with respect to the width even for margin top and bottom.
     // http://www.w3.org/TR/CSS2/box.html#margin-properties
-    marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(style->marginTop(), width, view);
-    marginRight = style->marginRight().isAuto() ? marginRight : intValueForLength(style->marginRight(), width, view);
-    marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLength(style->marginBottom(), width, view);
-    marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width, view);
+    marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(style->marginTop(), width);
+    marginRight = style->marginRight().isAuto() ? marginRight : intValueForLength(style->marginRight(), width);
+    marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLength(style->marginBottom(), width);
+    marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width);
 }
 
 void Document::createStyleResolver()
@@ -3172,6 +3173,21 @@ void Document::scheduleOptimizedStyleSheetUpdate()
     m_optimizedStyleSheetUpdateTimer.startOneShot(0);
 }
 
+void Document::updateViewportUnitsOnResize()
+{
+    if (!hasStyleWithViewportUnits())
+        return;
+
+    ensureStyleResolver().clearCachedPropertiesAffectedByViewportUnits();
+
+    // FIXME: Ideally, we should save the list of elements that have viewport units and only iterate over those.
+    for (Element* element = ElementTraversal::firstWithin(&rootNode()); element; element = ElementTraversal::nextIncludingPseudo(element)) {
+        auto* renderer = element->renderer();
+        if (renderer && renderer->style().hasViewportUnits())
+            element->setNeedsStyleRecalc(InlineStyleChange);
+    }
+}
+
 void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag)
 {
     if (m_optimizedStyleSheetUpdateTimer.isActive())
index b07b501..07c3018 100644 (file)
@@ -1273,6 +1273,10 @@ public:
     virtual bool unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) override;
 #endif
 
+    void setHasStyleWithViewportUnits() { m_hasStyleWithViewportUnits = true; }
+    bool hasStyleWithViewportUnits() const { return m_hasStyleWithViewportUnits; }
+    void updateViewportUnitsOnResize();
+
 protected:
     enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
     Document(Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
@@ -1691,6 +1695,8 @@ private:
 
     bool m_hasInjectedPlugInsScript;
     bool m_renderTreeBeingDestroyed;
+
+    bool m_hasStyleWithViewportUnits;
 };
 
 inline void Document::notifyRemovePendingSheetIfNeeded()
index 65c431d..b37956c 100644 (file)
@@ -143,30 +143,29 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const
     }
 
     Path path;
-    RenderView* renderView = document().renderView();
     switch (shape) {
         case Poly:
             if (m_coordsLen >= 6) {
                 int numPoints = m_coordsLen / 2;
-                path.moveTo(FloatPoint(minimumValueForLength(m_coords[0], width, renderView), minimumValueForLength(m_coords[1], height, renderView)));
+                path.moveTo(FloatPoint(minimumValueForLength(m_coords[0], width), minimumValueForLength(m_coords[1], height)));
                 for (int i = 1; i < numPoints; ++i)
-                    path.addLineTo(FloatPoint(minimumValueForLength(m_coords[i * 2], width, renderView), minimumValueForLength(m_coords[i * 2 + 1], height, renderView)));
+                    path.addLineTo(FloatPoint(minimumValueForLength(m_coords[i * 2], width), minimumValueForLength(m_coords[i * 2 + 1], height)));
                 path.closeSubpath();
             }
             break;
         case Circle:
             if (m_coordsLen >= 3) {
                 Length radius = m_coords[2];
-                int r = std::min(minimumValueForLength(radius, width, renderView), minimumValueForLength(radius, height, renderView));
-                path.addEllipse(FloatRect(minimumValueForLength(m_coords[0], width, renderView) - r, minimumValueForLength(m_coords[1], height, renderView) - r, 2 * r, 2 * r));
+                int r = std::min(minimumValueForLength(radius, width), minimumValueForLength(radius, height));
+                path.addEllipse(FloatRect(minimumValueForLength(m_coords[0], width) - r, minimumValueForLength(m_coords[1], height) - r, 2 * r, 2 * r));
             }
             break;
         case Rect:
             if (m_coordsLen >= 4) {
-                int x0 = minimumValueForLength(m_coords[0], width, renderView);
-                int y0 = minimumValueForLength(m_coords[1], height, renderView);
-                int x1 = minimumValueForLength(m_coords[2], width, renderView);
-                int y1 = minimumValueForLength(m_coords[3], height, renderView);
+                int x0 = minimumValueForLength(m_coords[0], width);
+                int y0 = minimumValueForLength(m_coords[1], height);
+                int x1 = minimumValueForLength(m_coords[2], width);
+                int y1 = minimumValueForLength(m_coords[3], height);
                 path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
             }
             break;
index daba767..780f599 100644 (file)
@@ -1144,7 +1144,7 @@ void FrameView::layout(bool allowSubtree)
 
         // Viewport-dependent media queries may cause us to need completely different style information.
         StyleResolver* styleResolver = document.styleResolverIfExists();
-        if (!styleResolver || styleResolver->affectedByViewportChange()) {
+        if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
             document.styleResolverChanged(DeferRecalcStyle);
             // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
             InspectorInstrumentation::mediaQueryResultChanged(&document);
@@ -1247,6 +1247,8 @@ void FrameView::layout(bool allowSubtree)
                         bodyRenderer->setChildNeedsLayout();
                     else if (rootRenderer && rootRenderer->stretchesToViewport())
                         rootRenderer->setChildNeedsLayout();
+
+                    document.updateViewportUnitsOnResize();
                 }
             }
 
index ebdd68d..3cc0367 100644 (file)
@@ -37,12 +37,11 @@ enum LengthType {
     Intrinsic, MinIntrinsic,
     MinContent, MaxContent, FillAvailable, FitContent,
     Calculated,
-    ViewportPercentageWidth, ViewportPercentageHeight, ViewportPercentageMin, ViewportPercentageMax,
     Undefined
 };
 
-class CalculationValue;    
-    
+class CalculationValue;
+
 struct Length {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -105,7 +104,6 @@ public:
     bool isIntrinsicOrAuto() const;
     bool isSpecified() const;
     bool isSpecifiedOrIntrinsic() const;
-    bool isViewportPercentage() const;
 
     // Blend two lengths to produce a new length that is in between them. Used for animation.
     // FIXME: Why is this a member function?
@@ -263,12 +261,6 @@ inline float Length::percent() const
     return value();
 }
 
-inline float Length::viewportPercentageLength() const
-{
-    ASSERT(isViewportPercentage());
-    return value();
-}
-
 inline LengthType Length::type() const
 {
     return static_cast<LengthType>(m_type);
@@ -397,7 +389,7 @@ inline bool Length::isIntrinsicOrAuto() const
 
 inline bool Length::isSpecified() const
 {
-    return isFixed() || isPercent() || isViewportPercentage();
+    return isFixed() || isPercent();
 }
 
 inline bool Length::isSpecifiedOrIntrinsic() const
@@ -405,11 +397,6 @@ inline bool Length::isSpecifiedOrIntrinsic() const
     return isSpecified() || isIntrinsic();
 }
 
-inline bool Length::isViewportPercentage() const
-{
-    return type() >= ViewportPercentageWidth && type() <= ViewportPercentageMax;
-}
-
 // FIXME: Does this need to be in the header? Is it valuable to inline? Does it get inlined?
 inline Length Length::blend(const Length& from, double progress) const
 {
index 4ba151f..af60a98 100644 (file)
@@ -102,11 +102,11 @@ public:
 
     const BasicShape* basicShape() const { return m_shape.get(); }
     WindRule windRule() const { return m_shape->windRule(); }
-    const Path pathForReferenceRect(const FloatRect& boundingRect, RenderView* view) const
+    const Path pathForReferenceRect(const FloatRect& boundingRect) const
     {
         ASSERT(m_shape);
         Path path;
-        m_shape->path(path, boundingRect, view);
+        m_shape->path(path, boundingRect);
         return path;
     }
 
@@ -140,7 +140,7 @@ public:
         return adoptRef(new BoxClipPathOperation(referenceBox));
     }
 
-    const Path pathForReferenceRect(const RoundedRect& boundingRect, RenderView*) const
+    const Path pathForReferenceRect(const RoundedRect& boundingRect) const
     {
         Path path;
         path.addRoundedRect(boundingRect);
index 33bac70..3edf008 100644 (file)
@@ -1239,7 +1239,7 @@ void RenderBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, R
 {
     // FIXME: Technically percentage height objects only need a relayout if their percentage isn't going to be turned into
     // an auto value. Add a method to determine this, so that we can avoid the relayout.
-    if (relayoutChildren || (child.hasRelativeLogicalHeight() && !isRenderView()) || child.hasViewportPercentageLogicalHeight())
+    if (relayoutChildren || (child.hasRelativeLogicalHeight() && !isRenderView()))
         child.setChildNeedsLayout(MarkOnlyThis);
 
     // If relayoutChildren is set and the child has percentage padding or an embedded content box, we also need to invalidate the childs pref widths.
@@ -2541,7 +2541,7 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
             case CSSBoxType::ViewBox:
                 referenceBoxRect = borderBoxRect();
             }
-            if (!clipPath->pathForReferenceRect(referenceBoxRect, &view()).contains(locationInContainer.point() - localOffset, clipPath->windRule()))
+            if (!clipPath->pathForReferenceRect(referenceBoxRect).contains(locationInContainer.point() - localOffset, clipPath->windRule()))
                 return false;
             break;
         }
@@ -2572,7 +2572,7 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
     if (!isRenderView() && style().hasBorderRadius()) {
         LayoutRect borderRect = borderBoxRect();
         borderRect.moveBy(adjustedLocation);
-        RoundedRect border = style().getRoundedBorderFor(borderRect, &view());
+        RoundedRect border = style().getRoundedBorderFor(borderRect);
         if (!locationInContainer.intersects(border))
             return false;
     }
@@ -3340,11 +3340,11 @@ LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
     if (firstLine && document().styleSheetCollection().usesFirstLineRules()) {
         RenderStyle& s = firstLine ? firstLineStyle() : style();
         if (&s != &style())
-            return s.computedLineHeight(&view());
+            return s.computedLineHeight();
     }
     
     if (m_lineHeight == -1)
-        m_lineHeight = style().computedLineHeight(&view());
+        m_lineHeight = style().computedLineHeight();
 
     return m_lineHeight;
 }
index 2c2a34a..181a823 100644 (file)
@@ -1242,7 +1242,7 @@ void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai
         // To avoid the background color bleeding out behind the border, we'll render background and border
         // into a transparency layer, and then clip that in one go (which requires setting up the clip before
         // beginning the layer).
-        RoundedRect border = style().getRoundedBorderFor(paintRect, &view());
+        RoundedRect border = style().getRoundedBorderFor(paintRect);
         stateSaver.save();
         paintInfo.context->clipRoundedRect(FloatRoundedRect(border));
         paintInfo.context->beginTransparencyLayer(1);
@@ -2731,8 +2731,6 @@ LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length&
         return height.value();
     if (height.isPercent())
         return computePercentageLogicalHeight(height);
-    if (height.isViewportPercentage())
-        return valueForLength(height, 0);
     return -1;
 }
 
@@ -2818,17 +2816,6 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const
             LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
             availableHeight = std::max<LayoutUnit>(0, contentBoxHeight);
         }
-    } else if (cbstyle.logicalHeight().isViewportPercentage()) {
-        LayoutUnit heightWithScrollbar = valueForLength(cbstyle.logicalHeight(), 0);
-        if (heightWithScrollbar != -1) {
-            LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(heightWithScrollbar);
-            // We need to adjust for min/max height because this method does 
-            // not handle the min/max of the current block, its caller does.
-            // So the return value from the recursive call will not have been
-            // adjusted yet.
-            LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
-            availableHeight = std::max<LayoutUnit>(0, contentBoxHeight);
-        }
     } else if (isOutOfFlowPositionedWithSpecifiedHeight) {
         // Don't allow this to affect the block' height() member variable, since this
         // can get called while the block is still laying out its kids.
@@ -2878,11 +2865,6 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) cons
             LayoutUnit availableLogicalWidth = 0;
             return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalWidth, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth();
         }
-        case ViewportPercentageWidth:
-        case ViewportPercentageHeight:
-        case ViewportPercentageMin:
-        case ViewportPercentageMax:
-            return adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, 0));
         case FitContent:
         case FillAvailable:
         case Percent: 
@@ -2976,11 +2958,6 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co
             }
             return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, availableHeight));
         }
-        case ViewportPercentageWidth:
-        case ViewportPercentageHeight:
-        case ViewportPercentageMin:
-        case ViewportPercentageMax:
-            return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, 0));
         default:
             return intrinsicLogicalHeight();
     }
@@ -4731,13 +4708,6 @@ bool RenderBox::hasRelativeLogicalHeight() const
             || style().logicalMaxHeight().isPercent();
 }
 
-bool RenderBox::hasViewportPercentageLogicalHeight() const
-{
-    return style().logicalHeight().isViewportPercentage()
-        || style().logicalMinHeight().isViewportPercentage()
-        || style().logicalMaxHeight().isViewportPercentage();
-}
-
 static void markBoxForRelayoutAfterSplit(RenderBox* box)
 {
     // FIXME: The table code should handle that automatically. If not,
index 84085ef..e33fb9d 100644 (file)
@@ -570,7 +570,6 @@ public:
 
     virtual bool hasRelativeDimensions() const;
     virtual bool hasRelativeLogicalHeight() const;
-    bool hasViewportPercentageLogicalHeight() const;
 
     bool hasHorizontalLayoutOverflow() const
     {
index 03fe9a1..06c521c 100644 (file)
@@ -510,9 +510,9 @@ LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding) const
 RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& borderRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
     bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
 {
-    RoundedRect border = style().getRoundedBorderFor(borderRect, &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
+    RoundedRect border = style().getRoundedBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
     if (box && (box->nextLineBox() || box->prevLineBox())) {
-        RoundedRect segmentBorder = style().getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
+        RoundedRect segmentBorder = style().getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightEdge);
         border.setRadii(segmentBorder.radii());
     }
     return border;
@@ -952,12 +952,12 @@ LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLaye
 
             if (layerWidth.isFixed())
                 tileSize.setWidth(layerWidth.value());
-            else if (layerWidth.isPercent() || layerWidth.isViewportPercentage())
+            else if (layerWidth.isPercent())
                 tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.width()));
             
             if (layerHeight.isFixed())
                 tileSize.setHeight(layerHeight.value());
-            else if (layerHeight.isPercent() || layerHeight.isViewportPercentage())
+            else if (layerHeight.isPercent())
                 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.height()));
 
             // If one of the values is auto we have to use the appropriate
@@ -1228,13 +1228,13 @@ void RenderBoxModelObject::getGeometryForBackgroundImage(const RenderLayerModelO
     destRect = geometry.destRect();
 }
 
-static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent, RenderView* renderView)
+static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent)
 {
     if (borderSlice.isRelative())
         return borderSlice.value() * borderSide;
     if (borderSlice.isAuto())
         return imageSide;
-    return valueForLength(borderSlice, boxExtent, renderView);
+    return valueForLength(borderSlice, boxExtent);
 }
 
 bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const LayoutRect& rect, const RenderStyle& style,
@@ -1264,7 +1264,6 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
 
     LayoutUnit imageWidth = imageSize.width();
     LayoutUnit imageHeight = imageSize.height();
-    RenderView* renderView = &view();
 
     float imageScaleFactor = styleImage->imageScaleFactor();
     LayoutUnit topSlice = std::min<LayoutUnit>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight)) * imageScaleFactor;
@@ -1275,11 +1274,11 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
     ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
     ENinePieceImageRule vRule = ninePieceImage.verticalRule();
 
-    LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style.borderTopWidth(), topSlice, borderImageRect.height(), renderView);
-    LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style.borderRightWidth(), rightSlice, borderImageRect.width(), renderView);
-    LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style.borderBottomWidth(), bottomSlice, borderImageRect.height(), renderView);
-    LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style.borderLeftWidth(), leftSlice, borderImageRect.width(), renderView);
-    
+    LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style.borderTopWidth(), topSlice, borderImageRect.height());
+    LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style.borderRightWidth(), rightSlice, borderImageRect.width());
+    LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style.borderBottomWidth(), bottomSlice, borderImageRect.height());
+    LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style.borderLeftWidth(), leftSlice, borderImageRect.width());
+
     // Reduce the widths if they're too large.
     // The spec says: Given Lwidth as the width of the border image area, Lheight as its height, and Wside as the border image width
     // offset for the side, let f = min(Lwidth/(Wleft+Wright), Lheight/(Wtop+Wbottom)). If f < 1, then all W are reduced by
@@ -1728,7 +1727,7 @@ void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect&
 
     BorderEdge edges[4];
     BorderEdge::getBorderEdgeInfo(edges, style, document().deviceScaleFactor(), includeLogicalLeftEdge, includeLogicalRightEdge);
-    RoundedRect outerBorder = style.getRoundedBorderFor(rect, &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
+    RoundedRect outerBorder = style.getRoundedBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
     RoundedRect innerBorder = style.getRoundedInnerBorderFor(borderInnerRectAdjustedForBleedAvoidance(*graphicsContext, rect, bleedAvoidance), includeLogicalLeftEdge, includeLogicalRightEdge);
 
     bool haveAlphaColor = false;
@@ -2370,7 +2369,7 @@ void RenderBoxModelObject::paintBoxShadow(const PaintInfo& info, const LayoutRec
         return;
 
     RoundedRect border = (shadowStyle == Inset) ? style.getRoundedInnerBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge)
-        : style.getRoundedBorderFor(paintRect, &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
+        : style.getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge);
 
     bool hasBorderRadius = style.hasBorderRadius();
     bool isHorizontal = style.isHorizontalWritingMode();
index 241790f..b49ba1e 100644 (file)
@@ -1244,7 +1244,7 @@ bool RenderElement::repaintAfterLayoutIfNeeded(const RenderLayerModelObject* rep
         LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : LayoutUnit::fromPixel(0);
         LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit();
         LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadowExtent.right(), std::min<LayoutUnit>(newBounds.width(), oldBounds.width()));
-        LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight, std::max<LayoutUnit>(valueForLength(style().borderTopRightRadius().width(), boxWidth, &view()), valueForLength(style().borderBottomRightRadius().width(), boxWidth)));
+        LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight, std::max<LayoutUnit>(valueForLength(style().borderTopRightRadius().width(), boxWidth), valueForLength(style().borderBottomRightRadius().width(), boxWidth)));
         LayoutUnit decorationsWidth = std::max<LayoutUnit>(-outlineStyle.outlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(outlineWidth, shadowRight);
         LayoutRect rightRect(newOutlineBox.x() + std::min(newOutlineBox.width(), oldOutlineBox.width()) - decorationsWidth,
             newOutlineBox.y(),
index bf2f7be..7b7906f 100644 (file)
@@ -176,7 +176,7 @@ protected:
     enum StylePropagationType { PropagateToAllChildren, PropagateToBlockChildrenOnly };
     void propagateStyleToAnonymousChildren(StylePropagationType);
 
-    LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false) const;
+    LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue) const;
     LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false) const;
 
     void setFirstChild(RenderObject* child) { m_firstChild = child; }
@@ -266,14 +266,14 @@ inline void RenderElement::setChildNeedsLayout(MarkingBehavior markParents)
         markContainingBlocksForLayout();
 }
 
-inline LayoutUnit RenderElement::valueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
+inline LayoutUnit RenderElement::valueForLength(const Length& length, LayoutUnit maximumValue) const
 {
-    return WebCore::valueForLength(length, maximumValue, &view(), roundPercentages);
+    return WebCore::valueForLength(length, maximumValue);
 }
 
 inline LayoutUnit RenderElement::minimumValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
 {
-    return WebCore::minimumValueForLength(length, maximumValue, &view(), roundPercentages);
+    return WebCore::minimumValueForLength(length, maximumValue, roundPercentages);
 }
 
 inline bool RenderElement::isRenderLayerModelObject() const
index 75e8beb..21bc28e 100644 (file)
@@ -815,7 +815,7 @@ void RenderGrid::layoutGridItems()
 
         LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForChild(child, ForColumns, sizingData.columnTracks);
         LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadthForChild(child, ForRows, sizingData.rowTracks);
-        if (oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth || (oldOverrideContainingBlockContentLogicalHeight != overrideContainingBlockContentLogicalHeight && (child->hasRelativeLogicalHeight() || child->hasViewportPercentageLogicalHeight())))
+        if (oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth || (oldOverrideContainingBlockContentLogicalHeight != overrideContainingBlockContentLogicalHeight && child->hasRelativeLogicalHeight()))
             child->setNeedsLayout(MarkOnlyThis);
 
         child->setOverrideContainingBlockContentLogicalWidth(overrideContainingBlockContentLogicalWidth);
index 843e177..6ea74a1 100644 (file)
@@ -739,8 +739,6 @@ static LayoutUnit computeMargin(const RenderInline* renderer, const Length& marg
         return margin.value();
     if (margin.isPercent())
         return minimumValueForLength(margin, std::max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
-    if (margin.isViewportPercentage())
-        return valueForLength(margin, 0, &renderer->view());
     return 0;
 }
 
@@ -1399,10 +1397,10 @@ LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio
     if (firstLine && document().styleSheetCollection().usesFirstLineRules()) {
         const RenderStyle& firstLineStyle = this->firstLineStyle();
         if (&firstLineStyle != &style())
-            return firstLineStyle.computedLineHeight(&view());
+            return firstLineStyle.computedLineHeight();
     }
 
-    return style().computedLineHeight(&view());
+    return style().computedLineHeight();
 }
 
 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
index e140c27..12a3f30 100644 (file)
@@ -3829,7 +3829,7 @@ bool RenderLayer::setupClipPath(GraphicsContext* context, const LayerPaintingInf
 
         LayoutRect referenceBox = computeReferenceBox(renderer(), clippingPath, offsetFromRoot, rootRelativeBounds);
         context->save();
-        context->clipPath(clippingPath.pathForReferenceRect(referenceBox, &m_renderer.view()), clippingPath.windRule());
+        context->clipPath(clippingPath.pathForReferenceRect(referenceBox), clippingPath.windRule());
         return true;
     }
 
@@ -3840,7 +3840,7 @@ bool RenderLayer::setupClipPath(GraphicsContext* context, const LayerPaintingInf
         shapeRect.moveBy(offsetFromRoot);
 
         context->save();
-        context->clipPath(clippingPath.pathForReferenceRect(shapeRect, &m_renderer.view()), RULE_NONZERO);
+        context->clipPath(clippingPath.pathForReferenceRect(shapeRect), RULE_NONZERO);
         return true;
     }
 
index 80886ac..0a27cd5 100644 (file)
@@ -58,11 +58,11 @@ LayoutUnit RenderLineBreak::lineHeight(bool firstLine, LineDirectionMode /*direc
     if (firstLine && document().styleSheetCollection().usesFirstLineRules()) {
         const RenderStyle& firstLineStyle = this->firstLineStyle();
         if (&firstLineStyle != &style())
-            return firstLineStyle.computedLineHeight(&view());
+            return firstLineStyle.computedLineHeight();
     }
 
     if (m_cachedLineHeight == invalidLineHeight)
-        m_cachedLineHeight = style().computedLineHeight(&view());
+        m_cachedLineHeight = style().computedLineHeight();
     
     return m_cachedLineHeight;
 }
index 2cf2f5f..e6acda5 100644 (file)
@@ -79,10 +79,10 @@ void RenderScrollbarPart::layoutVerticalPart()
     } 
 }
 
-static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength, RenderView* renderView)
+static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength)
 {
     if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto()))
-        return minimumValueForLength(length, containingLength, renderView);
+        return minimumValueForLength(length, containingLength);
     return ScrollbarTheme::theme()->scrollbarThickness();
 }
 
@@ -90,36 +90,34 @@ void RenderScrollbarPart::computeScrollbarWidth()
 {
     if (!m_scrollbar->owningRenderer())
         return;
-    RenderView* renderView = &view();
     // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
     // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
     int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style().borderLeftWidth() - m_scrollbar->owningRenderer()->style().borderRightWidth();
-    int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width(), visibleSize, renderView);
-    int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth(), visibleSize, renderView);
-    int maxWidth = style().maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style().maxWidth(), visibleSize, renderView);
+    int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width(), visibleSize);
+    int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth(), visibleSize);
+    int maxWidth = style().maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style().maxWidth(), visibleSize);
     setWidth(std::max(minWidth, std::min(maxWidth, w)));
     
     // Buttons and track pieces can all have margins along the axis of the scrollbar. 
-    m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), visibleSize, renderView));
-    m_marginBox.setRight(minimumValueForLength(style().marginRight(), visibleSize, renderView));
+    m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), visibleSize));
+    m_marginBox.setRight(minimumValueForLength(style().marginRight(), visibleSize));
 }
 
 void RenderScrollbarPart::computeScrollbarHeight()
 {
     if (!m_scrollbar->owningRenderer())
         return;
-    RenderView* renderView = &view();
     // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
     // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
     int visibleSize = m_scrollbar->owningRenderer()->height() -  m_scrollbar->owningRenderer()->style().borderTopWidth() - m_scrollbar->owningRenderer()->style().borderBottomWidth();
-    int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height(), visibleSize, renderView);
-    int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight(), visibleSize, renderView);
-    int maxHeight = style().maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style().maxHeight(), visibleSize, renderView);
+    int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height(), visibleSize);
+    int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight(), visibleSize);
+    int maxHeight = style().maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style().maxHeight(), visibleSize);
     setHeight(std::max(minHeight, std::min(maxHeight, h)));
 
     // Buttons and track pieces can all have margins along the axis of the scrollbar. 
-    m_marginBox.setTop(minimumValueForLength(style().marginTop(), visibleSize, renderView));
-    m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), visibleSize, renderView));
+    m_marginBox.setTop(minimumValueForLength(style().marginTop(), visibleSize));
+    m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), visibleSize));
 }
 
 void RenderScrollbarPart::computePreferredLogicalWidths()
index ccb4cbf..4e483fc 100644 (file)
@@ -372,8 +372,6 @@ LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length&
         computedLogicalHeight = styleLogicalHeight.value() - borders;
     } else if (styleLogicalHeight.isPercent())
         computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeight);
-    else if (styleLogicalHeight.isViewportPercentage())
-        computedLogicalHeight = minimumValueForLength(styleLogicalHeight, 0);
     else
         ASSERT_NOT_REACHED();
     return std::max<LayoutUnit>(0, computedLogicalHeight);
@@ -785,13 +783,13 @@ void RenderTable::computePreferredLogicalWidths()
         m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, m_captions[i]->minPreferredLogicalWidth());
 
     RenderStyle& styleToUse = style();
-    // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for min-width.
+    // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for min-width.
     if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().value() > 0) {
         m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
         m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
     }
 
-    // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for maxWidth.
+    // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for maxWidth.
     if (styleToUse.logicalMaxWidth().isFixed()) {
         m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
         m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
index 644b1f2..fdcdcf0 100644 (file)
@@ -540,7 +540,7 @@ static void applyCommonButtonPaddingToStyle(RenderStyle* style, Element* element
 {
     Document& document = element->document();
     RefPtr<CSSPrimitiveValue> emSize = CSSPrimitiveValue::create(0.5, CSSPrimitiveValue::CSS_EMS);
-    int pixels = emSize->computeLength<int>(CSSToLengthConversionData(style, document.renderStyle(), document.frame()->pageZoomFactor()));
+    int pixels = emSize->computeLength<int>(CSSToLengthConversionData(style, document.renderStyle(), document.renderView(), document.frame()->pageZoomFactor()));
     style->setPaddingBox(LengthBox(0, pixels, 0, pixels));
 }
 
@@ -946,9 +946,10 @@ void RenderThemeIOS::adjustButtonStyle(StyleResolver* selector, RenderStyle* sty
 
     // Set padding: 0 1.0em; on buttons.
     // CSSPrimitiveValue::computeLengthInt only needs the element's style to calculate em lengths.
-    // Since the element might not be in a document, just pass nullptr for the root element style.
+    // Since the element might not be in a document, just pass nullptr for the root element style
+    // and the render view.
     RefPtr<CSSPrimitiveValue> emSize = CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::CSS_EMS);
-    int pixels = emSize->computeLength<int>(CSSToLengthConversionData(style, nullptr, 1.0, false));
+    int pixels = emSize->computeLength<int>(CSSToLengthConversionData(style, nullptr, nullptr, 1.0, false));
     style->setPaddingBox(LengthBox(0, pixels, 0, pixels));
 
     if (!element)
index 3ae8b9a..4a44eb7 100644 (file)
@@ -1216,7 +1216,7 @@ void RenderThemeMac::paintMenuListButtonGradients(const RenderObject& o, const P
 
     GraphicsContextStateSaver stateSaver(*paintInfo.context);
 
-    FloatRoundedRect border = FloatRoundedRect(o.style().getRoundedBorderFor(r, &o.view()));
+    FloatRoundedRect border = FloatRoundedRect(o.style().getRoundedBorderFor(r));
     int radius = border.radii().topLeft().width();
 
     CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
index 56c988c..0f39e7f 100644 (file)
@@ -330,13 +330,9 @@ void RenderView::layout()
 
         for (auto& box : childrenOfType<RenderBox>(*this)) {
             if (box.hasRelativeLogicalHeight()
-                || box.hasViewportPercentageLogicalHeight()
                 || box.style().logicalHeight().isPercent()
                 || box.style().logicalMinHeight().isPercent()
                 || box.style().logicalMaxHeight().isPercent()
-                || box.style().logicalHeight().isViewportPercentage()
-                || box.style().logicalMinHeight().isViewportPercentage()
-                || box.style().logicalMaxHeight().isViewportPercentage()
                 || box.isSVGRoot()
                 )
                 box.setChildNeedsLayout(MarkOnlyThis);
index dc6e5d8..446dd41 100644 (file)
@@ -978,7 +978,7 @@ LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio
                 lineHeight = renderer->style().computedLineHeight();
             else
                 lineHeight = renderer->lineHeight(firstLine, lineDirection);
-            verticalPosition -= valueForLength(renderer->style().verticalAlignLength(), lineHeight, &renderer->view());
+            verticalPosition -= valueForLength(renderer->style().verticalAlignLength(), lineHeight);
         }
     }
 
index ae665a3..8c713a4 100644 (file)
@@ -90,7 +90,7 @@ static inline FloatSize physicalSizeToLogical(const FloatSize& size, WritingMode
     return size.transposedSize();
 }
 
-std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin, RenderView* view)
+std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin)
 {
     ASSERT(basicShape);
 
@@ -103,9 +103,9 @@ std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const La
 
     case BasicShape::BasicShapeCircleType: {
         const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(basicShape);
-        float centerX = floatValueForCenterCoordinate(circle->centerX(), boxWidth, view);
-        float centerY = floatValueForCenterCoordinate(circle->centerY(), boxHeight, view);
-        float radius = circle->floatValueForRadiusInBox(boxWidth, boxHeight, view);
+        float centerX = floatValueForCenterCoordinate(circle->centerX(), boxWidth);
+        float centerY = floatValueForCenterCoordinate(circle->centerY(), boxHeight);
+        float radius = circle->floatValueForRadiusInBox(boxWidth, boxHeight);
         FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode);
 
         shape = createCircleShape(logicalCenter, radius);
@@ -114,10 +114,10 @@ std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const La
 
     case BasicShape::BasicShapeEllipseType: {
         const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape);
-        float centerX = floatValueForCenterCoordinate(ellipse->centerX(), boxWidth, view);
-        float centerY = floatValueForCenterCoordinate(ellipse->centerY(), boxHeight, view);
-        float radiusX = ellipse->floatValueForRadiusInBox(ellipse->radiusX(), centerX, boxWidth, view);
-        float radiusY = ellipse->floatValueForRadiusInBox(ellipse->radiusY(), centerY, boxHeight, view);
+        float centerX = floatValueForCenterCoordinate(ellipse->centerX(), boxWidth);
+        float centerY = floatValueForCenterCoordinate(ellipse->centerY(), boxHeight);
+        float radiusX = ellipse->floatValueForRadiusInBox(ellipse->radiusX(), centerX, boxWidth);
+        float radiusY = ellipse->floatValueForRadiusInBox(ellipse->radiusY(), centerY, boxHeight);
         FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode);
 
         shape = createEllipseShape(logicalCenter, FloatSize(radiusX, radiusY));
@@ -132,8 +132,8 @@ std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const La
         std::unique_ptr<Vector<FloatPoint>> vertices = std::make_unique<Vector<FloatPoint>>(valuesSize / 2);
         for (unsigned i = 0; i < valuesSize; i += 2) {
             FloatPoint vertex(
-                floatValueForLength(values.at(i), boxWidth, view),
-                floatValueForLength(values.at(i + 1), boxHeight, view));
+                floatValueForLength(values.at(i), boxWidth),
+                floatValueForLength(values.at(i + 1), boxHeight));
             (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxSize.height(), writingMode);
         }
 
@@ -143,19 +143,19 @@ std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const La
 
     case BasicShape::BasicShapeInsetType: {
         const BasicShapeInset& inset = *static_cast<const BasicShapeInset*>(basicShape);
-        float left = floatValueForLength(inset.left(), boxWidth, view);
-        float top = floatValueForLength(inset.top(), boxHeight, view);
+        float left = floatValueForLength(inset.left(), boxWidth);
+        float top = floatValueForLength(inset.top(), boxHeight);
         FloatRect rect(left,
             top,
-            std::max<float>(boxWidth - left - floatValueForLength(inset.right(), boxWidth, view), 0),
-            std::max<float>(boxHeight - top - floatValueForLength(inset.bottom(), boxHeight, view), 0));
+            std::max<float>(boxWidth - left - floatValueForLength(inset.right(), boxWidth), 0),
+            std::max<float>(boxHeight - top - floatValueForLength(inset.bottom(), boxHeight), 0));
         FloatRect logicalRect = physicalRectToLogical(rect, logicalBoxSize.height(), writingMode);
 
         FloatSize boxSize(boxWidth, boxHeight);
-        FloatSize topLeftRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.topLeftRadius(), boxSize, view), writingMode);
-        FloatSize topRightRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.topRightRadius(), boxSize, view), writingMode);
-        FloatSize bottomLeftRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.bottomLeftRadius(), boxSize, view), writingMode);
-        FloatSize bottomRightRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.bottomRightRadius(), boxSize, view), writingMode);
+        FloatSize topLeftRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.topLeftRadius(), boxSize), writingMode);
+        FloatSize topRightRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.topRightRadius(), boxSize), writingMode);
+        FloatSize bottomLeftRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.bottomLeftRadius(), boxSize), writingMode);
+        FloatSize bottomRightRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.bottomRightRadius(), boxSize), writingMode);
         FloatRoundedRect::Radii cornerRadii(topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
 
         cornerRadii.scale(calcBorderRadiiConstraintScaleFor(logicalRect, cornerRadii));
index 639bfc8..1435ffc 100644 (file)
@@ -49,7 +49,6 @@ struct LineSegment {
 
 class BasicShape;
 class Image;
-class RenderView;
 class RoundedRect;
 
 typedef Vector<LineSegment> SegmentList;
@@ -67,7 +66,7 @@ public:
         Path marginShape;
     };
 
-    static std::unique_ptr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, float margin, RenderView*);
+    static std::unique_ptr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, float margin);
     static std::unique_ptr<Shape> createRasterShape(Image*, float threshold, const LayoutRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin);
     static std::unique_ptr<Shape> createBoxShape(const RoundedRect&, WritingMode, float margin);
 
index acc504a..0555326 100644 (file)
@@ -174,14 +174,14 @@ const Shape& ShapeOutsideInfo::computedShape() const
     const RenderStyle& containingBlockStyle = m_renderer.containingBlock()->style();
 
     WritingMode writingMode = containingBlockStyle.writingMode();
-    float margin = floatValueForLength(m_renderer.style().shapeMargin(), m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : LayoutUnit(), &m_renderer.view());
+    float margin = floatValueForLength(m_renderer.style().shapeMargin(), m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : LayoutUnit());
     float shapeImageThreshold = style.shapeImageThreshold();
     const ShapeValue& shapeValue = *style.shapeOutside();
 
     switch (shapeValue.type()) {
     case ShapeValue::Shape:
         ASSERT(shapeValue.shape());
-        m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSize, writingMode, margin, &m_renderer.view());
+        m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSize, writingMode, margin);
         break;
     case ShapeValue::Image: {
         Image* image;
index 22e9761..1ecb2e6 100644 (file)
@@ -88,13 +88,13 @@ bool BasicShape::canBlend(const BasicShape* other) const
         && thisEllipse->radiusY().canBlend(otherEllipse->radiusY()));
 }
 
-float BasicShapeCircle::floatValueForRadiusInBox(float boxWidth, float boxHeight, RenderView* view) const
+float BasicShapeCircle::floatValueForRadiusInBox(float boxWidth, float boxHeight) const
 {
     if (m_radius.type() == BasicShapeRadius::Value)
         return floatValueForLength(m_radius.value(), sqrtf((boxWidth * boxWidth + boxHeight * boxHeight) / 2));
 
-    float centerX = floatValueForCenterCoordinate(m_centerX, boxWidth, view);
-    float centerY = floatValueForCenterCoordinate(m_centerY, boxHeight, view);
+    float centerX = floatValueForCenterCoordinate(m_centerX, boxWidth);
+    float centerY = floatValueForCenterCoordinate(m_centerY, boxHeight);
 
     if (m_radius.type() == BasicShapeRadius::ClosestSide)
         return std::min(std::min(centerX, boxWidth - centerX), std::min(centerY, boxHeight - centerY));
@@ -103,13 +103,13 @@ float BasicShapeCircle::floatValueForRadiusInBox(float boxWidth, float boxHeight
     return std::max(std::max(centerX, boxWidth - centerX), std::max(centerY, boxHeight - centerY));
 }
 
-void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox, RenderView* view)
+void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox)
 {
     ASSERT(path.isEmpty());
 
-    float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width(), view);
-    float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height(), view);
-    float radius = floatValueForRadiusInBox(boundingBox.width(), boundingBox.height(), view);
+    float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width());
+    float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height());
+    float radius = floatValueForRadiusInBox(boundingBox.width(), boundingBox.height());
     path.addEllipse(FloatRect(
         centerX - radius + boundingBox.x(),
         centerY - radius + boundingBox.y(),
@@ -130,10 +130,10 @@ PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double p
     return result.release();
 }
 
-float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius, float center, float boxWidthOrHeight, RenderView* view) const
+float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius, float center, float boxWidthOrHeight) const
 {
     if (radius.type() == BasicShapeRadius::Value)
-        return floatValueForLength(radius.value(), boxWidthOrHeight, view);
+        return floatValueForLength(radius.value(), boxWidthOrHeight);
 
     if (radius.type() == BasicShapeRadius::ClosestSide)
         return std::min(center, boxWidthOrHeight - center);
@@ -142,14 +142,14 @@ float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius
     return std::max(center, boxWidthOrHeight - center);
 }
 
-void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox, RenderView* view)
+void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
 {
     ASSERT(path.isEmpty());
 
-    float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width(), view);
-    float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height(), view);
-    float radiusX = floatValueForRadiusInBox(m_radiusX, centerX, boundingBox.width(), view);
-    float radiusY = floatValueForRadiusInBox(m_radiusY, centerY, boundingBox.height(), view);
+    float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width());
+    float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height());
+    float radiusX = floatValueForRadiusInBox(m_radiusX, centerX, boundingBox.width());
+    float radiusY = floatValueForRadiusInBox(m_radiusY, centerY, boundingBox.height());
     path.addEllipse(FloatRect(
         centerX - radiusX + boundingBox.x(),
         centerY - radiusY + boundingBox.y(),
@@ -179,7 +179,7 @@ PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double
     return result.release();
 }
 
-void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox, RenderView* view)
+void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox)
 {
     ASSERT(path.isEmpty());
     ASSERT(!(m_values.size() % 2));
@@ -188,11 +188,11 @@ void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox, RenderVie
     if (!length)
         return;
 
-    path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width(), view) + boundingBox.x(),
-        floatValueForLength(m_values.at(1), boundingBox.height(), view) + boundingBox.y()));
+    path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width()) + boundingBox.x(),
+        floatValueForLength(m_values.at(1), boundingBox.height()) + boundingBox.y()));
     for (size_t i = 2; i < length; i = i + 2) {
-        path.addLineTo(FloatPoint(floatValueForLength(m_values.at(i), boundingBox.width(), view) + boundingBox.x(),
-            floatValueForLength(m_values.at(i + 1), boundingBox.height(), view) + boundingBox.y()));
+        path.addLineTo(FloatPoint(floatValueForLength(m_values.at(i), boundingBox.width()) + boundingBox.x(),
+            floatValueForLength(m_values.at(i + 1), boundingBox.height()) + boundingBox.y()));
     }
     path.closeSubpath();
 }
@@ -220,28 +220,28 @@ PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape* other, double
     return result.release();
 }
 
-static FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatRect& boundingBox, RenderView* view)
+static FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatRect& boundingBox)
 {
-    return FloatSize(floatValueForLength(lengthSize.width(), boundingBox.width(), view),
-        floatValueForLength(lengthSize.height(), boundingBox.height(), view));
+    return FloatSize(floatValueForLength(lengthSize.width(), boundingBox.width()),
+        floatValueForLength(lengthSize.height(), boundingBox.height()));
 }
 
-void BasicShapeInset::path(Path& path, const FloatRect& boundingBox, RenderView* view)
+void BasicShapeInset::path(Path& path, const FloatRect& boundingBox)
 {
     ASSERT(path.isEmpty());
-    float left = floatValueForLength(m_left, boundingBox.width(), view);
-    float top = floatValueForLength(m_top, boundingBox.height(), view);
+    float left = floatValueForLength(m_left, boundingBox.width());
+    float top = floatValueForLength(m_top, boundingBox.height());
     FloatRoundedRect r = FloatRoundedRect(
         FloatRect(
             left + boundingBox.x(),
             top + boundingBox.y(),
-            std::max<float>(boundingBox.width() - left - floatValueForLength(m_right, boundingBox.width(), view), 0),
-            std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height(), view), 0)
+            std::max<float>(boundingBox.width() - left - floatValueForLength(m_right, boundingBox.width()), 0),
+            std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height()), 0)
         ),
-        floatSizeForLengthSize(m_topLeftRadius, boundingBox, view),
-        floatSizeForLengthSize(m_topRightRadius, boundingBox, view),
-        floatSizeForLengthSize(m_bottomLeftRadius, boundingBox, view),
-        floatSizeForLengthSize(m_bottomRightRadius, boundingBox, view)
+        floatSizeForLengthSize(m_topLeftRadius, boundingBox),
+        floatSizeForLengthSize(m_topRightRadius, boundingBox),
+        floatSizeForLengthSize(m_bottomLeftRadius, boundingBox),
+        floatSizeForLengthSize(m_bottomRightRadius, boundingBox)
     );
     path.addRoundedRect(r);
 }
index e28ad4d..8e18f46 100644 (file)
@@ -43,7 +43,6 @@ namespace WebCore {
 class FloatRect;
 class Path;
 class RenderBox;
-class RenderView;
 
 class BasicShape : public RefCounted<BasicShape> {
 public:
@@ -58,7 +57,7 @@ public:
 
     bool canBlend(const BasicShape*) const;
 
-    virtual void path(Path&, const FloatRect&, RenderView*) = 0;
+    virtual void path(Path&, const FloatRect&) = 0;
     virtual WindRule windRule() const { return RULE_NONZERO; }
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0;
 
@@ -152,13 +151,13 @@ public:
     const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
     const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
     const BasicShapeRadius& radius() const { return m_radius; }
-    float floatValueForRadiusInBox(float boxWidth, float boxHeight, RenderView*) const;
+    float floatValueForRadiusInBox(float boxWidth, float boxHeight) const;
 
     void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = std::move(centerX); }
     void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = std::move(centerY); }
     void setRadius(BasicShapeRadius radius) { m_radius = std::move(radius); }
 
-    virtual void path(Path&, const FloatRect&, RenderView*) override;
+    virtual void path(Path&, const FloatRect&) override;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
 
     virtual Type type() const override { return BasicShapeCircleType; }
@@ -178,14 +177,14 @@ public:
     const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
     const BasicShapeRadius& radiusX() const { return m_radiusX; }
     const BasicShapeRadius& radiusY() const { return m_radiusY; }
-    float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight, RenderView*) const;
+    float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const;
 
     void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = std::move(centerX); }
     void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = std::move(centerY); }
     void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = std::move(radiusX); }
     void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = std::move(radiusY); }
 
-    virtual void path(Path&, const FloatRect&, RenderView*) override;
+    virtual void path(Path&, const FloatRect&) override;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
 
     virtual Type type() const override { return BasicShapeEllipseType; }
@@ -209,7 +208,7 @@ public:
     void setWindRule(WindRule windRule) { m_windRule = windRule; }
     void appendPoint(Length x, Length y) { m_values.append(std::move(x)); m_values.append(std::move(y)); }
 
-    virtual void path(Path&, const FloatRect&, RenderView*) override;
+    virtual void path(Path&, const FloatRect&) override;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
 
     virtual WindRule windRule() const override { return m_windRule; }
@@ -248,7 +247,7 @@ public:
     void setBottomRightRadius(LengthSize radius) { m_bottomRightRadius = std::move(radius); }
     void setBottomLeftRadius(LengthSize radius) { m_bottomLeftRadius = std::move(radius); }
 
-    virtual void path(Path&, const FloatRect&, RenderView*) override;
+    virtual void path(Path&, const FloatRect&) override;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
 
     virtual Type type() const override { return BasicShapeInsetType; }
index 172a1ed..0877386 100644 (file)
@@ -1027,17 +1027,17 @@ void RenderStyle::setBoxShadow(std::unique_ptr<ShadowData> shadowData, bool add)
     rareData->m_boxShadow = std::move(shadowData);
 }
 
-static RoundedRect::Radii calcRadiiFor(const BorderData& border, const LayoutSize& size, RenderView* renderView)
+static RoundedRect::Radii calcRadiiFor(const BorderData& border, const LayoutSize& size)
 {
     return RoundedRect::Radii(
-        LayoutSize(valueForLength(border.topLeft().width(), size.width(), renderView),
-            valueForLength(border.topLeft().height(), size.height(), renderView)),
-        LayoutSize(valueForLength(border.topRight().width(), size.width(), renderView),
-            valueForLength(border.topRight().height(), size.height(), renderView)),
-        LayoutSize(valueForLength(border.bottomLeft().width(), size.width(), renderView),
-            valueForLength(border.bottomLeft().height(), size.height(), renderView)),
-        LayoutSize(valueForLength(border.bottomRight().width(), size.width(), renderView),
-            valueForLength(border.bottomRight().height(), size.height(), renderView)));
+        LayoutSize(valueForLength(border.topLeft().width(), size.width()),
+            valueForLength(border.topLeft().height(), size.height())),
+        LayoutSize(valueForLength(border.topRight().width(), size.width()),
+            valueForLength(border.topRight().height(), size.height())),
+        LayoutSize(valueForLength(border.bottomLeft().width(), size.width()),
+            valueForLength(border.bottomLeft().height(), size.height())),
+        LayoutSize(valueForLength(border.bottomRight().width(), size.width()),
+            valueForLength(border.bottomRight().height(), size.height())));
 }
 
 StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->listStyleImage.get(); }
@@ -1057,11 +1057,11 @@ short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo
 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v); }
 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v); }
 
-RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, RenderView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
+RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
 {
     RoundedRect roundedRect(borderRect);
     if (hasBorderRadius()) {
-        RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView);
+        RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size());
         radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii));
         roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
     }
@@ -1342,7 +1342,7 @@ Length RenderStyle::lineHeight() const
 }
 void RenderStyle::setLineHeight(Length specifiedLineHeight) { SET_VAR(inherited, line_height, specifiedLineHeight); }
 
-int RenderStyle::computedLineHeight(RenderView* renderView) const
+int RenderStyle::computedLineHeight() const
 {
     const Length& lh = lineHeight();
 
@@ -1353,9 +1353,6 @@ int RenderStyle::computedLineHeight(RenderView* renderView) const
     if (lh.isPercent())
         return minimumValueForLength(lh, fontSize());
 
-    if (lh.isViewportPercentage())
-        return valueForLength(lh, 0, renderView);
-
     return lh.value();
 }
 
index 19ba285..4b6840d 100644 (file)
@@ -176,7 +176,8 @@ public:
                 | pageBreakMask << pageBreakBeforeOffset
                 | pageBreakMask << pageBreakAfterOffset
                 | oneBitMask << explicitInheritanceOffset
-                | tableLayoutBitMask << tableLayoutOffset;
+                | tableLayoutBitMask << tableLayoutOffset
+                | hasViewportUnitsBitMask << hasViewportUnitsOffset;
 
             m_flags = (m_flags & ~nonInheritedMask) | (other.m_flags & nonInheritedMask);
         }
@@ -202,6 +203,9 @@ public:
         EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(getValue(unicodeBidiMask, unicodeBidiOffset)); }
         void setUnicodeBidi(EUnicodeBidi unicodeBidi) { updateValue(unicodeBidi, unicodeBidiMask, unicodeBidiOffset); }
 
+        bool hasViewportUnits() const { return getBoolean(hasViewportUnitsOffset); }
+        void setHasViewportUnits(bool value) { updateBoolean(value, hasViewportUnitsOffset); }
+
         EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(getValue(verticalAlignMask, verticalAlignOffset)); }
         void setVerticalAlign(EVerticalAlign verticalAlign) { updateValue(verticalAlign, verticalAlignMask, verticalAlignOffset); }
 
@@ -360,17 +364,19 @@ public:
 
         // Byte 6.
         static const unsigned pseudoBitsBitCount = 7;
-        static const unsigned pseudoBitsPadding = 1;
-        static const unsigned pseudoBitsAndPaddingBitCount = pseudoBitsBitCount + pseudoBitsPadding;
-        static const uint64_t pseudoBitsMask = (oneBitMask << pseudoBitsAndPaddingBitCount) - 1;
-        static const unsigned pseudoBitsOffset = verticalAlignOffset + verticalAlignAndPaddingBitCount;
+        static const uint64_t pseudoBitsMask = (oneBitMask << pseudoBitsBitCount) - 1;
+        static const unsigned pseudoBitsOffset = verticalAlignOffset + verticalAlignBitCount;
+
+        static const unsigned hasViewportUnitsBitCount = 1;
+        static const uint64_t hasViewportUnitsBitMask = (oneBitMask << hasViewportUnitsBitCount) - 1;
+        static const unsigned hasViewportUnitsOffset = pseudoBitsOffset + pseudoBitsBitCount;
 
         // Byte 7.
         static const unsigned styleTypeBitCount = 6;
         static const unsigned styleTypePadding = 2;
         static const unsigned styleTypeAndPaddingBitCount = styleTypeBitCount + styleTypePadding;
         static const uint64_t styleTypeMask = (oneBitMask << styleTypeAndPaddingBitCount) - 1;
-        static const unsigned styleTypeOffset = pseudoBitsOffset + pseudoBitsAndPaddingBitCount;
+        static const unsigned styleTypeOffset = hasViewportUnitsBitCount + hasViewportUnitsOffset;
 
         // Byte 8.
         static const unsigned isUniqueOffset = styleTypeOffset + styleTypeAndPaddingBitCount;
@@ -382,7 +388,8 @@ public:
         static const unsigned affectedByDragOffset = affectedByActiveOffset + 1;
         static const unsigned isLinkOffset = affectedByDragOffset + 1;
 
-        // Only 59 bits are assigned. There are 5 bits available currently used as padding to improve code generation.
+
+        // Only 60 bits are assigned. There are 4 bits available currently used as padding to improve code generation.
         // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom().
         uint64_t m_flags;
     };
@@ -470,7 +477,6 @@ protected:
     NonInheritedFlags noninherited_flags;
 
 // !END SYNC!
-
 private:
     // used to create the default style.
     ALWAYS_INLINE RenderStyle(bool);
@@ -502,6 +508,9 @@ public:
 
     const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
 
+    void setHasViewportUnits(bool hasViewportUnits = true) { noninherited_flags.setHasViewportUnits(hasViewportUnits); }
+    bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits(); }
+
     bool affectedByHover() const { return noninherited_flags.affectedByHover(); }
     bool affectedByActive() const { return noninherited_flags.affectedByActive(); }
     bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); }
@@ -721,7 +730,7 @@ public:
 
     const Length& specifiedLineHeight() const;
     Length lineHeight() const;
-    int computedLineHeight(RenderView* = 0) const;
+    int computedLineHeight() const;
 
     EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
     static bool autoWrap(EWhiteSpace ws)
@@ -1222,7 +1231,7 @@ public:
         setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
     }
     
-    RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
+    RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
     RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
 
     RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, LayoutUnit topWidth, LayoutUnit bottomWidth,
index 418c63a..03ee89a 100644 (file)
@@ -117,9 +117,9 @@ bool RenderSVGRoot::isEmbeddedThroughFrameContainingSVGDocument() const
     return frame().document()->isSVGDocument();
 }
 
-static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize, RenderView* renderView)
+static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize)
 {
-    return valueForLength(length, maxSize, renderView) * (length.isFixed() ? scale : 1);
+    return valueForLength(length, maxSize) * (length.isFixed() ? scale : 1);
 }
 
 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
@@ -135,7 +135,7 @@ LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred sho
         return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
 
     if (svgSVGElement().hasIntrinsicWidth())
-        return resolveLengthAttributeForSVG(svgSVGElement().intrinsicWidth(), style().effectiveZoom(), containingBlock()->availableLogicalWidth(), &view());
+        return resolveLengthAttributeForSVG(svgSVGElement().intrinsicWidth(), style().effectiveZoom(), containingBlock()->availableLogicalWidth());
 
     // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG.
     return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
@@ -154,7 +154,7 @@ LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const
         return RenderReplaced::computeReplacedLogicalHeight();
 
     if (svgSVGElement().hasIntrinsicHeight())
-        return resolveLengthAttributeForSVG(svgSVGElement().intrinsicHeight(), style().effectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPadding).toFloat(), &view());
+        return resolveLengthAttributeForSVG(svgSVGElement().intrinsicHeight(), style().effectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPadding).toFloat());
 
     // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG.
     return RenderReplaced::computeReplacedLogicalHeight();
index ca94104..9ab8a25 100644 (file)
@@ -153,7 +153,7 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderElement& renderer, Pai
             referenceBox.setHeight(viewportSize.height());
         } else
             referenceBox = renderer.objectBoundingBox();
-        m_paintInfo->context->clipPath(clipPath.pathForReferenceRect(referenceBox, &renderer.view()), clipPath.windRule());
+        m_paintInfo->context->clipPath(clipPath.pathForReferenceRect(referenceBox), clipPath.windRule());
     }
 
     SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(*m_renderer);