Changeset 169407 in webkit


Ignore:
Timestamp:
May 27, 2014, 6:33:26 PM (11 years ago)
Author:
Bem Jones-Bey
Message:

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.

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:
Location:
trunk
Files:
11 added
2 deleted
60 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r169406 r169407  
     12014-05-27  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        vw/vh units used as font/line-height values don't scale with the viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=87846
     5
     6        Reviewed by Darin Adler.
     7
     8        Update existing tests to work with the proper behavior of viewport
     9        units.
     10
     11        Add tests for some of the things fixed by this patch: handling of
     12        viewport units in font sizes, with calc, and when the viewport is
     13        resized without a reload.
     14
     15        The anonymous block and percent size child tests make sure that the
     16        viewport unit updates still work properly when there is another
     17        relative unit the depends on the size specified in viewport units.
     18
     19        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle-expected.txt:
     20        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html:
     21        * css3/viewport-percentage-lengths/resources/resize-test.js: Added.
     22        (resizeTest):
     23        (standardResizeTest):
     24        * css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block-expected.txt: Added.
     25        * css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html: Added.
     26        * css3/viewport-percentage-lengths/viewport-percentage-lengths-calc-expected.txt: Added.
     27        * css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html: Added.
     28        * css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child-expected.txt: Added.
     29        * css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html: Added.
     30        * css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt: Added.
     31        * css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html: Added.
     32        * css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt: Added.
     33        * css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html: Added.
     34        * fast/canvas/draw-focus-if-needed-expected.txt: Removed.
     35        * fast/canvas/draw-focus-if-needed.html: Removed.
     36        * fast/masking/parsing-clip-path-shape-expected.txt:
     37        * fast/masking/parsing-clip-path-shape.html:
     38        * fast/shapes/parsing/parsing-shape-lengths-expected.txt:
     39        * fast/shapes/parsing/parsing-shape-lengths.html:
     40
    1412014-05-27  Zoltan Horvath  <zoltan@webkit.org>
    242
  • trunk/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle-expected.txt

    r142021 r169407  
    99PASS style.getPropertyValue("font-size") is '24px'
    1010PASS style.getPropertyValue("line-height") is '32px'
    11 PASS style.getPropertyValue("text-indent") is '2vw'
     11PASS style.getPropertyValue("text-indent") is '16px'
    1212PASS style.getPropertyValue("margin-left") is '16px'
    1313PASS style.getPropertyValue("margin-right") is '16px'
     
    1818PASS style.getPropertyValue("border-bottom-left-radius") is '8px'
    1919PASS style.getPropertyValue("border-bottom-right-radius") is '8px'
    20 PASS style.getPropertyValue("min-height") is '10vw'
    21 PASS style.getPropertyValue("min-width") is '10vw'
    22 PASS style.getPropertyValue("max-height") is '60vw'
    23 PASS style.getPropertyValue("max-width") is '60vw'
     20PASS style.getPropertyValue("min-height") is '80px'
     21PASS style.getPropertyValue("min-width") is '80px'
     22PASS style.getPropertyValue("max-height") is '480px'
     23PASS style.getPropertyValue("max-width") is '480px'
    2424PASS style.getPropertyValue("top") is '80px'
    2525PASS style.getPropertyValue("bottom") is '80px'
     
    3636PASS style.getPropertyValue("font-size") is '18px'
    3737PASS style.getPropertyValue("line-height") is '24px'
    38 PASS style.getPropertyValue("text-indent") is '2vh'
     38PASS style.getPropertyValue("text-indent") is '12px'
    3939PASS style.getPropertyValue("margin-left") is '12px'
    4040PASS style.getPropertyValue("margin-right") is '12px'
     
    4545PASS style.getPropertyValue("border-bottom-left-radius") is '6px'
    4646PASS style.getPropertyValue("border-bottom-right-radius") is '6px'
    47 PASS style.getPropertyValue("min-height") is '10vh'
    48 PASS style.getPropertyValue("min-width") is '10vh'
    49 PASS style.getPropertyValue("max-height") is '60vh'
    50 PASS style.getPropertyValue("max-width") is '60vh'
     47PASS style.getPropertyValue("min-height") is '60px'
     48PASS style.getPropertyValue("min-width") is '60px'
     49PASS style.getPropertyValue("max-height") is '360px'
     50PASS style.getPropertyValue("max-width") is '360px'
    5151PASS style.getPropertyValue("top") is '60px'
    5252PASS style.getPropertyValue("bottom") is '60px'
     
    6363PASS style.getPropertyValue("font-size") is '18px'
    6464PASS style.getPropertyValue("line-height") is '24px'
    65 PASS style.getPropertyValue("text-indent") is '2vmin'
     65PASS style.getPropertyValue("text-indent") is '12px'
    6666PASS style.getPropertyValue("margin-left") is '12px'
    6767PASS style.getPropertyValue("margin-right") is '12px'
     
    7272PASS style.getPropertyValue("border-bottom-left-radius") is '6px'
    7373PASS style.getPropertyValue("border-bottom-right-radius") is '6px'
    74 PASS style.getPropertyValue("min-height") is '10vmin'
    75 PASS style.getPropertyValue("min-width") is '10vmin'
    76 PASS style.getPropertyValue("max-height") is '60vmin'
    77 PASS style.getPropertyValue("max-width") is '60vmin'
     74PASS style.getPropertyValue("min-height") is '60px'
     75PASS style.getPropertyValue("min-width") is '60px'
     76PASS style.getPropertyValue("max-height") is '360px'
     77PASS style.getPropertyValue("max-width") is '360px'
    7878PASS style.getPropertyValue("top") is '60px'
    7979PASS style.getPropertyValue("bottom") is '60px'
     
    9090PASS style.getPropertyValue("font-size") is '24px'
    9191PASS style.getPropertyValue("line-height") is '32px'
    92 PASS style.getPropertyValue("text-indent") is '2vmax'
     92PASS style.getPropertyValue("text-indent") is '16px'
    9393PASS style.getPropertyValue("margin-left") is '16px'
    9494PASS style.getPropertyValue("margin-right") is '16px'
     
    9999PASS style.getPropertyValue("border-bottom-left-radius") is '8px'
    100100PASS style.getPropertyValue("border-bottom-right-radius") is '8px'
    101 PASS style.getPropertyValue("min-height") is '10vmax'
    102 PASS style.getPropertyValue("min-width") is '10vmax'
    103 PASS style.getPropertyValue("max-height") is '60vmax'
    104 PASS style.getPropertyValue("max-width") is '60vmax'
     101PASS style.getPropertyValue("min-height") is '80px'
     102PASS style.getPropertyValue("min-width") is '80px'
     103PASS style.getPropertyValue("max-height") is '480px'
     104PASS style.getPropertyValue("max-width") is '480px'
    105105PASS style.getPropertyValue("top") is '80px'
    106106PASS style.getPropertyValue("bottom") is '80px'
  • trunk/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html

    r155275 r169407  
    150150var element, style;
    151151
     152function vw(x) {
     153    return "'" + Math.floor(x * window.innerWidth / 100) + "px'";
     154}
     155
     156function vh(x) {
     157    return "'" + Math.floor(x * window.innerHeight / 100) + "px'";
     158}
     159
     160function vmin(x) {
     161    return "'" + Math.floor(x * Math.min(window.innerWidth, window.innerHeight) / 100) + "px'";
     162}
     163
     164function vmax(x) {
     165    return "'" + Math.floor(x * Math.max(window.innerWidth, window.innerHeight) / 100) + "px'";
     166}
     167
    152168function getTheStyle() {
    153169    debug("Test for vw")
     
    155171    style = window.getComputedStyle(element,null);
    156172    var viewportWidth = window.innerWidth;
    157     shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportWidth / 100) + "px'");
    158     shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportWidth / 100) + "px'");
    159     shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportWidth / 100) + "px'");
    160     shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportWidth / 100) + "px'");
    161     shouldBe('style.getPropertyValue("text-indent")', "'2vw'");
    162     shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
    163     shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
    164     shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
    165     shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
    166     shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportWidth / 100) + "px'");
    167     shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportWidth / 100) + "px'");
    168     shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportWidth / 100) + "px'");
    169     shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportWidth / 100) + "px'");
    170     shouldBe('style.getPropertyValue("min-height")', "'10vw'");
    171     shouldBe('style.getPropertyValue("min-width")', "'10vw'");
    172     shouldBe('style.getPropertyValue("max-height")', "'60vw'");
    173     shouldBe('style.getPropertyValue("max-width")', "'60vw'");
     173    shouldBe('style.getPropertyValue("height")', vw(30));
     174    shouldBe('style.getPropertyValue("width")', vw(30));
     175    shouldBe('style.getPropertyValue("font-size")', vw(3));
     176    shouldBe('style.getPropertyValue("line-height")', vw(4));
     177    shouldBe('style.getPropertyValue("text-indent")', vw(2));
     178    shouldBe('style.getPropertyValue("margin-left")', vw(2));
     179    shouldBe('style.getPropertyValue("margin-right")', vw(2));
     180    shouldBe('style.getPropertyValue("margin-top")', vw(2));
     181    shouldBe('style.getPropertyValue("margin-bottom")', vw(2));
     182    shouldBe('style.getPropertyValue("border-top-left-radius")', vw(1));
     183    shouldBe('style.getPropertyValue("border-top-right-radius")', vw(1));
     184    shouldBe('style.getPropertyValue("border-bottom-left-radius")', vw(1));
     185    shouldBe('style.getPropertyValue("border-bottom-right-radius")', vw(1));
     186    shouldBe('style.getPropertyValue("min-height")', vw(10));
     187    shouldBe('style.getPropertyValue("min-width")', vw(10));
     188    shouldBe('style.getPropertyValue("max-height")', vw(60));
     189    shouldBe('style.getPropertyValue("max-width")', vw(60));
    174190    element.id = "element-container-absolute-vw";
    175     shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportWidth / 100) + "px'");
    176     shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportWidth / 100) + "px'");
    177     shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportWidth / 100) + "px'");
    178     shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportWidth / 100) + "px'");
    179     shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
    180     shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
    181     shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
    182     shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportWidth / 100) + "px'");
     191    shouldBe('style.getPropertyValue("top")', vw(10));
     192    shouldBe('style.getPropertyValue("bottom")', vw(10));
     193    shouldBe('style.getPropertyValue("left")', vw(10));
     194    shouldBe('style.getPropertyValue("right")', vw(10));
     195    shouldBe('style.getPropertyValue("padding-left")', vw(2));
     196    shouldBe('style.getPropertyValue("padding-right")', vw(2));
     197    shouldBe('style.getPropertyValue("padding-top")', vw(2));
     198    shouldBe('style.getPropertyValue("padding-bottom")', vw(2));
    183199
    184200    debug("\nTest for vh")
     
    186202    style = window.getComputedStyle(element,null);
    187203    var viewportHeight = window.innerHeight;
    188     shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportHeight / 100) + "px'");
    189     shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportHeight / 100) + "px'");
    190     shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportHeight / 100) + "px'");
    191     shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportHeight / 100) + "px'");
    192     shouldBe('style.getPropertyValue("text-indent")', "'2vh'");
    193     shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
    194     shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
    195     shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
    196     shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
    197     shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportHeight / 100) + "px'");
    198     shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportHeight / 100) + "px'");
    199     shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportHeight / 100) + "px'");
    200     shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportHeight / 100) + "px'");
    201     shouldBe('style.getPropertyValue("min-height")', "'10vh'");
    202     shouldBe('style.getPropertyValue("min-width")', "'10vh'");
    203     shouldBe('style.getPropertyValue("max-height")', "'60vh'");
    204     shouldBe('style.getPropertyValue("max-width")', "'60vh'");
     204    shouldBe('style.getPropertyValue("height")', vh(30));
     205    shouldBe('style.getPropertyValue("width")', vh(30));
     206    shouldBe('style.getPropertyValue("font-size")', vh(3));
     207    shouldBe('style.getPropertyValue("line-height")', vh(4));
     208    shouldBe('style.getPropertyValue("text-indent")', vh(2));
     209    shouldBe('style.getPropertyValue("margin-left")', vh(2));
     210    shouldBe('style.getPropertyValue("margin-right")', vh(2));
     211    shouldBe('style.getPropertyValue("margin-top")', vh(2));
     212    shouldBe('style.getPropertyValue("margin-bottom")', vh(2));
     213    shouldBe('style.getPropertyValue("border-top-left-radius")', vh(1));
     214    shouldBe('style.getPropertyValue("border-top-right-radius")', vh(1));
     215    shouldBe('style.getPropertyValue("border-bottom-left-radius")', vh(1));
     216    shouldBe('style.getPropertyValue("border-bottom-right-radius")', vh(1));
     217    shouldBe('style.getPropertyValue("min-height")', vh(10));
     218    shouldBe('style.getPropertyValue("min-width")', vh(10));
     219    shouldBe('style.getPropertyValue("max-height")', vh(60));
     220    shouldBe('style.getPropertyValue("max-width")', vh(60));
    205221    element.id = "element-container-absolute-vh";
    206     shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportHeight / 100) + "px'");
    207     shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportHeight / 100) + "px'");
    208     shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportHeight / 100) + "px'");
    209     shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportHeight / 100) + "px'");
    210     shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
    211     shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
    212     shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
    213     shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportHeight / 100) + "px'");
     222    shouldBe('style.getPropertyValue("top")', vh(10));
     223    shouldBe('style.getPropertyValue("bottom")', vh(10));
     224    shouldBe('style.getPropertyValue("left")', vh(10));
     225    shouldBe('style.getPropertyValue("right")', vh(10));
     226    shouldBe('style.getPropertyValue("padding-left")', vh(2));
     227    shouldBe('style.getPropertyValue("padding-right")', vh(2));
     228    shouldBe('style.getPropertyValue("padding-top")', vh(2));
     229    shouldBe('style.getPropertyValue("padding-bottom")', vh(2));
    214230
    215231    debug("\nTest for vmin")
     
    217233    style = window.getComputedStyle(element,null);
    218234    var viewportMinLength = Math.min(window.innerWidth, window.innerHeight);
    219     shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportMinLength / 100) + "px'");
    220     shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportMinLength / 100) + "px'");
    221     shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportMinLength / 100) + "px'");
    222     shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportMinLength / 100) + "px'");
    223     shouldBe('style.getPropertyValue("text-indent")', "'2vmin'");
    224     shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
    225     shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
    226     shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
    227     shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
    228     shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportMinLength / 100) + "px'");
    229     shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportMinLength / 100) + "px'");
    230     shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportMinLength / 100) + "px'");
    231     shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportMinLength / 100) + "px'");
    232     shouldBe('style.getPropertyValue("min-height")', "'10vmin'");
    233     shouldBe('style.getPropertyValue("min-width")', "'10vmin'");
    234     shouldBe('style.getPropertyValue("max-height")', "'60vmin'");
    235     shouldBe('style.getPropertyValue("max-width")', "'60vmin'");
     235    shouldBe('style.getPropertyValue("height")', vmin(30));
     236    shouldBe('style.getPropertyValue("width")', vmin(30));
     237    shouldBe('style.getPropertyValue("font-size")', vmin(3));
     238    shouldBe('style.getPropertyValue("line-height")', vmin(4));
     239    shouldBe('style.getPropertyValue("text-indent")', vmin(2));
     240    shouldBe('style.getPropertyValue("margin-left")', vmin(2));
     241    shouldBe('style.getPropertyValue("margin-right")', vmin(2));
     242    shouldBe('style.getPropertyValue("margin-top")', vmin(2));
     243    shouldBe('style.getPropertyValue("margin-bottom")', vmin(2));
     244    shouldBe('style.getPropertyValue("border-top-left-radius")', vmin(1));
     245    shouldBe('style.getPropertyValue("border-top-right-radius")', vmin(1));
     246    shouldBe('style.getPropertyValue("border-bottom-left-radius")', vmin(1));
     247    shouldBe('style.getPropertyValue("border-bottom-right-radius")', vmin(1));
     248    shouldBe('style.getPropertyValue("min-height")', vmin(10));
     249    shouldBe('style.getPropertyValue("min-width")', vmin(10));
     250    shouldBe('style.getPropertyValue("max-height")', vmin(60));
     251    shouldBe('style.getPropertyValue("max-width")', vmin(60));
    236252    element.id = "element-container-absolute-vmin";
    237     shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportMinLength / 100) + "px'");
    238     shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportMinLength / 100) + "px'");
    239     shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportMinLength / 100) + "px'");
    240     shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportMinLength / 100) + "px'");
    241     shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
    242     shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
    243     shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
    244     shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
     253    shouldBe('style.getPropertyValue("top")', vmin(10));
     254    shouldBe('style.getPropertyValue("bottom")', vmin(10));
     255    shouldBe('style.getPropertyValue("left")', vmin(10));
     256    shouldBe('style.getPropertyValue("right")', vmin(10));
     257    shouldBe('style.getPropertyValue("padding-left")', vmin(2));
     258    shouldBe('style.getPropertyValue("padding-right")', vmin(2));
     259    shouldBe('style.getPropertyValue("padding-top")', vmin(2));
     260    shouldBe('style.getPropertyValue("padding-bottom")', vmin(2));
    245261
    246262    debug("\nTest for vmax")
     
    248264    style = window.getComputedStyle(element,null);
    249265    var viewportMaxLength = Math.max(window.innerWidth, window.innerHeight);
    250     shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportMaxLength / 100) + "px'");
    251     shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportMaxLength / 100) + "px'");
    252     shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportMaxLength / 100) + "px'");
    253     shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportMaxLength / 100) + "px'");
    254     shouldBe('style.getPropertyValue("text-indent")', "'2vmax'");
    255     shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
    256     shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
    257     shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
    258     shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
    259     shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
    260     shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
    261     shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
    262     shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
    263     shouldBe('style.getPropertyValue("min-height")', "'10vmax'");
    264     shouldBe('style.getPropertyValue("min-width")', "'10vmax'");
    265     shouldBe('style.getPropertyValue("max-height")', "'60vmax'");
    266     shouldBe('style.getPropertyValue("max-width")', "'60vmax'");
     266    shouldBe('style.getPropertyValue("height")', vmax(30));
     267    shouldBe('style.getPropertyValue("width")', vmax(30));
     268    shouldBe('style.getPropertyValue("font-size")', vmax(3));
     269    shouldBe('style.getPropertyValue("line-height")', vmax(4));
     270    shouldBe('style.getPropertyValue("text-indent")', vmax(2));
     271    shouldBe('style.getPropertyValue("margin-left")', vmax(2));
     272    shouldBe('style.getPropertyValue("margin-right")', vmax(2));
     273    shouldBe('style.getPropertyValue("margin-top")', vmax(2));
     274    shouldBe('style.getPropertyValue("margin-bottom")', vmax(2));
     275    shouldBe('style.getPropertyValue("border-top-left-radius")', vmax(1));
     276    shouldBe('style.getPropertyValue("border-top-right-radius")', vmax(1));
     277    shouldBe('style.getPropertyValue("border-bottom-left-radius")', vmax(1));
     278    shouldBe('style.getPropertyValue("border-bottom-right-radius")', vmax(1));
     279    shouldBe('style.getPropertyValue("min-height")', vmax(10));
     280    shouldBe('style.getPropertyValue("min-width")', vmax(10));
     281    shouldBe('style.getPropertyValue("max-height")', vmax(60));
     282    shouldBe('style.getPropertyValue("max-width")', vmax(60));
    267283    element.id = "element-container-absolute-vmax";
    268     shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
    269     shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
    270     shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
    271     shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
    272     shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
    273     shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
    274     shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
    275     shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
     284    shouldBe('style.getPropertyValue("top")', vmax(10));
     285    shouldBe('style.getPropertyValue("bottom")', vmax(10));
     286    shouldBe('style.getPropertyValue("left")', vmax(10));
     287    shouldBe('style.getPropertyValue("right")', vmax(10));
     288    shouldBe('style.getPropertyValue("padding-left")', vmax(2));
     289    shouldBe('style.getPropertyValue("padding-right")', vmax(2));
     290    shouldBe('style.getPropertyValue("padding-top")', vmax(2));
     291    shouldBe('style.getPropertyValue("padding-bottom")', vmax(2));
    276292}
    277293getTheStyle();
  • trunk/LayoutTests/fast/masking/parsing-clip-path-shape-expected.txt

    r167132 r169407  
    1818PASS innerStyle("-webkit-clip-path", "circle(1vh at 1vh 1vh)") is "circle(1vh at 1vh 1vh)"
    1919PASS innerStyle("-webkit-clip-path", "circle(1vmin at 1vmin 1vmin)") is "circle(1vmin at 1vmin 1vmin)"
    20 PASS computedStyle("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)") is "circle(1.5vw at 0.5vw 1vw)"
    21 PASS computedStyle("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)") is "circle(1.5vh at 0.5vh 1vh)"
    22 PASS computedStyle("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)") is "circle(1.5vmin at 0.5vmin 1vmin)"
     20PASS computedStyle("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)") is "circle(12px at 4px 8px)"
     21PASS computedStyle("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)") is "circle(9px at 3px 6px)"
     22PASS computedStyle("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)") is "circle(9px at 3px 6px)"
    2323PASS computedStyle("-webkit-clip-path", "circle(150% at 50% 100%)") is "circle(150% at 50% 100%)"
    2424PASS computedStyle("-webkit-clip-path", "inset(45% 45% 90% 60% round 25% 10%)") is "inset(45% 45% 90% 60% round 25% 10%)"
  • trunk/LayoutTests/fast/masking/parsing-clip-path-shape.html

    r167132 r169407  
    6464testInner("-webkit-clip-path", "circle(1vmin at 1vmin 1vmin)", "circle(1vmin at 1vmin 1vmin)");
    6565
    66 testComputed("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)", "circle(1.5vw at 0.5vw 1vw)");
    67 testComputed("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)", "circle(1.5vh at 0.5vh 1vh)");
    68 testComputed("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)", "circle(1.5vmin at 0.5vmin 1vmin)");
     66testComputed("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)", "circle(12px at 4px 8px)");
     67testComputed("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)", "circle(9px at 3px 6px)");
     68testComputed("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)", "circle(9px at 3px 6px)");
    6969
    7070// percentage lengths - units
  • trunk/LayoutTests/fast/shapes/parsing/parsing-shape-lengths-expected.txt

    r167132 r169407  
    2323PASS getStyleValue("-webkit-shape-outside", "circle(1vh at 1vh 1vh)") is "circle(1vh at 1vh 1vh)"
    2424PASS getStyleValue("-webkit-shape-outside", "circle(1vmin at 1vmin 1vmin)") is "circle(1vmin at 1vmin 1vmin)"
    25 PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vw at .5vw 1vw)") is "circle(1.5vw at 0.5vw 1vw)"
    26 PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vh at .5vh 1vh)") is "circle(1.5vh at 0.5vh 1vh)"
    27 PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vmin at .5vmin 1vmin)") is "circle(1.5vmin at 0.5vmin 1vmin)"
     25PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vw at .5vw 1vw)") is "circle(12px at 4px 8px)"
     26PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vh at .5vh 1vh)") is "circle(9px at 3px 6px)"
     27PASS getComputedStyleValue("-webkit-shape-outside", "circle(1.5vmin at .5vmin 1vmin)") is "circle(9px at 3px 6px)"
    2828PASS getStyleValue("-webkit-shape-outside", "circle(100% at 100% 100%)") is "circle(100% at 100% 100%)"
    2929PASS getStyleValue("-webkit-shape-outside", "inset(45% 45% 90% 60% round 25% 10%)") is "inset(45% 45% 90% 60% round 25% 10%)"
  • trunk/LayoutTests/fast/shapes/parsing/parsing-shape-lengths.html

    r167132 r169407  
    6565testStyleValue("circle(1vmin at 1vmin 1vmin)", "circle(1vmin at 1vmin 1vmin)");
    6666
    67 testComputedStyleValue("circle(1.5vw at .5vw 1vw)", "circle(1.5vw at 0.5vw 1vw)");
    68 testComputedStyleValue("circle(1.5vh at .5vh 1vh)", "circle(1.5vh at 0.5vh 1vh)");
    69 testComputedStyleValue("circle(1.5vmin at .5vmin 1vmin)", "circle(1.5vmin at 0.5vmin 1vmin)");
     67testComputedStyleValue("circle(1.5vw at .5vw 1vw)", "circle(12px at 4px 8px)");
     68testComputedStyleValue("circle(1.5vh at .5vh 1vh)", "circle(9px at 3px 6px)");
     69testComputedStyleValue("circle(1.5vmin at .5vmin 1vmin)", "circle(9px at 3px 6px)");
    7070
    7171// percentage lengths - units
  • trunk/Source/WebCore/ChangeLog

    r169406 r169407  
     12014-05-27  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        vw/vh units used as font/line-height values don't scale with the viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=87846
     5
     6        Reviewed by Darin Adler.
     7
     8        This patch moves the resolution of viewport units to style recalc
     9        time. Currently viewport units are left unresolved during style
     10        recalcs, which leads to many problems with viewport units. Moving the
     11        resolution will fix these problems, as well as reduce the plumbing
     12        that goes on.
     13
     14        This patch touches a lot of files since the valueForLength functions
     15        no longer need a RenderView. The interesting changes are in:
     16
     17        - CSSToLengthConversionData -> CSSPrimitiveValue: for moving
     18            resolution to style recalc time.
     19        - Length / LengthFunctions: no longer needs to know about viewport
     20            units.
     21        - FrameView -> Document -> StyleResolver: for scheduling style recalcs
     22            upon resize
     23
     24        Note that getComputedStyle will now return pixel values when viewport
     25        units are used. This behavior matches Firefox and the css3-cascade
     26        spec.
     27
     28        This is based on a Blink patch by timloh@chromium.org.
     29
     30        Tests: css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html
     31               css3/viewport-percentage-lengths/viewport-percentage-lengths-calc.html
     32               css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html
     33               css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html
     34               css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html
     35
     36        * WebCore.exp.in: Remove RenderView argument to floatValueForLength.
     37        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
     38        (getAttributeSetForAccessibilityObject): Remove RenderView argument.
     39        * css/BasicShapeFunctions.cpp:
     40        (WebCore::convertToLength): Ditto.
     41        (WebCore::floatValueForCenterCoordinate): Ditto.
     42        * css/BasicShapeFunctions.h: Ditto.
     43        * css/CSSCalculationValue.cpp:
     44        (WebCore::unitCategory): Remove special handling for viewport units,
     45            as they get resolved to pixels.
     46        (WebCore::createCSS): Ditto.
     47        * css/CSSComputedStyleDeclaration.cpp:
     48        (WebCore::positionOffsetValue): Remove RendewView argument.
     49        (WebCore::getBorderRadiusCornerValues): Remove handling of viewport
     50            units, as they are already resolve to pixels here.
     51        (WebCore::getBorderRadiusCornerValue): Remove RenderView argument.
     52        (WebCore::getBorderRadiusShorthandValue): Ditto.
     53        (WebCore::specifiedValueForGridTrackBreadth): Remove handling of
     54            viewport units, as they are already resolved to pixels here.
     55        (WebCore::specifiedValueForGridTrackSize): Remove RenderView argument.
     56        (WebCore::valueForGridTrackList): Ditto.
     57        (WebCore::lineHeightFromStyle): Ditto.
     58        (WebCore::ComputedStyleExtractor::propertyValue): Ditto.
     59        * css/CSSGradientValue.cpp:
     60        (WebCore::CSSLinearGradientValue::createGradient): Pass RenderView to
     61            CSSToLengthConversionData constructor.
     62        (WebCore::CSSRadialGradientValue::createGradient): Ditto.
     63        * css/CSSPrimitiveValue.cpp:
     64        (WebCore::CSSPrimitiveValue::unitCategory): Remove handling of
     65            viewport units, as they get resolved to pixels.
     66        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Ditto.
     67        (WebCore::CSSPrimitiveValue::init): Ditto.
     68        (WebCore::CSSPrimitiveValue::computeLengthDouble): Resolve viewport
     69            units to pixels.
     70        (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory): Remove
     71        handling of viewport units, since they get resolved to pixels.
     72        (WebCore::CSSPrimitiveValue::viewportPercentageLength): Deleted.
     73        * css/CSSPrimitiveValue.h:
     74        (WebCore::CSSPrimitiveValue::isLength): Remove special handling of
     75            viewport units, since they get resolved to pixels.
     76        * css/CSSPrimitiveValueMappings.h:
     77        (WebCore::CSSPrimitiveValue::convertToLength): Ditto.
     78        * css/CSSToLengthConversionData.cpp:
     79        (WebCore::CSSToLengthConversionData::viewportWidthFactor): Caclulate
     80            conversion factor for viewport units to pixels. Note this does not
     81            set hasViewportUnits on the RenderStyle if computing the font
     82            size, because in the font size case, the RenderStyle is the
     83            parent's style, not the current renderer's style.
     84        (WebCore::CSSToLengthConversionData::viewportHeightFactor): Ditto.
     85        (WebCore::CSSToLengthConversionData::viewportMinFactor): Ditto.
     86        (WebCore::CSSToLengthConversionData::viewportMaxFactor): Ditto.
     87        * css/CSSToLengthConversionData.h:
     88        (WebCore::CSSToLengthConversionData::CSSToLengthConversionData): Add
     89            RenderView parameter, and make RenderStyle non-const so that
     90            hasViewportUnits can be set on the Style..
     91        (WebCore::CSSToLengthConversionData::style): style is now non-const.
     92        (WebCore::CSSToLengthConversionData::copyWithAdjustedZoom): Handle
     93            RenderView argument.
     94        * css/CSSToStyleMap.cpp:
     95        (WebCore::CSSToStyleMap::mapFillXPosition): Remove handling of
     96            viewport units, as they are already resolved to pixels here.
     97        (WebCore::CSSToStyleMap::mapFillYPosition): Ditto.
     98        * css/DeprecatedStyleBuilder.cpp:
     99        (WebCore::ApplyPropertyLength::applyValue): Ditto.
     100        (WebCore::ApplyPropertyBorderRadius::applyValue): Ditto.
     101        (WebCore::ApplyPropertyComputeLength::applyValue): Ditto.
     102        (WebCore::ApplyPropertyFontSize::applyValue): Ditto.
     103        (WebCore::ApplyPropertyLineHeight::applyValue): Ditto.
     104        (WebCore::ApplyPropertyLineHeightForIOSTextAutosizing::applyValue): Ditto.
     105        (WebCore::ApplyPropertyWordSpacing::applyValue): Ditto.
     106        (WebCore::ApplyPropertyVerticalAlign::applyValue): Ditto.
     107        (WebCore::ApplyPropertyTextIndent::applyValue): Ditto.
     108        * css/LengthFunctions.cpp:
     109        (WebCore::minimumIntValueForLength): Remove RenderView argument.
     110        (WebCore::intValueForLength): Remove RenderView argument and
     111            roundPecentages.
     112        (WebCore::minimumValueForLength): Remove RenderView argument, and
     113            special handling of viewport units.
     114        (WebCore::valueForLength): Ditto.
     115        (WebCore::floatValueForLength): Ditto.
     116        (WebCore::floatSizeForLengthSize): Remove RenderView argument.
     117        * css/LengthFunctions.h: Ditto.
     118        * css/MediaQueryEvaluator.cpp:
     119        (WebCore::MediaQueryEvaluator::eval): Add RenderView argument for
     120            CSSToLengthConversionData constuctor.
     121        * css/StyleResolver.cpp:
     122        (WebCore::StyleResolver::State::clear): Change to 0 arg constructor
     123            for CSSToLengthConversionData.
     124        (WebCore::StyleResolver::State::updateConversionData): In order to get
     125            the RenderView, we need to have a valid Element set on the state.
     126            Since this means that we need to set the conversion data in more
     127            places, move the contruction of conversion data into this helper
     128            method.
     129        (WebCore::StyleResolver::State::initElement): Make sure conversion
     130            data is up to date.
     131        (WebCore::StyleResolver::State::initForStyleResolve): Ditto.
     132        (WebCore::StyleResolver::State::setStyle): When the style is set, we
     133            need to make sure to update the conversion data.
     134        (WebCore::StyleResolver::styleForElement): If the style has viewport
     135            units, flage the document so that we can make sure to recalc the
     136            viewport unit values when the viewport is resized.
     137        (WebCore::StyleResolver::pseudoStyleForElement): Ditto.
     138        (WebCore::StyleResolver::updateFont): Make sure the font having
     139            viewport units updates the style.
     140        (WebCore::StyleResolver::convertToIntLength): Remove handling of
     141        viewport units, as they are resolved to pixels.
     142        (WebCore::StyleResolver::convertToFloatLength): Ditto.
     143        (WebCore::StyleResolver::clearCachedPropertiesAffectedByViewportUnits):
     144            Invalidate the matched properties cache for styles with viewport
     145            units when the viewport is resized.
     146        (WebCore::createGridTrackBreadth): Remove handling of viewport units,
     147            as they are resolved to pixels.
     148        (WebCore::StyleResolver::applyProperty): Ditto.
     149        (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange):
     150            Rename to be less confusing, since it has nothing to do with
     151            viewport units.
     152        (WebCore::StyleResolver::createFilterOperations): Remove handling of
     153            viewport units, as they are resolved to pixels.
     154        (WebCore::StyleResolver::affectedByViewportChange): Deleted.
     155        (WebCore::StyleResolver::viewportPercentageValue): Deleted.
     156        * css/StyleResolver.h:
     157        (WebCore::StyleResolver::State::State): C++11 cleanup: 0 -> nullptr.
     158        (WebCore::StyleResolver::State::setFontSizeHasViewportUnits): Set if
     159            the font size is specified in viewport units.
     160        (WebCore::StyleResolver::State::fontSizeHasViewportUnits): Ditto.
     161        (WebCore::StyleResolver::State::setStyle): Deleted.
     162        * css/TransformFunctions.cpp:
     163        (WebCore::convertToFloatLength): Remove handling of viewport units,
     164            since they are resolved to pixels.
     165        * dom/Document.cpp:
     166        (WebCore::Document::Document): Add flag to determine if some style in
     167            the document has viewport units.
     168        (WebCore::Document::pageSizeAndMarginsInPixels): Remove RenderView
     169            argument.
     170        (WebCore::Document::updateViewportUnitsOnResize): Mark elements with
     171            viewport units for style recalc when the viewport size has
     172            changed.
     173        * dom/Document.h:
     174        (WebCore::Document::setHasStyleWithViewportUnits): Flag to determine
     175            if some style in the document has viewport units.
     176        (WebCore::Document::hasStyleWithViewportUnits): Ditto.
     177        * html/HTMLAreaElement.cpp:
     178        (WebCore::HTMLAreaElement::getRegion): Remove RenderView argument.
     179        * page/FrameView.cpp:
     180        (WebCore::FrameView::layout): When the viewport is resized, call
     181            updateViewportUnitsOnResize on the document.
     182        * platform/Length.h:
     183        (WebCore::Length::isSpecified): Remove handling of viewport units,
     184            since they are now resolved to pixels.
     185        (WebCore::Length::viewportPercentageLength): Deleted.
     186        (WebCore::Length::isViewportPercentage): Deleted.
     187        * rendering/ClipPathOperation.h:
     188        (WebCore::ShapeClipPathOperation::pathForReferenceRect): Remove
     189            RenderView argument.
     190        (WebCore::BoxClipPathOperation::pathForReferenceRect): Ditto.
     191        * rendering/RenderBlock.cpp:
     192        (WebCore::RenderBlock::updateBlockChildDirtyBitsBeforeLayout): Remove
     193            handling of viewport units, since they get updated by
     194            updateViewportUnitsOnResize when the viewport is resized.
     195        (WebCore::RenderBlock::nodeAtPoint): Remove RenderView argument.
     196        (WebCore::RenderBlock::lineHeight): Ditto.
     197        * rendering/RenderBox.cpp:
     198        (WebCore::RenderBox::paintBoxDecorations): Remove RenderView argument.
     199        (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
     200            Remove handling of viewport units, as they are resolved to pixels.
     201        (WebCore::RenderBox::computePercentageLogicalHeight): Ditto.
     202        (WebCore::RenderBox::computeReplacedLogicalWidthUsing): Ditto.
     203        (WebCore::RenderBox::computeReplacedLogicalHeightUsing): Ditto.
     204        (WebCore::RenderBox::hasViewportPercentageLogicalHeight): Deleted.
     205        * rendering/RenderBox.h:
     206        * rendering/RenderBoxModelObject.cpp:
     207        (WebCore::RenderBoxModelObject::getBackgroundRoundedRect): Remove
     208            RenderView argument.
     209        (WebCore::RenderBoxModelObject::calculateFillTileSize): Remove
     210            handling of viewport units, as they are resolved to pixels.
     211        (WebCore::computeBorderImageSide): Remove RenderView argument.
     212        (WebCore::RenderBoxModelObject::paintNinePieceImage): Ditto.
     213        (WebCore::RenderBoxModelObject::paintBorder): Ditto.
     214        (WebCore::RenderBoxModelObject::paintBoxShadow): Ditto.
     215        * rendering/RenderElement.cpp:
     216        (WebCore::RenderElement::repaintAfterLayoutIfNeeded): Ditto.
     217        * rendering/RenderElement.h:
     218        (WebCore::RenderElement::valueForLength): Remove unused
     219            roundPercentages argument.
     220        (WebCore::RenderElement::minimumValueForLength): Remove unused
     221            RoundPercentages and RenderView arguments.
     222        * rendering/RenderGrid.cpp:
     223        (WebCore::RenderGrid::layoutGridItems): Remove handling of viewport
     224            units as they are resolved to pixels.
     225        * rendering/RenderInline.cpp:
     226        (WebCore::computeMargin): Ditto.
     227        (WebCore::RenderInline::lineHeight): Remove RenderView argument.
     228        * rendering/RenderLayer.cpp:
     229        (WebCore::RenderLayer::setupClipPath): Ditto.
     230        * rendering/RenderLineBreak.cpp:
     231        (WebCore::RenderLineBreak::lineHeight): Ditto.
     232        * rendering/RenderScrollbarPart.cpp:
     233        (WebCore::calcScrollbarThicknessUsing): Ditto.
     234        (WebCore::RenderScrollbarPart::computeScrollbarWidth): Ditto.
     235        (WebCore::RenderScrollbarPart::computeScrollbarHeight): Ditto.
     236        * rendering/RenderTable.cpp:
     237        (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
     238            Remove handling of viewport units, since they are resolved to
     239            pixels.
     240        (WebCore::RenderTable::computePreferredLogicalWidths): Now that
     241            viewport unit values are resolved to pixels at style recalc time,
     242            no special checking is needed to handle them, so update the
     243            comment to reflect that.
     244        * rendering/RenderThemeIOS.mm:
     245        (WebCore::applyCommonButtonPaddingToStyle): Add RenderView argument to
     246            CSSToLengthConversionData constructor.
     247        (WebCore::RenderThemeIOS::adjustButtonStyle): Ditto.
     248        * rendering/RenderThemeMac.mm:
     249        (WebCore::RenderThemeMac::paintMenuListButtonGradients): Remove
     250            RenderView argument.
     251        * rendering/RenderView.cpp:
     252        (WebCore::RenderView::layout): Remove handling of viewport units,
     253            since they are resolved to pixels.
     254        * rendering/RootInlineBox.cpp:
     255        (WebCore::RootInlineBox::ascentAndDescentForBox): Remove RenderView
     256            argument.
     257        * rendering/shapes/Shape.cpp:
     258        (WebCore::Shape::createShape): Remove RenderView argument.
     259        * rendering/shapes/Shape.h:
     260        * rendering/shapes/ShapeOutsideInfo.cpp:
     261        (WebCore::ShapeOutsideInfo::computedShape): Ditto.
     262        * rendering/style/BasicShapes.cpp:
     263        (WebCore::BasicShapeCircle::floatValueForRadiusInBox): Ditto.
     264        (WebCore::BasicShapeCircle::path): Ditto.
     265        (WebCore::BasicShapeEllipse::floatValueForRadiusInBox): Ditto.
     266        (WebCore::BasicShapeEllipse::path): Ditto.
     267        (WebCore::BasicShapePolygon::path): Ditto.
     268        (WebCore::floatSizeForLengthSize): Ditto.
     269        (WebCore::BasicShapeInset::path): Ditto.
     270        * rendering/style/BasicShapes.h:
     271        * rendering/style/RenderStyle.cpp:
     272        (WebCore::calcRadiiFor): Ditto.
     273        (WebCore::RenderStyle::getRoundedBorderFor): Ditto.
     274        (WebCore::RenderStyle::computedLineHeight): Remove handling of
     275            viewport units since they are resolved to pixels.
     276        * rendering/style/RenderStyle.h:
     277        (WebCore::RenderStyle::setHasViewportUnits): Set if this style has
     278        a property set with viewport units.
     279        (WebCore::RenderStyle::hasViewportUnits): Ditto.
     280        * rendering/svg/RenderSVGRoot.cpp:
     281        (WebCore::resolveLengthAttributeForSVG): Remove RenderView argument.
     282        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth): Ditto.
     283        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): Ditto.
     284        * rendering/svg/SVGRenderingContext.cpp:
     285        (WebCore::SVGRenderingContext::prepareToRenderSVGContent): Ditto.
     286
    12872014-05-27  Zoltan Horvath  <zoltan@webkit.org>
    2288
  • trunk/Source/WebCore/WebCore.exp.in

    r169380 r169407  
    825825__ZN7WebCore19TextResourceDecoderD1Ev
    826826__ZN7WebCore19enclosingLayoutRectERKNS_9FloatRectE
    827 __ZN7WebCore19floatValueForLengthERKNS_6LengthEfPNS_10RenderViewE
     827__ZN7WebCore19floatValueForLengthERKNS_6LengthEf
    828828__ZN7WebCore19getFileCreationTimeERKN3WTF6StringERl
    829829__ZN7WebCore19toInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp

    r165656 r169407  
    126126
    127127    if (!style->textIndent().isUndefined()) {
    128         int indentation = valueForLength(style->textIndent(), object->size().width(), &renderer->view());
     128        int indentation = valueForLength(style->textIndent(), object->size().width());
    129129        buffer.reset(g_strdup_printf("%i", indentation));
    130130        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
  • trunk/Source/WebCore/css/BasicShapeFunctions.cpp

    r168481 r169407  
    3737#include "Pair.h"
    3838#include "RenderStyle.h"
    39 #include "RenderView.h"
    4039
    4140namespace WebCore {
     
    131130static Length convertToLength(const CSSToLengthConversionData& conversionData, CSSPrimitiveValue* value)
    132131{
    133     return value->convertToLength<FixedIntegerConversion | FixedFloatConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(conversionData);
     132    return value->convertToLength<FixedIntegerConversion | FixedFloatConversion | PercentConversion | CalculatedConversion>(conversionData);
    134133}
    135134
     
    266265}
    267266
    268 float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate& center, float boxDimension, RenderView* view)
    269 {
    270     float offset = floatValueForLength(center.length(), boxDimension, view);
     267float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate& center, float boxDimension)
     268{
     269    float offset = floatValueForLength(center.length(), boxDimension);
    271270    if (center.direction() == BasicShapeCenterCoordinate::TopLeft)
    272271        return offset;
  • trunk/Source/WebCore/css/BasicShapeFunctions.h

    r168481 r169407  
    3737
    3838class CSSBasicShape;
     39class CSSToLengthConversionData;
    3940class CSSPrimitiveValue;
    4041class CSSToLengthConversionData;
    4142class CSSValue;
    4243class RenderStyle;
    43 class RenderView;
    4444
    4545PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle*, const BasicShape*);
    4646PassRefPtr<BasicShape> basicShapeForValue(const CSSToLengthConversionData&, const CSSBasicShape*);
    4747
    48 float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate&, float, RenderView*);
     48float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate&, float);
    4949}
    5050
  • trunk/Source/WebCore/css/CSSCalculationValue.cpp

    r168685 r169407  
    6767    case CSSPrimitiveValue::CSS_REMS:
    6868    case CSSPrimitiveValue::CSS_CHS:
     69    case CSSPrimitiveValue::CSS_VW:
     70    case CSSPrimitiveValue::CSS_VH:
     71    case CSSPrimitiveValue::CSS_VMIN:
     72    case CSSPrimitiveValue::CSS_VMAX:
    6973        return CalcLength;
    7074    case CSSPrimitiveValue::CSS_PERCENTAGE:
     
    722726    switch (length.type()) {
    723727    case Percent:
    724     case ViewportPercentageWidth:
    725     case ViewportPercentageHeight:
    726     case ViewportPercentageMin:
    727     case ViewportPercentageMax:
    728728    case Fixed:
    729729        return CSSCalcPrimitiveValue::create(CSSPrimitiveValue::create(length, &style), length.value() == trunc(length.value()));
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r169349 r169407  
    5858#include "RenderBox.h"
    5959#include "RenderStyle.h"
    60 #include "RenderView.h"
    6160#include "SVGElement.h"
    6261#include "StyleInheritedData.h"
     
    655654}
    656655
    657 static PassRefPtr<CSSValue> positionOffsetValue(RenderStyle* style, CSSPropertyID propertyID, RenderView* renderView)
     656static PassRefPtr<CSSValue> positionOffsetValue(RenderStyle* style, CSSPropertyID propertyID)
    658657{
    659658    if (!style)
     
    681680        if (l.isFixed())
    682681            return zoomAdjustedPixelValue(l.value(), style);
    683         if (l.isViewportPercentage())
    684             return zoomAdjustedPixelValue(valueForLength(l, 0, renderView), style);
     682
    685683        return cssValuePool().createValue(l);
    686684    }
     
    704702}
    705703
    706 static PassRef<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
     704static PassRef<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style)
    707705{
    708706    auto list = CSSValueList::createSpaceSeparated();
     
    710708        list.get().append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
    711709    else
    712         list.get().append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style));
     710        list.get().append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0), style));
    713711    if (radius.height().isPercentNotCalculated())
    714712        list.get().append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
    715713    else
    716         list.get().append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style));
     714        list.get().append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0), style));
    717715    return list;
    718716}
    719717
    720 static PassRef<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
     718static PassRef<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style)
    721719{
    722720    if (radius.width() == radius.height()) {
    723721        if (radius.width().isPercentNotCalculated())
    724722            return cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
    725         return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style);
    726     }
    727     return getBorderRadiusCornerValues(radius, style, renderView);
    728 }
    729 
    730 static PassRef<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, RenderView* renderView)
     723        return zoomAdjustedPixelValue(valueForLength(radius.width(), 0), style);
     724    }
     725    return getBorderRadiusCornerValues(radius, style);
     726}
     727
     728static PassRef<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style)
    731729{
    732730    auto list = CSSValueList::createSlashSeparated();
     
    739737    bool showVerticalTopRight = showVerticalBottomRight || (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height());
    740738
    741     RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, renderView);
    742     RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, renderView);
    743     RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, renderView);
    744     RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, renderView);
     739    RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style);
     740    RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style);
     741    RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style);
     742    RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style);
    745743
    746744    RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
     
    959957
    960958#if ENABLE(CSS_GRID_LAYOUT)
    961 static PassRef<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style, RenderView* renderView)
     959static PassRef<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style)
    962960{
    963961    if (!trackBreadth.isLength())
     
    967965    if (trackBreadthLength.isAuto())
    968966        return cssValuePool().createIdentifierValue(CSSValueAuto);
    969     if (trackBreadthLength.isViewportPercentage())
    970         return zoomAdjustedPixelValue(valueForLength(trackBreadthLength, 0, renderView), style);
    971967    return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
    972968}
    973969
    974 static PassRefPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
     970static PassRefPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style)
    975971{
    976972    switch (trackSize.type()) {
    977973    case LengthTrackSizing:
    978         return specifiedValueForGridTrackBreadth(trackSize.length(), style, renderView);
     974        return specifiedValueForGridTrackBreadth(trackSize.length(), style);
    979975    case MinMaxTrackSizing:
    980976        RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
    981         minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
    982         minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
     977        minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), style));
     978        minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.maxTrackBreadth(), style));
    983979        return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
    984980    }
     
    999995}
    1000996
    1001 static PassRef<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle* style, RenderView* renderView)
     997static PassRef<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle* style)
    1002998{
    1003999    const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style->gridColumns() : style->gridRows();
     
    10241020        for (unsigned i = 0; i < trackSizes.size(); ++i) {
    10251021            addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, list.get());
    1026             list.get().append(specifiedValueForGridTrackSize(trackSizes[i], style, renderView));
     1022            list.get().append(specifiedValueForGridTrackSize(trackSizes[i], style));
    10271023        }
    10281024    }
     
    14501446}
    14511447
    1452 static PassRef<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, RenderView* renderView)
     1448static PassRef<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style)
    14531449{
    14541450    Length length = style->lineHeight();
     
    14621458        return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
    14631459    }
    1464     return zoomAdjustedPixelValue(floatValueForLength(length, 0, renderView), style);
     1460    return zoomAdjustedPixelValue(floatValueForLength(length, 0), style);
    14651461}
    14661462
     
    18791875            return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
    18801876        case CSSPropertyBottom:
    1881             return positionOffsetValue(style.get(), CSSPropertyBottom, m_node->document().renderView());
     1877            return positionOffsetValue(style.get(), CSSPropertyBottom);
    18821878        case CSSPropertyWebkitBoxAlign:
    18831879            return cssValuePool().createValue(style->boxAlign());
     
    20232019            computedFont->weight = fontWeightFromStyle(style.get());
    20242020            computedFont->size = fontSizeFromStyle(style.get());
    2025             computedFont->lineHeight = lineHeightFromStyle(style.get(), m_node->document().renderView());
     2021            computedFont->lineHeight = lineHeightFromStyle(style.get());
    20262022            computedFont->family = fontFamilyFromStyle(style.get());
    20272023            return computedFont.release();
     
    20642060        // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html
    20652061        case CSSPropertyWebkitGridAutoColumns:
    2066             return specifiedValueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document().renderView());
     2062            return specifiedValueForGridTrackSize(style->gridAutoColumns(), style.get());
    20672063        case CSSPropertyWebkitGridAutoRows:
    2068             return specifiedValueForGridTrackSize(style->gridAutoRows(), style.get(), m_node->document().renderView());
     2064            return specifiedValueForGridTrackSize(style->gridAutoRows(), style.get());
    20692065
    20702066        case CSSPropertyWebkitGridTemplateColumns:
    2071             return valueForGridTrackList(ForColumns, renderer, style.get(), m_node->document().renderView());
     2067            return valueForGridTrackList(ForColumns, renderer, style.get());
    20722068        case CSSPropertyWebkitGridTemplateRows:
    2073             return valueForGridTrackList(ForRows, renderer, style.get(), m_node->document().renderView());
     2069            return valueForGridTrackList(ForRows, renderer, style.get());
    20742070
    20752071        case CSSPropertyWebkitGridColumnStart:
     
    21422138#endif
    21432139        case CSSPropertyLeft:
    2144             return positionOffsetValue(style.get(), CSSPropertyLeft, m_node->document().renderView());
     2140            return positionOffsetValue(style.get(), CSSPropertyLeft);
    21452141        case CSSPropertyLetterSpacing:
    21462142            if (!style->letterSpacing())
     
    21522148            return cssValuePool().createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
    21532149        case CSSPropertyLineHeight:
    2154             return lineHeightFromStyle(style.get(), m_node->document().renderView());
     2150            return lineHeightFromStyle(style.get());
    21552151        case CSSPropertyListStyleImage:
    21562152            if (style->listStyleImage())
     
    21722168                return zoomAdjustedPixelValueForLength(marginRight, style.get());
    21732169            float value;
    2174             if (marginRight.isPercent() || marginRight.isViewportPercentage()) {
     2170            if (marginRight.isPercent()) {
    21752171                // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
    21762172                // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
    21772173                // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
    2178                 value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document().renderView());
     2174                value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent());
    21792175            } else
    21802176                value = toRenderBox(renderer)->marginRight();
     
    22672263            return cssValuePool().createValue(style->position());
    22682264        case CSSPropertyRight:
    2269             return positionOffsetValue(style.get(), CSSPropertyRight, m_node->document().renderView());
     2265            return positionOffsetValue(style.get(), CSSPropertyRight);
    22702266        case CSSPropertyWebkitRubyPosition:
    22712267            return cssValuePool().createValue(style->rubyPosition());
     
    23682364            return cssValuePool().createValue(style->textTransform());
    23692365        case CSSPropertyTop:
    2370             return positionOffsetValue(style.get(), CSSPropertyTop, m_node->document().renderView());
     2366            return positionOffsetValue(style.get(), CSSPropertyTop);
    23712367        case CSSPropertyUnicodeBidi:
    23722368            return cssValuePool().createValue(style->unicodeBidi());
     
    26342630                    box = toRenderBox(renderer)->borderBoxRect();
    26352631
    2636                 RenderView* renderView = m_node->document().renderView();
    2637                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get()));
    2638                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get()));
     2632                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width()), style.get()));
     2633                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height()), style.get()));
    26392634            }
    26402635            else {
     
    26662661            return cssValuePool().createValue(style->userSelect());
    26672662        case CSSPropertyBorderBottomLeftRadius:
    2668             return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), m_node->document().renderView());
     2663            return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get());
    26692664        case CSSPropertyBorderBottomRightRadius:
    2670             return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), m_node->document().renderView());
     2665            return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get());
    26712666        case CSSPropertyBorderTopLeftRadius:
    2672             return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), m_node->document().renderView());
     2667            return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get());
    26732668        case CSSPropertyBorderTopRightRadius:
    2674             return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), m_node->document().renderView());
     2669            return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get());
    26752670        case CSSPropertyClip: {
    26762671            if (!style->hasClip())
     
    26942689                    box = toRenderBox(renderer)->borderBoxRect();
    26952690
    2696                 RenderView* renderView = m_node->document().renderView();
    2697                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
    2698                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get()));
     2691                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width()), style.get()));
     2692                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height()), style.get()));
    26992693                if (style->transformOriginZ() != 0)
    27002694                    list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
     
    28572851            return valueForNinePieceImage(style->borderImage());
    28582852        case CSSPropertyBorderRadius:
    2859             return getBorderRadiusShorthandValue(style.get(), m_node->document().renderView());
     2853            return getBorderRadiusShorthandValue(style.get());
    28602854        case CSSPropertyBorderRight:
    28612855            return getCSSPropertyValuesForShorthandProperties(borderRightShorthand());
  • trunk/Source/WebCore/css/CSSGradientValue.cpp

    r169258 r169407  
    3737#include "NodeRenderStyle.h"
    3838#include "RenderElement.h"
     39#include "RenderView.h"
    3940#include "StyleResolver.h"
    4041#include <wtf/text/StringBuilder.h>
     
    130131}
    131132
    132 void CSSGradientValue::addStops(Gradient& gradient, RenderView& renderView, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat)
     133void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat)
    133134{
    134135    if (m_gradientType == CSSDeprecatedLinearGradient || m_gradientType == CSSDeprecatedRadialGradient) {
     
    183184                if (positionValue.isLength())
    184185                    length = positionValue.computeLength<float>(conversionData);
    185                 else if (positionValue.isViewportPercentageLength())
    186                     length = valueForLength(positionValue.viewportPercentageLength(), 0, &renderView);
    187186                else {
    188187                    Ref<CalculationValue> calculationValue { positionValue.cssCalcValue()->createCalculationValue(conversionData) };
     
    648647    ASSERT(!size.isEmpty());
    649648
    650     CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle());
     649    CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle(), &renderer.view());
    651650
    652651    FloatPoint firstPoint;
     
    705704
    706705    // Now add the stops.
    707     addStops(*gradient, renderer.view(), conversionData, 1);
     706    addStops(*gradient, conversionData, 1);
    708707
    709708    return gradient.release();
     
    986985    ASSERT(!size.isEmpty());
    987986
    988     CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle());
     987    CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle(), &renderer.view());
    989988
    990989    FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size);
     
    11191118
    11201119    // Now add the stops.
    1121     addStops(*gradient, renderer.view(), conversionData, maxExtent);
     1120    addStops(*gradient, conversionData, maxExtent);
    11221121
    11231122    return gradient.release();
  • trunk/Source/WebCore/css/CSSGradientValue.h

    r169258 r169407  
    111111    }
    112112
    113     void addStops(Gradient&, RenderView&, const CSSToLengthConversionData&, float maxLengthForRepeat = 0);
     113    void addStops(Gradient&, const CSSToLengthConversionData&, float maxLengthForRepeat = 0);
    114114
    115115    // Resolve points/radii to front end values.
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r168685 r169407  
    160160    case CSS_KHZ:
    161161        return UFrequency;
    162     case CSS_VW:
    163     case CSS_VH:
    164     case CSS_VMIN:
    165     case CSS_VMAX:
    166         return UViewportPercentageLength;
    167162#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
    168163    case CSS_DPPX:
     
    302297    case FitContent:
    303298    case Percent:
    304     case ViewportPercentageWidth:
    305     case ViewportPercentageHeight:
    306     case ViewportPercentageMin:
    307     case ViewportPercentageMax:
    308299        init(length);
    309300        return;
     
    371362        m_value.num = length.percent();
    372363        return;
    373     case ViewportPercentageWidth:
    374         m_primitiveUnitType = CSS_VW;
    375         m_value.num = length.viewportPercentageLength();
    376         return;
    377     case ViewportPercentageHeight:
    378         m_primitiveUnitType = CSS_VH;
    379         m_value.num = length.viewportPercentageLength();
    380         return;
    381     case ViewportPercentageMin:
    382         m_primitiveUnitType = CSS_VMIN;
    383         m_value.num = length.viewportPercentageLength();
    384         return;
    385     case ViewportPercentageMax:
    386         m_primitiveUnitType = CSS_VMAX;
    387         m_value.num = length.viewportPercentageLength();
    388         return;
    389364    case Calculated:
    390365    case Relative:
     
    658633        return -1.0;
    659634    case CSS_VH:
     635        factor = conversionData.viewportHeightFactor();
     636        break;
    660637    case CSS_VW:
     638        factor = conversionData.viewportWidthFactor();
     639        break;
    661640    case CSS_VMAX:
     641        factor = conversionData.viewportMaxFactor();
     642        break;
    662643    case CSS_VMIN:
    663         factor = 1.0;
     644        factor = conversionData.viewportMinFactor();
    664645        break;
    665646    default:
     
    780761    case UFrequency:
    781762        return CSS_HZ;
    782     case UViewportPercentageLength:
    783         return CSS_UNKNOWN; // Cannot convert between numbers and relative lengths.
    784763#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
    785764    case UResolution:
     
    12231202    if (m_primitiveUnitType == CSS_URI)
    12241203        addSubresourceURL(urls, styleSheet->completeURL(m_value.string));
    1225 }
    1226 
    1227 Length CSSPrimitiveValue::viewportPercentageLength() const
    1228 {
    1229     ASSERT(isViewportPercentageLength());
    1230     Length viewportLength;
    1231     switch (m_primitiveUnitType) {
    1232     case CSS_VW:
    1233         viewportLength = Length(getDoubleValue(), ViewportPercentageWidth);
    1234         break;
    1235     case CSS_VH:
    1236         viewportLength = Length(getDoubleValue(), ViewportPercentageHeight);
    1237         break;
    1238     case CSS_VMIN:
    1239         viewportLength = Length(getDoubleValue(), ViewportPercentageMin);
    1240         break;
    1241     case CSS_VMAX:
    1242         viewportLength = Length(getDoubleValue(), ViewportPercentageMax);
    1243         break;
    1244     default:
    1245         break;
    1246     }
    1247     return viewportLength;
    12481204}
    12491205
  • trunk/Source/WebCore/css/CSSPrimitiveValue.h

    r167937 r169407  
    149149        UTime,
    150150        UFrequency,
    151         UViewportPercentageLength,
    152151#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
    153152        UResolution,
     
    177176    {
    178177        unsigned short type = primitiveType();
    179         return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS;
     178        return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS || isViewportPercentageLength();
    180179    }
    181180    bool isNumber() const { return primitiveType() == CSS_NUMBER; }
     
    330329    void addSubresourceStyleURLs(ListHashSet<URL>&, const StyleSheetContents*) const;
    331330
    332     Length viewportPercentageLength() const;
    333 
    334331    PassRefPtr<CSSPrimitiveValue> cloneForCSSOM() const;
    335332    void setCSSOMSafe() { m_isCSSOMSafe = true; }
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r168839 r169407  
    46254625    PercentConversion = 1 << 3,
    46264626    FractionConversion = 1 << 4,
    4627     CalculatedConversion = 1 << 5,
    4628     ViewportPercentageConversion = 1 << 6
     4627    CalculatedConversion = 1 << 5
    46294628};
    46304629
     
    46454644    if ((supported & CalculatedConversion) && isCalculated())
    46464645        return Length(cssCalcValue()->createCalculationValue(conversionData));
    4647     if ((supported & ViewportPercentageConversion) && isViewportPercentageLength())
    4648         return viewportPercentageLength();
    46494646    return Length(Undefined);
    46504647}
  • trunk/Source/WebCore/css/CSSToLengthConversionData.cpp

    r167937 r169407  
    3333
    3434#include "RenderStyle.h"
     35#include "RenderView.h"
    3536
    3637namespace WebCore {
     
    4344}
    4445
     46double CSSToLengthConversionData::viewportWidthFactor() const
     47{
     48    if (m_style && !m_computingFontSize)
     49        m_style->setHasViewportUnits();
     50    return m_renderView ? m_renderView->viewportSizeForCSSViewportUnits().width() / 100.0 : 0.0;
     51}
     52
     53double CSSToLengthConversionData::viewportHeightFactor() const
     54{
     55    if (m_style && !m_computingFontSize)
     56        m_style->setHasViewportUnits();
     57
     58    if (!m_renderView)
     59        return 0.0;
     60
     61    return m_renderView ? m_renderView->viewportSizeForCSSViewportUnits().height() / 100.0 : 0.0;
     62}
     63
     64double CSSToLengthConversionData::viewportMinFactor() const
     65{
     66    if (m_style && !m_computingFontSize)
     67        m_style->setHasViewportUnits();
     68
     69    if (!m_renderView)
     70        return 0.0;
     71
     72    IntSize viewportSizeForCSSViewportUnits = m_renderView->viewportSizeForCSSViewportUnits();
     73    return std::min(viewportSizeForCSSViewportUnits.width(), viewportSizeForCSSViewportUnits.height()) / 100.0;
     74}
     75
     76double CSSToLengthConversionData::viewportMaxFactor() const
     77{
     78    if (m_style && !m_computingFontSize)
     79        m_style->setHasViewportUnits();
     80
     81    if (!m_renderView)
     82        return 0.0;
     83
     84    IntSize viewportSizeForCSSViewportUnits = m_renderView->viewportSizeForCSSViewportUnits();
     85    return std::max(viewportSizeForCSSViewportUnits.width(), viewportSizeForCSSViewportUnits.height()) / 100.0;
     86}
     87
    4588} // namespace WebCore
  • trunk/Source/WebCore/css/CSSToLengthConversionData.h

    r167937 r169407  
    3838
    3939class RenderStyle;
     40class RenderView;
    4041
    4142class CSSToLengthConversionData {
    4243public:
    43     CSSToLengthConversionData(const RenderStyle* style, const RenderStyle* rootStyle, float zoom, bool computingFontSize = false)
     44    CSSToLengthConversionData(RenderStyle* style, const RenderStyle* rootStyle, const RenderView* renderView, float zoom, bool computingFontSize = false)
    4445        : m_style(style)
    4546        , m_rootStyle(rootStyle)
     47        , m_renderView(renderView)
    4648        , m_zoom(zoom)
    4749        , m_useEffectiveZoom(false)
     
    5052        ASSERT(zoom > 0);
    5153    }
    52     CSSToLengthConversionData(const RenderStyle* style = nullptr, const RenderStyle* rootStyle = nullptr, bool computingFontSize = false)
     54    CSSToLengthConversionData(RenderStyle* style, const RenderStyle* rootStyle, const RenderView* renderView, bool computingFontSize = false)
    5355        : m_style(style)
    5456        , m_rootStyle(rootStyle)
     57        , m_renderView(renderView)
    5558        , m_useEffectiveZoom(true)
    5659        , m_computingFontSize(computingFontSize)
    5760    {
    5861    }
     62    CSSToLengthConversionData()
     63        : CSSToLengthConversionData(nullptr, nullptr, nullptr)
     64    {
     65    }
    5966
    60     const RenderStyle* style() const { return m_style; }
     67    RenderStyle* style() const { return m_style; }
    6168    const RenderStyle* rootStyle() const { return m_rootStyle; }
    6269    float zoom() const;
    6370    bool computingFontSize() const { return m_computingFontSize; }
    6471
     72    double viewportWidthFactor() const;
     73    double viewportHeightFactor() const;
     74    double viewportMinFactor() const;
     75    double viewportMaxFactor() const;
     76
    6577    CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const
    6678    {
    67         return CSSToLengthConversionData(m_style, m_rootStyle, newZoom, m_computingFontSize);
     79        return CSSToLengthConversionData(m_style, m_rootStyle, m_renderView, newZoom, m_computingFontSize);
    6880    }
    6981
    7082private:
    71     const RenderStyle* m_style;
     83    RenderStyle* m_style;
    7284    const RenderStyle* m_rootStyle;
     85    const RenderView* m_renderView;
    7386    float m_zoom;
    7487    bool m_useEffectiveZoom;
  • trunk/Source/WebCore/css/CSSToStyleMap.cpp

    r167937 r169407  
    3838#include "Pair.h"
    3939#include "Rect.h"
     40#include "RenderView.h"
    4041#include "StyleResolver.h"
    4142
     
    5152    return m_resolver->style();
    5253}
    53    
     54
    5455RenderStyle* CSSToStyleMap::rootElementStyle() const
    5556{
     
    6162    return m_resolver->useSVGZoomRules();
    6263}
    63    
     64
    6465PassRefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue* value)
    6566{
     
    254255    else if (primitiveValue->isCalculatedPercentageWithLength())
    255256        length = Length(primitiveValue->cssCalcValue()->createCalculationValue(m_resolver->state().cssToLengthConversionData()));
    256     else if (primitiveValue->isViewportPercentageLength())
    257         length = primitiveValue->viewportPercentageLength();
    258257    else
    259258        return;
     
    288287    else if (primitiveValue->isCalculatedPercentageWithLength())
    289288        length = Length(primitiveValue->cssCalcValue()->createCalculationValue(m_resolver->state().cssToLengthConversionData()));
    290     else if (primitiveValue->isViewportPercentageLength())
    291         length = primitiveValue->viewportPercentageLength();
    292289    else
    293290        return;
  • trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp

    r167937 r169407  
    395395        else if (primitiveValue->isCalculatedPercentageWithLength())
    396396            setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->createCalculationValue(styleResolver->state().cssToLengthConversionData())));
    397         else if (primitiveValue->isViewportPercentageLength())
    398             setValue(styleResolver->style(), primitiveValue->viewportPercentageLength());
    399397    }
    400398
     
    447445        if (pair->first()->isPercentage())
    448446            radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
    449         else if (pair->first()->isViewportPercentageLength())
    450             radiusWidth = Length(styleResolver->viewportPercentageValue(*pair->first(), pair->first()->getIntValue()), Fixed);
    451447        else if (pair->first()->isCalculatedPercentageWithLength())
    452448            radiusWidth = Length(pair->first()->cssCalcValue()->createCalculationValue(conversionData));
     
    457453        if (pair->second()->isPercentage())
    458454            radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
    459         else if (pair->second()->isViewportPercentageLength())
    460             radiusHeight = Length(styleResolver->viewportPercentageValue(*pair->second(), pair->second()->getIntValue()), Fixed);
    461455        else if (pair->second()->isCalculatedPercentageWithLength())
    462456            radiusHeight = Length(pair->second()->cssCalcValue()->createCalculationValue(conversionData));
     
    623617                    length = 1.0;
    624618            }
    625             if (primitiveValue->isViewportPercentageLength())
    626                 length = styleResolver->viewportPercentageValue(*primitiveValue, length);
    627619        } else {
    628620            ASSERT_NOT_REACHED();
     
    869861            fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
    870862                                              || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
    871             if (primitiveValue->isLength())
    872                 size = primitiveValue->computeLength<float>(CSSToLengthConversionData(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0f, true));
    873             else if (primitiveValue->isPercentage())
     863            if (primitiveValue->isLength()) {
     864                size = primitiveValue->computeLength<float>(CSSToLengthConversionData(styleResolver->parentStyle(), styleResolver->rootElementStyle(), styleResolver->document().renderView(), 1.0f, true));
     865                styleResolver->state().setFontSizeHasViewportUnits(primitiveValue->isViewportPercentageLength());
     866            } else if (primitiveValue->isPercentage())
    874867                size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
    875868            else if (primitiveValue->isCalculatedPercentageWithLength()) {
    876869                Ref<CalculationValue> calculationValue { primitiveValue->cssCalcValue()->createCalculationValue(styleResolver->state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f)) };
    877870                size = calculationValue->evaluate(parentSize);
    878             } else if (primitiveValue->isViewportPercentageLength())
    879                 size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document().renderView());
    880             else
     871            } else
    881872                return;
    882873        }
     
    14591450            // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
    14601451            lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
    1461         } else if (primitiveValue->isViewportPercentageLength())
    1462             lineHeight = primitiveValue->viewportPercentageLength();
    1463         else
     1452        } else
    14641453            return;
    14651454        styleResolver->style()->setLineHeight(lineHeight);
     
    14991488            else
    15001489                lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
    1501         } else if (primitiveValue->isViewportPercentageLength())
    1502             lineHeight = primitiveValue->viewportPercentageLength();
    1503         else
     1490        } else
    15041491            return;
    15051492        styleResolver->style()->setLineHeight(lineHeight);
     
    15441531        else if (primitiveValue->isNumber())
    15451532            wordSpacing = Length(primitiveValue->getDoubleValue(), Fixed);
    1546         else if (primitiveValue->isViewportPercentageLength())
    1547             wordSpacing = Length(styleResolver->viewportPercentageValue(*primitiveValue, primitiveValue->getDoubleValue()), Fixed);
    15481533        else
    15491534            return;
     
    19611946            return styleResolver->style()->setVerticalAlign(*primitiveValue);
    19621947
    1963         styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->state().cssToLengthConversionData()));
     1948        styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(styleResolver->state().cssToLengthConversionData()));
    19641949    }
    19651950
     
    23012286            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
    23022287            if (!primitiveValue->getValueID())
    2303                 lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->state().cssToLengthConversionData());
     2288                lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(styleResolver->state().cssToLengthConversionData());
    23042289#if ENABLE(CSS3_TEXT)
    23052290            else if (primitiveValue->getValueID() == CSSValueWebkitEachLine)
  • trunk/Source/WebCore/css/LengthFunctions.cpp

    r169245 r169407  
    2525#include "LengthFunctions.h"
    2626
     27#include "FloatSize.h"
    2728#include "LayoutUnit.h"
    2829#include "LengthSize.h"
    29 #include "RenderView.h"
    3030
    3131namespace WebCore {
    3232
    33 int minimumIntValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
     33int minimumIntValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages)
    3434{
    35     return static_cast<int>(minimumValueForLength(length, maximumValue, renderView, roundPercentages));
     35    return static_cast<int>(minimumValueForLength(length, maximumValue, roundPercentages));
    3636}
    3737
    38 int intValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
     38int intValueForLength(const Length& length, LayoutUnit maximumValue)
    3939{
    40     return static_cast<int>(valueForLength(length, maximumValue, renderView, roundPercentages));
     40    return static_cast<int>(valueForLength(length, maximumValue));
    4141}
    4242
    43 LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
     43LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages)
    4444{
    4545    switch (length.type()) {
     
    5353    case Calculated:
    5454        return length.nonNanCalculatedValue(maximumValue);
    55     case ViewportPercentageWidth:
    56         if (renderView)
    57             return LayoutUnit(renderView->viewportSizeForCSSViewportUnits().width() * length.viewportPercentageLength() / 100.0f);
    58         return 0;
    59     case ViewportPercentageHeight:
    60         if (renderView)
    61             return LayoutUnit(renderView->viewportSizeForCSSViewportUnits().height() * length.viewportPercentageLength() / 100.0f);
    62         return 0;
    63     case ViewportPercentageMin:
    64         if (renderView) {
    65             IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
    66             return LayoutUnit(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
    67         }
    68         return 0;
    69     case ViewportPercentageMax:
    70         if (renderView) {
    71             IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
    72             return LayoutUnit(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
    73         }
    74         return 0;
    7555    case FillAvailable:
    7656    case Auto:
     
    9070}
    9171
    92 LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
     72LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue)
    9373{
    9474    switch (length.type()) {
     
    9676    case Percent:
    9777    case Calculated:
    98     case ViewportPercentageWidth:
    99     case ViewportPercentageHeight:
    100     case ViewportPercentageMin:
    101     case ViewportPercentageMax:
    102         return minimumValueForLength(length, maximumValue, renderView, roundPercentages);
     78        return minimumValueForLength(length, maximumValue);
    10379    case FillAvailable:
    10480    case Auto:
     
    11995
    12096// FIXME: when subpixel layout is supported this copy of floatValueForLength() can be removed. See bug 71143.
    121 float floatValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView)
     97float floatValueForLength(const Length& length, LayoutUnit maximumValue)
    12298{
    12399    switch (length.type()) {
     
    130106        return static_cast<float>(maximumValue);
    131107    case Calculated:
    132         return length.nonNanCalculatedValue(maximumValue);               
    133     case ViewportPercentageWidth:
    134         if (renderView)
    135             return static_cast<int>(renderView->viewportSizeForCSSViewportUnits().width() * length.viewportPercentageLength() / 100.0f);
    136         return 0;
    137     case ViewportPercentageHeight:
    138         if (renderView)
    139             return static_cast<int>(renderView->viewportSizeForCSSViewportUnits().height() * length.viewportPercentageLength() / 100.0f);
    140         return 0;
    141     case ViewportPercentageMin:
    142         if (renderView) {
    143             IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
    144             return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
    145         }
    146         return 0;
    147     case ViewportPercentageMax:
    148         if (renderView) {
    149             IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
    150             return static_cast<int>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
    151         }
    152         return 0;
     108        return length.nonNanCalculatedValue(maximumValue);
    153109    case Relative:
    154110    case Intrinsic:
     
    165121}
    166122
    167 float floatValueForLength(const Length& length, float maximumValue, RenderView* renderView)
     123float floatValueForLength(const Length& length, float maximumValue)
    168124{
    169125    switch (length.type()) {
     
    177133    case Calculated:
    178134        return length.nonNanCalculatedValue(maximumValue);
    179     case ViewportPercentageWidth:
    180         if (renderView)
    181             return static_cast<int>(renderView->viewportSizeForCSSViewportUnits().width() * length.viewportPercentageLength() / 100.0f);
    182         return 0;
    183     case ViewportPercentageHeight:
    184         if (renderView)
    185             return static_cast<int>(renderView->viewportSizeForCSSViewportUnits().height() * length.viewportPercentageLength() / 100.0f);
    186         return 0;
    187     case ViewportPercentageMin:
    188         if (renderView) {
    189             IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
    190             return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
    191         }
    192         return 0;
    193     case ViewportPercentageMax:
    194         if (renderView) {
    195             IntSize viewportSize = renderView->viewportSizeForCSSViewportUnits();
    196             return static_cast<int>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
    197         }
    198         return 0;
    199135    case Relative:
    200136    case Intrinsic:
     
    211147}
    212148
    213 FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize, RenderView* view)
     149FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize)
    214150{
    215     return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width(), view), floatValueForLength(lengthSize.height(), boxSize.height(), view));
     151    return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), floatValueForLength(lengthSize.height(), boxSize.height()));
    216152}
    217153
  • trunk/Source/WebCore/css/LengthFunctions.h

    r168481 r169407  
    3333struct LengthSize;
    3434
    35 int minimumIntValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
    36 int intValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
    37 LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
    38 LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
    39 float floatValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0);
    40 float floatValueForLength(const Length&, float maximumValue, RenderView* = 0);
    41 FloatSize floatSizeForLengthSize(const LengthSize&, const FloatSize&, RenderView* = 0);
     35int minimumIntValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false);
     36int intValueForLength(const Length&, LayoutUnit maximumValue);
     37LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false);
     38LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue);
     39float floatValueForLength(const Length&, LayoutUnit maximumValue);
     40float floatValueForLength(const Length&, float maximumValue);
     41FloatSize floatSizeForLengthSize(const LengthSize&, const FloatSize&);
    4242
    4343} // namespace WebCore
  • trunk/Source/WebCore/css/MediaQueryEvaluator.cpp

    r167937 r169407  
    726726    EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
    727727    if (func) {
    728         CSSToLengthConversionData conversionData(m_style.get(), m_frame->document()->documentElement()->renderStyle());
     728        CSSToLengthConversionData conversionData(m_style.get(),
     729            m_frame->document()->documentElement()->renderStyle(),
     730            m_frame->document()->renderView());
    729731        return func(expr->value(), conversionData, m_frame, NoPrefix);
    730732    }
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r169334 r169407  
    236236    m_filtersWithPendingSVGDocuments.clear();
    237237#endif
    238     m_cssToLengthConversionData = CSSToLengthConversionData(nullptr, nullptr);
     238    m_cssToLengthConversionData = CSSToLengthConversionData();
    239239}
    240240
     
    381381}
    382382
     383inline void StyleResolver::State::updateConversionData()
     384{
     385    m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle, m_element ? document().renderView() : nullptr);
     386}
     387
    383388inline void StyleResolver::State::initElement(Element* e)
    384389{
     
    386391    m_styledElement = e && e->isStyledElement() ? toStyledElement(e) : nullptr;
    387392    m_elementLinkState = e ? e->document().visitedLinkState().determineLinkState(e) : NotInsideLink;
     393    updateConversionData();
    388394}
    389395
     
    417423    m_fontDirty = false;
    418424
    419     m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle);
     425    updateConversionData();
     426}
     427
     428inline void StyleResolver::State::setStyle(PassRef<RenderStyle> style)
     429{
     430    m_style = std::move(style);
     431    updateConversionData();
    420432}
    421433
     
    796808    adjustRenderStyle(*state.style(), *state.parentStyle(), element);
    797809
     810    if (state.style()->hasViewportUnits())
     811        document().setHasStyleWithViewportUnits();
     812
    798813    state.clear(); // Clear out for the next resolve.
    799814
     
    964979    // Clean up our style object's display and text decorations (among other fixups).
    965980    adjustRenderStyle(*state.style(), *m_state.parentStyle(), 0);
     981
     982    if (state.style()->hasViewportUnits())
     983        document().setHasStyleWithViewportUnits();
    966984
    967985    // Start loading resources referenced by this style.
     
    13931411    checkForOrientationChange(style);
    13941412    style->font().update(m_fontSelector);
     1413    if (m_state.fontSizeHasViewportUnits())
     1414        style->setHasViewportUnits(true);
    13951415    m_state.setFontDirty(false);
    13961416}
     
    14381458Length StyleResolver::convertToIntLength(const CSSPrimitiveValue* primitiveValue, const CSSToLengthConversionData& conversionData)
    14391459{
    1440     return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(conversionData) : Length(Undefined);
     1460    return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | FractionConversion>(conversionData) : Length(Undefined);
    14411461}
    14421462
    14431463Length StyleResolver::convertToFloatLength(const CSSPrimitiveValue* primitiveValue, const CSSToLengthConversionData& conversionData)
    14441464{
    1445     return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(conversionData) : Length(Undefined);
     1465    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion>(conversionData) : Length(Undefined);
    14461466}
    14471467
     
    15641584{
    15651585    m_matchedPropertiesCache.clear();
     1586}
     1587
     1588void StyleResolver::clearCachedPropertiesAffectedByViewportUnits()
     1589{
     1590    Vector<unsigned, 16> toRemove;
     1591    for (auto& cacheKeyValue : m_matchedPropertiesCache) {
     1592        if (cacheKeyValue.value.renderStyle->hasViewportUnits())
     1593            toRemove.append(cacheKeyValue.key);
     1594    }
     1595    for (auto key : toRemove)
     1596        m_matchedPropertiesCache.remove(key);
    15661597}
    15671598
     
    18441875    }
    18451876
    1846     workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | CalculatedConversion | AutoConversion>(state.cssToLengthConversionData());
     1877    workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | AutoConversion>(state.cssToLengthConversionData());
    18471878    if (workingLength.length().isUndefined())
    18481879        return false;
     
    22882319            CSSShadowValue* item = toCSSShadowValue(currValue);
    22892320            int x = item->x->computeLength<int>(state.cssToLengthConversionData());
    2290             if (item->x->isViewportPercentageLength())
    2291                 x = viewportPercentageValue(*item->x, x);
    22922321            int y = item->y->computeLength<int>(state.cssToLengthConversionData());
    2293             if (item->y->isViewportPercentageLength())
    2294                 y = viewportPercentageValue(*item->y, y);
    22952322            int blur = item->blur ? item->blur->computeLength<int>(state.cssToLengthConversionData()) : 0;
    2296             if (item->blur && item->blur->isViewportPercentageLength())
    2297                 blur = viewportPercentageValue(*item->blur, blur);
    22982323            int spread = item->spread ? item->spread->computeLength<int>(state.cssToLengthConversionData()) : 0;
    2299             if (item->spread && item->spread->isViewportPercentageLength())
    2300                 spread = viewportPercentageValue(*item->spread, spread);
    23012324            ShadowStyle shadowStyle = item->style && item->style->getValueID() == CSSValueInset ? Inset : Normal;
    23022325            Color color;
     
    32373260}
    32383261
    3239 bool StyleResolver::affectedByViewportChange() const
     3262bool StyleResolver::hasMediaQueriesAffectedByViewportChange() const
    32403263{
    32413264    unsigned s = m_viewportDependentMediaQueryResults.size();
     
    34163439            CSSShadowValue* item = toCSSShadowValue(cssValue);
    34173440            int x = item->x->computeLength<int>(state.cssToLengthConversionData());
    3418             if (item->x->isViewportPercentageLength())
    3419                 x = viewportPercentageValue(*item->x, x);
    34203441            int y = item->y->computeLength<int>(state.cssToLengthConversionData());
    3421             if (item->y->isViewportPercentageLength())
    3422                 y = viewportPercentageValue(*item->y, y);
    34233442            IntPoint location(x, y);
    34243443            int blur = item->blur ? item->blur->computeLength<int>(state.cssToLengthConversionData()) : 0;
    3425             if (item->blur && item->blur->isViewportPercentageLength())
    3426                 blur = viewportPercentageValue(*item->blur, blur);
    34273444            Color color;
    34283445            if (item->color)
     
    36243641}
    36253642
    3626 int StyleResolver::viewportPercentageValue(CSSPrimitiveValue& unit, int percentage)
    3627 {
    3628     int viewPortHeight = document().renderView()->viewportSizeForCSSViewportUnits().height() * percentage / 100.0f;
    3629     int viewPortWidth = document().renderView()->viewportSizeForCSSViewportUnits().width() * percentage / 100.0f;
    3630 
    3631     if (unit.isViewportPercentageHeight())
    3632         return viewPortHeight;
    3633     if (unit.isViewportPercentageWidth())
    3634         return viewPortWidth;
    3635     if (unit.isViewportPercentageMax())
    3636         return std::max(viewPortWidth, viewPortHeight);
    3637     if (unit.isViewportPercentageMin())
    3638         return std::min(viewPortWidth, viewPortHeight);
    3639 
    3640     ASSERT_NOT_REACHED();
    3641     return 0;
    3642 }
    3643 
    36443643StyleResolver::CascadedProperties::CascadedProperties(TextDirection direction, WritingMode writingMode)
    36453644    : m_direction(direction)
  • trunk/Source/WebCore/css/StyleResolver.h

    r167937 r169407  
    221221    void addViewportDependentMediaQueryResult(const MediaQueryExp*, bool result);
    222222    bool hasViewportDependentMediaQueries() const { return !m_viewportDependentMediaQueryResults.isEmpty(); }
    223     bool affectedByViewportChange() const;
     223    bool hasMediaQueriesAffectedByViewportChange() const;
    224224
    225225    void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>);
     
    233233    void invalidateMatchedPropertiesCache();
    234234
     235    void clearCachedPropertiesAffectedByViewportUnits();
     236
    235237#if ENABLE(CSS_FILTERS)
    236238    bool createFilterOperations(CSSValue* inValue, FilterOperations& outOperations);
     
    239241
    240242    void loadPendingResources();
    241 
    242     int viewportPercentageValue(CSSPrimitiveValue& unit, int percentage);
    243243
    244244    struct RuleRange {
     
    334334    public:
    335335        State()
    336         : m_element(0)
    337         , m_styledElement(0)
    338         , m_parentStyle(0)
    339         , m_rootElementStyle(0)
    340         , m_regionForStyling(0)
    341         , m_elementLinkState(NotInsideLink)
    342         , m_elementAffectedByClassRules(false)
    343         , m_applyPropertyToRegularStyle(true)
    344         , m_applyPropertyToVisitedLinkStyle(false)
    345         , m_lineHeightValue(0)
    346         , m_fontDirty(false)
    347         , m_hasUAAppearance(false)
    348         , m_backgroundData(BackgroundFillLayer) { }
     336            : m_element(nullptr)
     337            , m_styledElement(nullptr)
     338            , m_parentStyle(nullptr)
     339            , m_rootElementStyle(nullptr)
     340            , m_regionForStyling(nullptr)
     341            , m_elementLinkState(NotInsideLink)
     342            , m_elementAffectedByClassRules(false)
     343            , m_applyPropertyToRegularStyle(true)
     344            , m_applyPropertyToVisitedLinkStyle(false)
     345            , m_lineHeightValue(nullptr)
     346            , m_fontDirty(false)
     347            , m_fontSizeHasViewportUnits(false)
     348            , m_hasUAAppearance(false)
     349            , m_backgroundData(BackgroundFillLayer)
     350        {
     351        }
    349352
    350353    public:
     
    356359        Element* element() const { return m_element; }
    357360        StyledElement* styledElement() const { return m_styledElement; }
    358         void setStyle(PassRef<RenderStyle> style)
    359         {
    360             m_style = std::move(style);
    361             m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle);
    362         }
     361        void setStyle(PassRef<RenderStyle>);
    363362        RenderStyle* style() const { return m_style.get(); }
    364363        PassRef<RenderStyle> takeStyle() { return m_style.releaseNonNull(); }
     
    386385        void setFontDirty(bool isDirty) { m_fontDirty = isDirty; }
    387386        bool fontDirty() const { return m_fontDirty; }
     387        void setFontSizeHasViewportUnits(bool hasViewportUnits) { m_fontSizeHasViewportUnits = hasViewportUnits; }
     388        bool fontSizeHasViewportUnits() const { return m_fontSizeHasViewportUnits; }
    388389
    389390        void cacheBorderAndBackground();
     
    406407
    407408    private:
    408         // FIXME(bug 108563): to make it easier to review, these member
    409         // variables are public. However we should add methods to access
    410         // these variables.
     409        void updateConversionData();
     410
    411411        Element* m_element;
    412412        RefPtr<RenderStyle> m_style;
     
    431431        CSSValue* m_lineHeightValue;
    432432        bool m_fontDirty;
     433        bool m_fontSizeHasViewportUnits;
    433434
    434435        bool m_hasUAAppearance;
  • trunk/Source/WebCore/css/TransformFunctions.cpp

    r167937 r169407  
    7979static Length convertToFloatLength(const CSSPrimitiveValue* primitiveValue, const CSSToLengthConversionData& conversionData)
    8080{
    81     return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(conversionData) : Length(Undefined);
     81    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion>(conversionData) : Length(Undefined);
    8282}
    8383
  • trunk/Source/WebCore/dom/Document.cpp

    r169244 r169407  
    115115#include "PopStateEvent.h"
    116116#include "ProcessingInstruction.h"
     117#include "RenderChildIterator.h"
    117118#include "RenderLayerCompositor.h"
    118119#include "RenderView.h"
     
    514515    , m_hasInjectedPlugInsScript(false)
    515516    , m_renderTreeBeingDestroyed(false)
     517    , m_hasStyleWithViewportUnits(false)
    516518{
    517519    allDocuments().add(this);
     
    18731875{
    18741876    RefPtr<RenderStyle> style = ensureStyleResolver().styleForPage(pageIndex);
    1875     RenderView* view = renderView();
    18761877
    18771878    int width = pageSize.width();
     
    18921893        ASSERT(size.width().isFixed());
    18931894        ASSERT(size.height().isFixed());
    1894         width = valueForLength(size.width(), 0, view);
    1895         height = valueForLength(size.height(), 0, view);
     1895        width = valueForLength(size.width(), 0);
     1896        height = valueForLength(size.height(), 0);
    18961897        break;
    18971898    }
     
    19031904    // The percentage is calculated with respect to the width even for margin top and bottom.
    19041905    // http://www.w3.org/TR/CSS2/box.html#margin-properties
    1905     marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(style->marginTop(), width, view);
    1906     marginRight = style->marginRight().isAuto() ? marginRight : intValueForLength(style->marginRight(), width, view);
    1907     marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLength(style->marginBottom(), width, view);
    1908     marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width, view);
     1906    marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(style->marginTop(), width);
     1907    marginRight = style->marginRight().isAuto() ? marginRight : intValueForLength(style->marginRight(), width);
     1908    marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLength(style->marginBottom(), width);
     1909    marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width);
    19091910}
    19101911
     
    31733174}
    31743175
     3176void Document::updateViewportUnitsOnResize()
     3177{
     3178    if (!hasStyleWithViewportUnits())
     3179        return;
     3180
     3181    ensureStyleResolver().clearCachedPropertiesAffectedByViewportUnits();
     3182
     3183    // FIXME: Ideally, we should save the list of elements that have viewport units and only iterate over those.
     3184    for (Element* element = ElementTraversal::firstWithin(&rootNode()); element; element = ElementTraversal::nextIncludingPseudo(element)) {
     3185        auto* renderer = element->renderer();
     3186        if (renderer && renderer->style().hasViewportUnits())
     3187            element->setNeedsStyleRecalc(InlineStyleChange);
     3188    }
     3189}
     3190
    31753191void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag)
    31763192{
  • trunk/Source/WebCore/dom/Document.h

    r169244 r169407  
    12741274#endif
    12751275
     1276    void setHasStyleWithViewportUnits() { m_hasStyleWithViewportUnits = true; }
     1277    bool hasStyleWithViewportUnits() const { return m_hasStyleWithViewportUnits; }
     1278    void updateViewportUnitsOnResize();
     1279
    12761280protected:
    12771281    enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
     
    16921696    bool m_hasInjectedPlugInsScript;
    16931697    bool m_renderTreeBeingDestroyed;
     1698
     1699    bool m_hasStyleWithViewportUnits;
    16941700};
    16951701
  • trunk/Source/WebCore/html/HTMLAreaElement.cpp

    r166491 r169407  
    144144
    145145    Path path;
    146     RenderView* renderView = document().renderView();
    147146    switch (shape) {
    148147        case Poly:
    149148            if (m_coordsLen >= 6) {
    150149                int numPoints = m_coordsLen / 2;
    151                 path.moveTo(FloatPoint(minimumValueForLength(m_coords[0], width, renderView), minimumValueForLength(m_coords[1], height, renderView)));
     150                path.moveTo(FloatPoint(minimumValueForLength(m_coords[0], width), minimumValueForLength(m_coords[1], height)));
    152151                for (int i = 1; i < numPoints; ++i)
    153                     path.addLineTo(FloatPoint(minimumValueForLength(m_coords[i * 2], width, renderView), minimumValueForLength(m_coords[i * 2 + 1], height, renderView)));
     152                    path.addLineTo(FloatPoint(minimumValueForLength(m_coords[i * 2], width), minimumValueForLength(m_coords[i * 2 + 1], height)));
    154153                path.closeSubpath();
    155154            }
     
    158157            if (m_coordsLen >= 3) {
    159158                Length radius = m_coords[2];
    160                 int r = std::min(minimumValueForLength(radius, width, renderView), minimumValueForLength(radius, height, renderView));
    161                 path.addEllipse(FloatRect(minimumValueForLength(m_coords[0], width, renderView) - r, minimumValueForLength(m_coords[1], height, renderView) - r, 2 * r, 2 * r));
     159                int r = std::min(minimumValueForLength(radius, width), minimumValueForLength(radius, height));
     160                path.addEllipse(FloatRect(minimumValueForLength(m_coords[0], width) - r, minimumValueForLength(m_coords[1], height) - r, 2 * r, 2 * r));
    162161            }
    163162            break;
    164163        case Rect:
    165164            if (m_coordsLen >= 4) {
    166                 int x0 = minimumValueForLength(m_coords[0], width, renderView);
    167                 int y0 = minimumValueForLength(m_coords[1], height, renderView);
    168                 int x1 = minimumValueForLength(m_coords[2], width, renderView);
    169                 int y1 = minimumValueForLength(m_coords[3], height, renderView);
     165                int x0 = minimumValueForLength(m_coords[0], width);
     166                int y0 = minimumValueForLength(m_coords[1], height);
     167                int x1 = minimumValueForLength(m_coords[2], width);
     168                int y1 = minimumValueForLength(m_coords[3], height);
    170169                path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
    171170            }
  • trunk/Source/WebCore/page/FrameView.cpp

    r169245 r169407  
    11451145        // Viewport-dependent media queries may cause us to need completely different style information.
    11461146        StyleResolver* styleResolver = document.styleResolverIfExists();
    1147         if (!styleResolver || styleResolver->affectedByViewportChange()) {
     1147        if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
    11481148            document.styleResolverChanged(DeferRecalcStyle);
    11491149            // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
     
    12481248                    else if (rootRenderer && rootRenderer->stretchesToViewport())
    12491249                        rootRenderer->setChildNeedsLayout();
     1250
     1251                    document.updateViewportUnitsOnResize();
    12501252                }
    12511253            }
  • trunk/Source/WebCore/platform/Length.h

    r167192 r169407  
    3838    MinContent, MaxContent, FillAvailable, FitContent,
    3939    Calculated,
    40     ViewportPercentageWidth, ViewportPercentageHeight, ViewportPercentageMin, ViewportPercentageMax,
    4140    Undefined
    4241};
    4342
    44 class CalculationValue;   
    45    
     43class CalculationValue;
     44
    4645struct Length {
    4746    WTF_MAKE_FAST_ALLOCATED;
     
    106105    bool isSpecified() const;
    107106    bool isSpecifiedOrIntrinsic() const;
    108     bool isViewportPercentage() const;
    109107
    110108    // Blend two lengths to produce a new length that is in between them. Used for animation.
     
    264262}
    265263
    266 inline float Length::viewportPercentageLength() const
    267 {
    268     ASSERT(isViewportPercentage());
    269     return value();
    270 }
    271 
    272264inline LengthType Length::type() const
    273265{
     
    398390inline bool Length::isSpecified() const
    399391{
    400     return isFixed() || isPercent() || isViewportPercentage();
     392    return isFixed() || isPercent();
    401393}
    402394
     
    404396{
    405397    return isSpecified() || isIntrinsic();
    406 }
    407 
    408 inline bool Length::isViewportPercentage() const
    409 {
    410     return type() >= ViewportPercentageWidth && type() <= ViewportPercentageMax;
    411398}
    412399
  • trunk/Source/WebCore/rendering/ClipPathOperation.h

    r168481 r169407  
    103103    const BasicShape* basicShape() const { return m_shape.get(); }
    104104    WindRule windRule() const { return m_shape->windRule(); }
    105     const Path pathForReferenceRect(const FloatRect& boundingRect, RenderView* view) const
     105    const Path pathForReferenceRect(const FloatRect& boundingRect) const
    106106    {
    107107        ASSERT(m_shape);
    108108        Path path;
    109         m_shape->path(path, boundingRect, view);
     109        m_shape->path(path, boundingRect);
    110110        return path;
    111111    }
     
    141141    }
    142142
    143     const Path pathForReferenceRect(const RoundedRect& boundingRect, RenderView*) const
     143    const Path pathForReferenceRect(const RoundedRect& boundingRect) const
    144144    {
    145145        Path path;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r169385 r169407  
    12401240    // FIXME: Technically percentage height objects only need a relayout if their percentage isn't going to be turned into
    12411241    // an auto value. Add a method to determine this, so that we can avoid the relayout.
    1242     if (relayoutChildren || (child.hasRelativeLogicalHeight() && !isRenderView()) || child.hasViewportPercentageLogicalHeight())
     1242    if (relayoutChildren || (child.hasRelativeLogicalHeight() && !isRenderView()))
    12431243        child.setChildNeedsLayout(MarkOnlyThis);
    12441244
     
    25422542                referenceBoxRect = borderBoxRect();
    25432543            }
    2544             if (!clipPath->pathForReferenceRect(referenceBoxRect, &view()).contains(locationInContainer.point() - localOffset, clipPath->windRule()))
     2544            if (!clipPath->pathForReferenceRect(referenceBoxRect).contains(locationInContainer.point() - localOffset, clipPath->windRule()))
    25452545                return false;
    25462546            break;
     
    25732573        LayoutRect borderRect = borderBoxRect();
    25742574        borderRect.moveBy(adjustedLocation);
    2575         RoundedRect border = style().getRoundedBorderFor(borderRect, &view());
     2575        RoundedRect border = style().getRoundedBorderFor(borderRect);
    25762576        if (!locationInContainer.intersects(border))
    25772577            return false;
     
    33413341        RenderStyle& s = firstLine ? firstLineStyle() : style();
    33423342        if (&s != &style())
    3343             return s.computedLineHeight(&view());
     3343            return s.computedLineHeight();
    33443344    }
    33453345   
    33463346    if (m_lineHeight == -1)
    3347         m_lineHeight = style().computedLineHeight(&view());
     3347        m_lineHeight = style().computedLineHeight();
    33483348
    33493349    return m_lineHeight;
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r169195 r169407  
    12431243        // into a transparency layer, and then clip that in one go (which requires setting up the clip before
    12441244        // beginning the layer).
    1245         RoundedRect border = style().getRoundedBorderFor(paintRect, &view());
     1245        RoundedRect border = style().getRoundedBorderFor(paintRect);
    12461246        stateSaver.save();
    12471247        paintInfo.context->clipRoundedRect(FloatRoundedRect(border));
     
    27322732    if (height.isPercent())
    27332733        return computePercentageLogicalHeight(height);
    2734     if (height.isViewportPercentage())
    2735         return valueForLength(height, 0);
    27362734    return -1;
    27372735}
     
    28192817            availableHeight = std::max<LayoutUnit>(0, contentBoxHeight);
    28202818        }
    2821     } else if (cbstyle.logicalHeight().isViewportPercentage()) {
    2822         LayoutUnit heightWithScrollbar = valueForLength(cbstyle.logicalHeight(), 0);
    2823         if (heightWithScrollbar != -1) {
    2824             LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(heightWithScrollbar);
    2825             // We need to adjust for min/max height because this method does
    2826             // not handle the min/max of the current block, its caller does.
    2827             // So the return value from the recursive call will not have been
    2828             // adjusted yet.
    2829             LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
    2830             availableHeight = std::max<LayoutUnit>(0, contentBoxHeight);
    2831         }
    28322819    } else if (isOutOfFlowPositionedWithSpecifiedHeight) {
    28332820        // Don't allow this to affect the block' height() member variable, since this
     
    28792866            return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalWidth, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth();
    28802867        }
    2881         case ViewportPercentageWidth:
    2882         case ViewportPercentageHeight:
    2883         case ViewportPercentageMin:
    2884         case ViewportPercentageMax:
    2885             return adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, 0));
    28862868        case FitContent:
    28872869        case FillAvailable:
     
    29772959            return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, availableHeight));
    29782960        }
    2979         case ViewportPercentageWidth:
    2980         case ViewportPercentageHeight:
    2981         case ViewportPercentageMin:
    2982         case ViewportPercentageMax:
    2983             return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, 0));
    29842961        default:
    29852962            return intrinsicLogicalHeight();
     
    47324709}
    47334710
    4734 bool RenderBox::hasViewportPercentageLogicalHeight() const
    4735 {
    4736     return style().logicalHeight().isViewportPercentage()
    4737         || style().logicalMinHeight().isViewportPercentage()
    4738         || style().logicalMaxHeight().isViewportPercentage();
    4739 }
    4740 
    47414711static void markBoxForRelayoutAfterSplit(RenderBox* box)
    47424712{
  • trunk/Source/WebCore/rendering/RenderBox.h

    r168993 r169407  
    571571    virtual bool hasRelativeDimensions() const;
    572572    virtual bool hasRelativeLogicalHeight() const;
    573     bool hasViewportPercentageLogicalHeight() const;
    574573
    575574    bool hasHorizontalLayoutOverflow() const
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r169257 r169407  
    511511    bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
    512512{
    513     RoundedRect border = style().getRoundedBorderFor(borderRect, &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
     513    RoundedRect border = style().getRoundedBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
    514514    if (box && (box->nextLineBox() || box->prevLineBox())) {
    515         RoundedRect segmentBorder = style().getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
     515        RoundedRect segmentBorder = style().getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightEdge);
    516516        border.setRadii(segmentBorder.radii());
    517517    }
     
    953953            if (layerWidth.isFixed())
    954954                tileSize.setWidth(layerWidth.value());
    955             else if (layerWidth.isPercent() || layerWidth.isViewportPercentage())
     955            else if (layerWidth.isPercent())
    956956                tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.width()));
    957957           
    958958            if (layerHeight.isFixed())
    959959                tileSize.setHeight(layerHeight.value());
    960             else if (layerHeight.isPercent() || layerHeight.isViewportPercentage())
     960            else if (layerHeight.isPercent())
    961961                tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.height()));
    962962
     
    12291229}
    12301230
    1231 static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent, RenderView* renderView)
     1231static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent)
    12321232{
    12331233    if (borderSlice.isRelative())
     
    12351235    if (borderSlice.isAuto())
    12361236        return imageSide;
    1237     return valueForLength(borderSlice, boxExtent, renderView);
     1237    return valueForLength(borderSlice, boxExtent);
    12381238}
    12391239
     
    12651265    LayoutUnit imageWidth = imageSize.width();
    12661266    LayoutUnit imageHeight = imageSize.height();
    1267     RenderView* renderView = &view();
    12681267
    12691268    float imageScaleFactor = styleImage->imageScaleFactor();
     
    12761275    ENinePieceImageRule vRule = ninePieceImage.verticalRule();
    12771276
    1278     LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style.borderTopWidth(), topSlice, borderImageRect.height(), renderView);
    1279     LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style.borderRightWidth(), rightSlice, borderImageRect.width(), renderView);
    1280     LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style.borderBottomWidth(), bottomSlice, borderImageRect.height(), renderView);
    1281     LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style.borderLeftWidth(), leftSlice, borderImageRect.width(), renderView);
    1282    
     1277    LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style.borderTopWidth(), topSlice, borderImageRect.height());
     1278    LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style.borderRightWidth(), rightSlice, borderImageRect.width());
     1279    LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style.borderBottomWidth(), bottomSlice, borderImageRect.height());
     1280    LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style.borderLeftWidth(), leftSlice, borderImageRect.width());
     1281
    12831282    // Reduce the widths if they're too large.
    12841283    // The spec says: Given Lwidth as the width of the border image area, Lheight as its height, and Wside as the border image width
     
    17291728    BorderEdge edges[4];
    17301729    BorderEdge::getBorderEdgeInfo(edges, style, document().deviceScaleFactor(), includeLogicalLeftEdge, includeLogicalRightEdge);
    1731     RoundedRect outerBorder = style.getRoundedBorderFor(rect, &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
     1730    RoundedRect outerBorder = style.getRoundedBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
    17321731    RoundedRect innerBorder = style.getRoundedInnerBorderFor(borderInnerRectAdjustedForBleedAvoidance(*graphicsContext, rect, bleedAvoidance), includeLogicalLeftEdge, includeLogicalRightEdge);
    17331732
     
    23712370
    23722371    RoundedRect border = (shadowStyle == Inset) ? style.getRoundedInnerBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge)
    2373         : style.getRoundedBorderFor(paintRect, &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
     2372        : style.getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge);
    23742373
    23752374    bool hasBorderRadius = style.hasBorderRadius();
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r169385 r169407  
    12451245        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit();
    12461246        LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadowExtent.right(), std::min<LayoutUnit>(newBounds.width(), oldBounds.width()));
    1247         LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight, std::max<LayoutUnit>(valueForLength(style().borderTopRightRadius().width(), boxWidth, &view()), valueForLength(style().borderBottomRightRadius().width(), boxWidth)));
     1247        LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight, std::max<LayoutUnit>(valueForLength(style().borderTopRightRadius().width(), boxWidth), valueForLength(style().borderBottomRightRadius().width(), boxWidth)));
    12481248        LayoutUnit decorationsWidth = std::max<LayoutUnit>(-outlineStyle.outlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(outlineWidth, shadowRight);
    12491249        LayoutRect rightRect(newOutlineBox.x() + std::min(newOutlineBox.width(), oldOutlineBox.width()) - decorationsWidth,
  • trunk/Source/WebCore/rendering/RenderElement.h

    r169385 r169407  
    177177    void propagateStyleToAnonymousChildren(StylePropagationType);
    178178
    179     LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false) const;
     179    LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue) const;
    180180    LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false) const;
    181181
     
    267267}
    268268
    269 inline LayoutUnit RenderElement::valueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
    270 {
    271     return WebCore::valueForLength(length, maximumValue, &view(), roundPercentages);
     269inline LayoutUnit RenderElement::valueForLength(const Length& length, LayoutUnit maximumValue) const
     270{
     271    return WebCore::valueForLength(length, maximumValue);
    272272}
    273273
    274274inline LayoutUnit RenderElement::minimumValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
    275275{
    276     return WebCore::minimumValueForLength(length, maximumValue, &view(), roundPercentages);
     276    return WebCore::minimumValueForLength(length, maximumValue, roundPercentages);
    277277}
    278278
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r169372 r169407  
    816816        LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForChild(child, ForColumns, sizingData.columnTracks);
    817817        LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadthForChild(child, ForRows, sizingData.rowTracks);
    818         if (oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth || (oldOverrideContainingBlockContentLogicalHeight != overrideContainingBlockContentLogicalHeight && (child->hasRelativeLogicalHeight() || child->hasViewportPercentageLogicalHeight())))
     818        if (oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth || (oldOverrideContainingBlockContentLogicalHeight != overrideContainingBlockContentLogicalHeight && child->hasRelativeLogicalHeight()))
    819819            child->setNeedsLayout(MarkOnlyThis);
    820820
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r168437 r169407  
    740740    if (margin.isPercent())
    741741        return minimumValueForLength(margin, std::max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
    742     if (margin.isViewportPercentage())
    743         return valueForLength(margin, 0, &renderer->view());
    744742    return 0;
    745743}
     
    14001398        const RenderStyle& firstLineStyle = this->firstLineStyle();
    14011399        if (&firstLineStyle != &style())
    1402             return firstLineStyle.computedLineHeight(&view());
    1403     }
    1404 
    1405     return style().computedLineHeight(&view());
     1400            return firstLineStyle.computedLineHeight();
     1401    }
     1402
     1403    return style().computedLineHeight();
    14061404}
    14071405
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r169402 r169407  
    38303830        LayoutRect referenceBox = computeReferenceBox(renderer(), clippingPath, offsetFromRoot, rootRelativeBounds);
    38313831        context->save();
    3832         context->clipPath(clippingPath.pathForReferenceRect(referenceBox, &m_renderer.view()), clippingPath.windRule());
     3832        context->clipPath(clippingPath.pathForReferenceRect(referenceBox), clippingPath.windRule());
    38333833        return true;
    38343834    }
     
    38413841
    38423842        context->save();
    3843         context->clipPath(clippingPath.pathForReferenceRect(shapeRect, &m_renderer.view()), RULE_NONZERO);
     3843        context->clipPath(clippingPath.pathForReferenceRect(shapeRect), RULE_NONZERO);
    38443844        return true;
    38453845    }
  • trunk/Source/WebCore/rendering/RenderLineBreak.cpp

    r168366 r169407  
    5959        const RenderStyle& firstLineStyle = this->firstLineStyle();
    6060        if (&firstLineStyle != &style())
    61             return firstLineStyle.computedLineHeight(&view());
     61            return firstLineStyle.computedLineHeight();
    6262    }
    6363
    6464    if (m_cachedLineHeight == invalidLineHeight)
    65         m_cachedLineHeight = style().computedLineHeight(&view());
     65        m_cachedLineHeight = style().computedLineHeight();
    6666   
    6767    return m_cachedLineHeight;
  • trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp

    r163973 r169407  
    8080}
    8181
    82 static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength, RenderView* renderView)
     82static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength)
    8383{
    8484    if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto()))
    85         return minimumValueForLength(length, containingLength, renderView);
     85        return minimumValueForLength(length, containingLength);
    8686    return ScrollbarTheme::theme()->scrollbarThickness();
    8787}
     
    9191    if (!m_scrollbar->owningRenderer())
    9292        return;
    93     RenderView* renderView = &view();
    9493    // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
    9594    // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
    9695    int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style().borderLeftWidth() - m_scrollbar->owningRenderer()->style().borderRightWidth();
    97     int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width(), visibleSize, renderView);
    98     int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth(), visibleSize, renderView);
    99     int maxWidth = style().maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style().maxWidth(), visibleSize, renderView);
     96    int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width(), visibleSize);
     97    int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth(), visibleSize);
     98    int maxWidth = style().maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style().maxWidth(), visibleSize);
    10099    setWidth(std::max(minWidth, std::min(maxWidth, w)));
    101100   
    102101    // Buttons and track pieces can all have margins along the axis of the scrollbar.
    103     m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), visibleSize, renderView));
    104     m_marginBox.setRight(minimumValueForLength(style().marginRight(), visibleSize, renderView));
     102    m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), visibleSize));
     103    m_marginBox.setRight(minimumValueForLength(style().marginRight(), visibleSize));
    105104}
    106105
     
    109108    if (!m_scrollbar->owningRenderer())
    110109        return;
    111     RenderView* renderView = &view();
    112110    // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
    113111    // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
    114112    int visibleSize = m_scrollbar->owningRenderer()->height() -  m_scrollbar->owningRenderer()->style().borderTopWidth() - m_scrollbar->owningRenderer()->style().borderBottomWidth();
    115     int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height(), visibleSize, renderView);
    116     int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight(), visibleSize, renderView);
    117     int maxHeight = style().maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style().maxHeight(), visibleSize, renderView);
     113    int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height(), visibleSize);
     114    int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight(), visibleSize);
     115    int maxHeight = style().maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style().maxHeight(), visibleSize);
    118116    setHeight(std::max(minHeight, std::min(maxHeight, h)));
    119117
    120118    // Buttons and track pieces can all have margins along the axis of the scrollbar.
    121     m_marginBox.setTop(minimumValueForLength(style().marginTop(), visibleSize, renderView));
    122     m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), visibleSize, renderView));
     119    m_marginBox.setTop(minimumValueForLength(style().marginTop(), visibleSize));
     120    m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), visibleSize));
    123121}
    124122
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r168967 r169407  
    373373    } else if (styleLogicalHeight.isPercent())
    374374        computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeight);
    375     else if (styleLogicalHeight.isViewportPercentage())
    376         computedLogicalHeight = minimumValueForLength(styleLogicalHeight, 0);
    377375    else
    378376        ASSERT_NOT_REACHED();
     
    786784
    787785    RenderStyle& styleToUse = style();
    788     // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for min-width.
     786    // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for min-width.
    789787    if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().value() > 0) {
    790788        m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
     
    792790    }
    793791
    794     // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for maxWidth.
     792    // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for maxWidth.
    795793    if (styleToUse.logicalMaxWidth().isFixed()) {
    796794        m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r169223 r169407  
    541541    Document& document = element->document();
    542542    RefPtr<CSSPrimitiveValue> emSize = CSSPrimitiveValue::create(0.5, CSSPrimitiveValue::CSS_EMS);
    543     int pixels = emSize->computeLength<int>(CSSToLengthConversionData(style, document.renderStyle(), document.frame()->pageZoomFactor()));
     543    int pixels = emSize->computeLength<int>(CSSToLengthConversionData(style, document.renderStyle(), document.renderView(), document.frame()->pageZoomFactor()));
    544544    style->setPaddingBox(LengthBox(0, pixels, 0, pixels));
    545545}
     
    947947    // Set padding: 0 1.0em; on buttons.
    948948    // CSSPrimitiveValue::computeLengthInt only needs the element's style to calculate em lengths.
    949     // Since the element might not be in a document, just pass nullptr for the root element style.
     949    // Since the element might not be in a document, just pass nullptr for the root element style
     950    // and the render view.
    950951    RefPtr<CSSPrimitiveValue> emSize = CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::CSS_EMS);
    951     int pixels = emSize->computeLength<int>(CSSToLengthConversionData(style, nullptr, 1.0, false));
     952    int pixels = emSize->computeLength<int>(CSSToLengthConversionData(style, nullptr, nullptr, 1.0, false));
    952953    style->setPaddingBox(LengthBox(0, pixels, 0, pixels));
    953954
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r168870 r169407  
    12171217    GraphicsContextStateSaver stateSaver(*paintInfo.context);
    12181218
    1219     FloatRoundedRect border = FloatRoundedRect(o.style().getRoundedBorderFor(r, &o.view()));
     1219    FloatRoundedRect border = FloatRoundedRect(o.style().getRoundedBorderFor(r));
    12201220    int radius = border.radii().topLeft().width();
    12211221
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r169245 r169407  
    331331        for (auto& box : childrenOfType<RenderBox>(*this)) {
    332332            if (box.hasRelativeLogicalHeight()
    333                 || box.hasViewportPercentageLogicalHeight()
    334333                || box.style().logicalHeight().isPercent()
    335334                || box.style().logicalMinHeight().isPercent()
    336335                || box.style().logicalMaxHeight().isPercent()
    337                 || box.style().logicalHeight().isViewportPercentage()
    338                 || box.style().logicalMinHeight().isViewportPercentage()
    339                 || box.style().logicalMaxHeight().isViewportPercentage()
    340336                || box.isSVGRoot()
    341337                )
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r168967 r169407  
    979979            else
    980980                lineHeight = renderer->lineHeight(firstLine, lineDirection);
    981             verticalPosition -= valueForLength(renderer->style().verticalAlignLength(), lineHeight, &renderer->view());
     981            verticalPosition -= valueForLength(renderer->style().verticalAlignLength(), lineHeight);
    982982        }
    983983    }
  • trunk/Source/WebCore/rendering/shapes/Shape.cpp

    r168481 r169407  
    9191}
    9292
    93 std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin, RenderView* view)
     93std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin)
    9494{
    9595    ASSERT(basicShape);
     
    104104    case BasicShape::BasicShapeCircleType: {
    105105        const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(basicShape);
    106         float centerX = floatValueForCenterCoordinate(circle->centerX(), boxWidth, view);
    107         float centerY = floatValueForCenterCoordinate(circle->centerY(), boxHeight, view);
    108         float radius = circle->floatValueForRadiusInBox(boxWidth, boxHeight, view);
     106        float centerX = floatValueForCenterCoordinate(circle->centerX(), boxWidth);
     107        float centerY = floatValueForCenterCoordinate(circle->centerY(), boxHeight);
     108        float radius = circle->floatValueForRadiusInBox(boxWidth, boxHeight);
    109109        FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode);
    110110
     
    115115    case BasicShape::BasicShapeEllipseType: {
    116116        const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape);
    117         float centerX = floatValueForCenterCoordinate(ellipse->centerX(), boxWidth, view);
    118         float centerY = floatValueForCenterCoordinate(ellipse->centerY(), boxHeight, view);
    119         float radiusX = ellipse->floatValueForRadiusInBox(ellipse->radiusX(), centerX, boxWidth, view);
    120         float radiusY = ellipse->floatValueForRadiusInBox(ellipse->radiusY(), centerY, boxHeight, view);
     117        float centerX = floatValueForCenterCoordinate(ellipse->centerX(), boxWidth);
     118        float centerY = floatValueForCenterCoordinate(ellipse->centerY(), boxHeight);
     119        float radiusX = ellipse->floatValueForRadiusInBox(ellipse->radiusX(), centerX, boxWidth);
     120        float radiusY = ellipse->floatValueForRadiusInBox(ellipse->radiusY(), centerY, boxHeight);
    121121        FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode);
    122122
     
    133133        for (unsigned i = 0; i < valuesSize; i += 2) {
    134134            FloatPoint vertex(
    135                 floatValueForLength(values.at(i), boxWidth, view),
    136                 floatValueForLength(values.at(i + 1), boxHeight, view));
     135                floatValueForLength(values.at(i), boxWidth),
     136                floatValueForLength(values.at(i + 1), boxHeight));
    137137            (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxSize.height(), writingMode);
    138138        }
     
    144144    case BasicShape::BasicShapeInsetType: {
    145145        const BasicShapeInset& inset = *static_cast<const BasicShapeInset*>(basicShape);
    146         float left = floatValueForLength(inset.left(), boxWidth, view);
    147         float top = floatValueForLength(inset.top(), boxHeight, view);
     146        float left = floatValueForLength(inset.left(), boxWidth);
     147        float top = floatValueForLength(inset.top(), boxHeight);
    148148        FloatRect rect(left,
    149149            top,
    150             std::max<float>(boxWidth - left - floatValueForLength(inset.right(), boxWidth, view), 0),
    151             std::max<float>(boxHeight - top - floatValueForLength(inset.bottom(), boxHeight, view), 0));
     150            std::max<float>(boxWidth - left - floatValueForLength(inset.right(), boxWidth), 0),
     151            std::max<float>(boxHeight - top - floatValueForLength(inset.bottom(), boxHeight), 0));
    152152        FloatRect logicalRect = physicalRectToLogical(rect, logicalBoxSize.height(), writingMode);
    153153
    154154        FloatSize boxSize(boxWidth, boxHeight);
    155         FloatSize topLeftRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.topLeftRadius(), boxSize, view), writingMode);
    156         FloatSize topRightRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.topRightRadius(), boxSize, view), writingMode);
    157         FloatSize bottomLeftRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.bottomLeftRadius(), boxSize, view), writingMode);
    158         FloatSize bottomRightRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.bottomRightRadius(), boxSize, view), writingMode);
     155        FloatSize topLeftRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.topLeftRadius(), boxSize), writingMode);
     156        FloatSize topRightRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.topRightRadius(), boxSize), writingMode);
     157        FloatSize bottomLeftRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.bottomLeftRadius(), boxSize), writingMode);
     158        FloatSize bottomRightRadius = physicalSizeToLogical(floatSizeForLengthSize(inset.bottomRightRadius(), boxSize), writingMode);
    159159        FloatRoundedRect::Radii cornerRadii(topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
    160160
  • trunk/Source/WebCore/rendering/shapes/Shape.h

    r168481 r169407  
    5050class BasicShape;
    5151class Image;
    52 class RenderView;
    5352class RoundedRect;
    5453
     
    6867    };
    6968
    70     static std::unique_ptr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, float margin, RenderView*);
     69    static std::unique_ptr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, float margin);
    7170    static std::unique_ptr<Shape> createRasterShape(Image*, float threshold, const LayoutRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin);
    7271    static std::unique_ptr<Shape> createBoxShape(const RoundedRect&, WritingMode, float margin);
  • trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp

    r168481 r169407  
    175175
    176176    WritingMode writingMode = containingBlockStyle.writingMode();
    177     float margin = floatValueForLength(m_renderer.style().shapeMargin(), m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : LayoutUnit(), &m_renderer.view());
     177    float margin = floatValueForLength(m_renderer.style().shapeMargin(), m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : LayoutUnit());
    178178    float shapeImageThreshold = style.shapeImageThreshold();
    179179    const ShapeValue& shapeValue = *style.shapeOutside();
     
    182182    case ShapeValue::Shape:
    183183        ASSERT(shapeValue.shape());
    184         m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSize, writingMode, margin, &m_renderer.view());
     184        m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSize, writingMode, margin);
    185185        break;
    186186    case ShapeValue::Image: {
  • trunk/Source/WebCore/rendering/style/BasicShapes.cpp

    r168481 r169407  
    8989}
    9090
    91 float BasicShapeCircle::floatValueForRadiusInBox(float boxWidth, float boxHeight, RenderView* view) const
     91float BasicShapeCircle::floatValueForRadiusInBox(float boxWidth, float boxHeight) const
    9292{
    9393    if (m_radius.type() == BasicShapeRadius::Value)
    9494        return floatValueForLength(m_radius.value(), sqrtf((boxWidth * boxWidth + boxHeight * boxHeight) / 2));
    9595
    96     float centerX = floatValueForCenterCoordinate(m_centerX, boxWidth, view);
    97     float centerY = floatValueForCenterCoordinate(m_centerY, boxHeight, view);
     96    float centerX = floatValueForCenterCoordinate(m_centerX, boxWidth);
     97    float centerY = floatValueForCenterCoordinate(m_centerY, boxHeight);
    9898
    9999    if (m_radius.type() == BasicShapeRadius::ClosestSide)
     
    104104}
    105105
    106 void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox, RenderView* view)
    107 {
    108     ASSERT(path.isEmpty());
    109 
    110     float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width(), view);
    111     float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height(), view);
    112     float radius = floatValueForRadiusInBox(boundingBox.width(), boundingBox.height(), view);
     106void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox)
     107{
     108    ASSERT(path.isEmpty());
     109
     110    float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width());
     111    float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height());
     112    float radius = floatValueForRadiusInBox(boundingBox.width(), boundingBox.height());
    113113    path.addEllipse(FloatRect(
    114114        centerX - radius + boundingBox.x(),
     
    131131}
    132132
    133 float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius, float center, float boxWidthOrHeight, RenderView* view) const
     133float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius, float center, float boxWidthOrHeight) const
    134134{
    135135    if (radius.type() == BasicShapeRadius::Value)
    136         return floatValueForLength(radius.value(), boxWidthOrHeight, view);
     136        return floatValueForLength(radius.value(), boxWidthOrHeight);
    137137
    138138    if (radius.type() == BasicShapeRadius::ClosestSide)
     
    143143}
    144144
    145 void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox, RenderView* view)
    146 {
    147     ASSERT(path.isEmpty());
    148 
    149     float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width(), view);
    150     float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height(), view);
    151     float radiusX = floatValueForRadiusInBox(m_radiusX, centerX, boundingBox.width(), view);
    152     float radiusY = floatValueForRadiusInBox(m_radiusY, centerY, boundingBox.height(), view);
     145void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
     146{
     147    ASSERT(path.isEmpty());
     148
     149    float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width());
     150    float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height());
     151    float radiusX = floatValueForRadiusInBox(m_radiusX, centerX, boundingBox.width());
     152    float radiusY = floatValueForRadiusInBox(m_radiusY, centerY, boundingBox.height());
    153153    path.addEllipse(FloatRect(
    154154        centerX - radiusX + boundingBox.x(),
     
    180180}
    181181
    182 void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox, RenderView* view)
     182void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox)
    183183{
    184184    ASSERT(path.isEmpty());
     
    189189        return;
    190190
    191     path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width(), view) + boundingBox.x(),
    192         floatValueForLength(m_values.at(1), boundingBox.height(), view) + boundingBox.y()));
     191    path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width()) + boundingBox.x(),
     192        floatValueForLength(m_values.at(1), boundingBox.height()) + boundingBox.y()));
    193193    for (size_t i = 2; i < length; i = i + 2) {
    194         path.addLineTo(FloatPoint(floatValueForLength(m_values.at(i), boundingBox.width(), view) + boundingBox.x(),
    195             floatValueForLength(m_values.at(i + 1), boundingBox.height(), view) + boundingBox.y()));
     194        path.addLineTo(FloatPoint(floatValueForLength(m_values.at(i), boundingBox.width()) + boundingBox.x(),
     195            floatValueForLength(m_values.at(i + 1), boundingBox.height()) + boundingBox.y()));
    196196    }
    197197    path.closeSubpath();
     
    221221}
    222222
    223 static FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatRect& boundingBox, RenderView* view)
    224 {
    225     return FloatSize(floatValueForLength(lengthSize.width(), boundingBox.width(), view),
    226         floatValueForLength(lengthSize.height(), boundingBox.height(), view));
    227 }
    228 
    229 void BasicShapeInset::path(Path& path, const FloatRect& boundingBox, RenderView* view)
    230 {
    231     ASSERT(path.isEmpty());
    232     float left = floatValueForLength(m_left, boundingBox.width(), view);
    233     float top = floatValueForLength(m_top, boundingBox.height(), view);
     223static FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatRect& boundingBox)
     224{
     225    return FloatSize(floatValueForLength(lengthSize.width(), boundingBox.width()),
     226        floatValueForLength(lengthSize.height(), boundingBox.height()));
     227}
     228
     229void BasicShapeInset::path(Path& path, const FloatRect& boundingBox)
     230{
     231    ASSERT(path.isEmpty());
     232    float left = floatValueForLength(m_left, boundingBox.width());
     233    float top = floatValueForLength(m_top, boundingBox.height());
    234234    FloatRoundedRect r = FloatRoundedRect(
    235235        FloatRect(
    236236            left + boundingBox.x(),
    237237            top + boundingBox.y(),
    238             std::max<float>(boundingBox.width() - left - floatValueForLength(m_right, boundingBox.width(), view), 0),
    239             std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height(), view), 0)
     238            std::max<float>(boundingBox.width() - left - floatValueForLength(m_right, boundingBox.width()), 0),
     239            std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height()), 0)
    240240        ),
    241         floatSizeForLengthSize(m_topLeftRadius, boundingBox, view),
    242         floatSizeForLengthSize(m_topRightRadius, boundingBox, view),
    243         floatSizeForLengthSize(m_bottomLeftRadius, boundingBox, view),
    244         floatSizeForLengthSize(m_bottomRightRadius, boundingBox, view)
     241        floatSizeForLengthSize(m_topLeftRadius, boundingBox),
     242        floatSizeForLengthSize(m_topRightRadius, boundingBox),
     243        floatSizeForLengthSize(m_bottomLeftRadius, boundingBox),
     244        floatSizeForLengthSize(m_bottomRightRadius, boundingBox)
    245245    );
    246246    path.addRoundedRect(r);
  • trunk/Source/WebCore/rendering/style/BasicShapes.h

    r168481 r169407  
    4444class Path;
    4545class RenderBox;
    46 class RenderView;
    4746
    4847class BasicShape : public RefCounted<BasicShape> {
     
    5958    bool canBlend(const BasicShape*) const;
    6059
    61     virtual void path(Path&, const FloatRect&, RenderView*) = 0;
     60    virtual void path(Path&, const FloatRect&) = 0;
    6261    virtual WindRule windRule() const { return RULE_NONZERO; }
    6362    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0;
     
    153152    const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
    154153    const BasicShapeRadius& radius() const { return m_radius; }
    155     float floatValueForRadiusInBox(float boxWidth, float boxHeight, RenderView*) const;
     154    float floatValueForRadiusInBox(float boxWidth, float boxHeight) const;
    156155
    157156    void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = std::move(centerX); }
     
    159158    void setRadius(BasicShapeRadius radius) { m_radius = std::move(radius); }
    160159
    161     virtual void path(Path&, const FloatRect&, RenderView*) override;
     160    virtual void path(Path&, const FloatRect&) override;
    162161    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
    163162
     
    179178    const BasicShapeRadius& radiusX() const { return m_radiusX; }
    180179    const BasicShapeRadius& radiusY() const { return m_radiusY; }
    181     float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight, RenderView*) const;
     180    float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const;
    182181
    183182    void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = std::move(centerX); }
     
    186185    void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = std::move(radiusY); }
    187186
    188     virtual void path(Path&, const FloatRect&, RenderView*) override;
     187    virtual void path(Path&, const FloatRect&) override;
    189188    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
    190189
     
    210209    void appendPoint(Length x, Length y) { m_values.append(std::move(x)); m_values.append(std::move(y)); }
    211210
    212     virtual void path(Path&, const FloatRect&, RenderView*) override;
     211    virtual void path(Path&, const FloatRect&) override;
    213212    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
    214213
     
    249248    void setBottomLeftRadius(LengthSize radius) { m_bottomLeftRadius = std::move(radius); }
    250249
    251     virtual void path(Path&, const FloatRect&, RenderView*) override;
     250    virtual void path(Path&, const FloatRect&) override;
    252251    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
    253252
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r169089 r169407  
    10281028}
    10291029
    1030 static RoundedRect::Radii calcRadiiFor(const BorderData& border, const LayoutSize& size, RenderView* renderView)
     1030static RoundedRect::Radii calcRadiiFor(const BorderData& border, const LayoutSize& size)
    10311031{
    10321032    return RoundedRect::Radii(
    1033         LayoutSize(valueForLength(border.topLeft().width(), size.width(), renderView),
    1034             valueForLength(border.topLeft().height(), size.height(), renderView)),
    1035         LayoutSize(valueForLength(border.topRight().width(), size.width(), renderView),
    1036             valueForLength(border.topRight().height(), size.height(), renderView)),
    1037         LayoutSize(valueForLength(border.bottomLeft().width(), size.width(), renderView),
    1038             valueForLength(border.bottomLeft().height(), size.height(), renderView)),
    1039         LayoutSize(valueForLength(border.bottomRight().width(), size.width(), renderView),
    1040             valueForLength(border.bottomRight().height(), size.height(), renderView)));
     1033        LayoutSize(valueForLength(border.topLeft().width(), size.width()),
     1034            valueForLength(border.topLeft().height(), size.height())),
     1035        LayoutSize(valueForLength(border.topRight().width(), size.width()),
     1036            valueForLength(border.topRight().height(), size.height())),
     1037        LayoutSize(valueForLength(border.bottomLeft().width(), size.width()),
     1038            valueForLength(border.bottomLeft().height(), size.height())),
     1039        LayoutSize(valueForLength(border.bottomRight().width(), size.width()),
     1040            valueForLength(border.bottomRight().height(), size.height())));
    10411041}
    10421042
     
    10581058void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v); }
    10591059
    1060 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, RenderView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
     1060RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
    10611061{
    10621062    RoundedRect roundedRect(borderRect);
    10631063    if (hasBorderRadius()) {
    1064         RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView);
     1064        RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size());
    10651065        radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii));
    10661066        roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
     
    13431343void RenderStyle::setLineHeight(Length specifiedLineHeight) { SET_VAR(inherited, line_height, specifiedLineHeight); }
    13441344
    1345 int RenderStyle::computedLineHeight(RenderView* renderView) const
     1345int RenderStyle::computedLineHeight() const
    13461346{
    13471347    const Length& lh = lineHeight();
     
    13531353    if (lh.isPercent())
    13541354        return minimumValueForLength(lh, fontSize());
    1355 
    1356     if (lh.isViewportPercentage())
    1357         return valueForLength(lh, 0, renderView);
    13581355
    13591356    return lh.value();
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r169089 r169407  
    177177                | pageBreakMask << pageBreakAfterOffset
    178178                | oneBitMask << explicitInheritanceOffset
    179                 | tableLayoutBitMask << tableLayoutOffset;
     179                | tableLayoutBitMask << tableLayoutOffset
     180                | hasViewportUnitsBitMask << hasViewportUnitsOffset;
    180181
    181182            m_flags = (m_flags & ~nonInheritedMask) | (other.m_flags & nonInheritedMask);
     
    202203        EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(getValue(unicodeBidiMask, unicodeBidiOffset)); }
    203204        void setUnicodeBidi(EUnicodeBidi unicodeBidi) { updateValue(unicodeBidi, unicodeBidiMask, unicodeBidiOffset); }
     205
     206        bool hasViewportUnits() const { return getBoolean(hasViewportUnitsOffset); }
     207        void setHasViewportUnits(bool value) { updateBoolean(value, hasViewportUnitsOffset); }
    204208
    205209        EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(getValue(verticalAlignMask, verticalAlignOffset)); }
     
    361365        // Byte 6.
    362366        static const unsigned pseudoBitsBitCount = 7;
    363         static const unsigned pseudoBitsPadding = 1;
    364         static const unsigned pseudoBitsAndPaddingBitCount = pseudoBitsBitCount + pseudoBitsPadding;
    365         static const uint64_t pseudoBitsMask = (oneBitMask << pseudoBitsAndPaddingBitCount) - 1;
    366         static const unsigned pseudoBitsOffset = verticalAlignOffset + verticalAlignAndPaddingBitCount;
     367        static const uint64_t pseudoBitsMask = (oneBitMask << pseudoBitsBitCount) - 1;
     368        static const unsigned pseudoBitsOffset = verticalAlignOffset + verticalAlignBitCount;
     369
     370        static const unsigned hasViewportUnitsBitCount = 1;
     371        static const uint64_t hasViewportUnitsBitMask = (oneBitMask << hasViewportUnitsBitCount) - 1;
     372        static const unsigned hasViewportUnitsOffset = pseudoBitsOffset + pseudoBitsBitCount;
    367373
    368374        // Byte 7.
     
    371377        static const unsigned styleTypeAndPaddingBitCount = styleTypeBitCount + styleTypePadding;
    372378        static const uint64_t styleTypeMask = (oneBitMask << styleTypeAndPaddingBitCount) - 1;
    373         static const unsigned styleTypeOffset = pseudoBitsOffset + pseudoBitsAndPaddingBitCount;
     379        static const unsigned styleTypeOffset = hasViewportUnitsBitCount + hasViewportUnitsOffset;
    374380
    375381        // Byte 8.
     
    383389        static const unsigned isLinkOffset = affectedByDragOffset + 1;
    384390
    385         // Only 59 bits are assigned. There are 5 bits available currently used as padding to improve code generation.
     391
     392        // Only 60 bits are assigned. There are 4 bits available currently used as padding to improve code generation.
    386393        // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom().
    387394        uint64_t m_flags;
     
    471478
    472479// !END SYNC!
    473 
    474480private:
    475481    // used to create the default style.
     
    502508
    503509    const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
     510
     511    void setHasViewportUnits(bool hasViewportUnits = true) { noninherited_flags.setHasViewportUnits(hasViewportUnits); }
     512    bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits(); }
    504513
    505514    bool affectedByHover() const { return noninherited_flags.affectedByHover(); }
     
    722731    const Length& specifiedLineHeight() const;
    723732    Length lineHeight() const;
    724     int computedLineHeight(RenderView* = 0) const;
     733    int computedLineHeight() const;
    725734
    726735    EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
     
    12231232    }
    12241233   
    1225     RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
     1234    RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
    12261235    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
    12271236
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r169385 r169407  
    118118}
    119119
    120 static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize, RenderView* renderView)
    121 {
    122     return valueForLength(length, maxSize, renderView) * (length.isFixed() ? scale : 1);
     120static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize)
     121{
     122    return valueForLength(length, maxSize) * (length.isFixed() ? scale : 1);
    123123}
    124124
     
    136136
    137137    if (svgSVGElement().hasIntrinsicWidth())
    138         return resolveLengthAttributeForSVG(svgSVGElement().intrinsicWidth(), style().effectiveZoom(), containingBlock()->availableLogicalWidth(), &view());
     138        return resolveLengthAttributeForSVG(svgSVGElement().intrinsicWidth(), style().effectiveZoom(), containingBlock()->availableLogicalWidth());
    139139
    140140    // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG.
     
    155155
    156156    if (svgSVGElement().hasIntrinsicHeight())
    157         return resolveLengthAttributeForSVG(svgSVGElement().intrinsicHeight(), style().effectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPadding).toFloat(), &view());
     157        return resolveLengthAttributeForSVG(svgSVGElement().intrinsicHeight(), style().effectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPadding).toFloat());
    158158
    159159    // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG.
  • trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp

    r169368 r169407  
    154154        } else
    155155            referenceBox = renderer.objectBoundingBox();
    156         m_paintInfo->context->clipPath(clipPath.pathForReferenceRect(referenceBox, &renderer.view()), clipPath.windRule());
     156        m_paintInfo->context->clipPath(clipPath.pathForReferenceRect(referenceBox), clipPath.windRule());
    157157    }
    158158
Note: See TracChangeset for help on using the changeset viewer.