Changeset 112301 in webkit


Ignore:
Timestamp:
Mar 27, 2012 12:19:59 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Implement vw/vh/vmin (viewport sizes) from CSS3 Values and Units
https://bugs.webkit.org/show_bug.cgi?id=27160

Patch by Joe Thomas <joethomas@motorola.com> on 2012-03-27
Reviewed by Antti Koivisto.

vw/vh/vmin are implemented as primitive length units. Added the parsing logic for these new units.
New Length types such as ViewportRelativeWidth, ViewportRelativeHeight and ViewportRelativeMin are added for these length units
and included the support for fetching the value of these relative units based on the current viewport size.

The specification related to this implementation is http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths.

Source/WebCore:

Tests: css3/viewport-relative-lengths/css3-viewport-relative-lengths-getStyle.html

css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh-absolute.html
css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh.html
css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin-absolute.html
css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin.html
css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw-absolute.html
css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw.html

  • accessibility/gtk/WebKitAccessibleInterfaceText.cpp: Modified to support viewport relative Length types.

(getAttributeSetForAccessibilityObject):

  • css/CSSComputedStyleDeclaration.cpp: Ditto.

(WebCore::getPositionOffsetValue):
(WebCore::getBorderRadiusCornerValues):
(WebCore::getBorderRadiusCornerValue):
(WebCore::getBorderRadiusShorthandValue):
(WebCore::lineHeightFromStyle):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSGrammar.y: Added vw/vh/vmin support.
  • css/CSSParser.cpp: Parsing of relative units and creation of CSSPrimitiveValue.

(WebCore::CSSParser::validUnit): Added vw/vh/vmin to the valid units.
(WebCore::CSSParser::createPrimitiveNumericValue): Added vw/vh/vmin as valid primitive units.
(WebCore::unitFromString):
(WebCore::CSSParser::parseValidPrimitive): Creation of CSSPrimitiveValue for vw/vh/vmin.
(WebCore::CSSParser::detectNumberToken): Parsing the vw/vh/vmin tokens.

  • css/CSSPrimitiveValue.cpp:

(WebCore::isValidCSSUnitTypeForDoubleConversion): Added support for vw/vh/vmin.
(WebCore::unitCategory): Ditto.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory): Added support for vw/vh/vmin.
(WebCore::CSSPrimitiveValue::customCssText): Ditto.
(WebCore::CSSPrimitiveValue::viewportRelativeLength): Function to create the Length structure for the viewport-relative unit types.
(WebCore):

  • css/CSSPrimitiveValue.h:

(WebCore::CSSPrimitiveValue::isViewportRelativeLength): Checks whether the primitive value is ViewportRelative Lengths.
(CSSPrimitiveValue):

  • css/CSSPrimitiveValue.idl: Added support for vw/vh/vmin.
  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::convertToLength): Ditto.

  • css/CSSStyleApplyProperty.cpp: Applying relative viewport length units to the specific CSS property.

(WebCore::ApplyPropertyLength::applyValue):
(WebCore::ApplyPropertyBorderRadius::applyValue):
(WebCore::ApplyPropertyFontSize::applyValue):
(WebCore::ApplyPropertyLineHeight::applyValue):
(WebCore::ApplyPropertyVerticalAlign::applyValue):

  • css/CSSStyleSelector.cpp: Added support for viewport relative units.
  • css/LengthFunctions.cpp: Calcuation of length value based on the current viewport size.

(WebCore::miminumValueForLength):
(WebCore::valueForLength):
(WebCore::floatValueForLength):

  • css/LengthFunctions.h: Added new RenderView argument.

(WebCore):

  • dom/Document.cpp:

(WebCore::Document::pageSizeAndMarginsInPixels): Modified to support viewport relative Length types.
(WebCore::Document::viewportSize): New function to fetch the current viewport size.
(WebCore):

  • dom/Document.h: Ditto.

(Document):

  • html/HTMLAreaElement.cpp: Modified to support viewport relative Length types.

(WebCore::HTMLAreaElement::getRegion):

  • platform/Length.h:

(WebCore::Length::isViewportRelative): To check the Length is of type ViewportRelative.
(WebCore::Length::viewportRelativeLength): To get the relative value.

  • rendering/RenderBR.cpp: Modified to support viewport relative Length types.

(WebCore::RenderBR::lineHeight):

  • rendering/RenderBlock.cpp: Ditto.

(WebCore::RenderBlock::textIndentOffset):
(WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
(WebCore::RenderBlock::lineHeight):

  • rendering/RenderBox.cpp: Ditto.

(WebCore::RenderBox::reflectionOffset):
(WebCore::RenderBox::paintBoxDecorations):
(WebCore::RenderBox::clipRect):
(WebCore::RenderBox::computeLogicalWidthInRegion):
(WebCore::RenderBox::computeLogicalWidthInRegionUsing):
(WebCore::RenderBox::computeInlineDirectionMargins):
(WebCore::RenderBox::computeContentLogicalHeightUsing):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::computeBlockDirectionMargins):
(WebCore::RenderBox::computePositionedLogicalWidthUsing):
(WebCore::RenderBox::computePositionedLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalWidthReplaced):
(WebCore::RenderBox::computePositionedLogicalHeightReplaced):

  • rendering/RenderBoxModelObject.cpp: Ditto.

(WebCore::RenderBoxModelObject::relativePositionOffsetX):
(WebCore::RenderBoxModelObject::relativePositionOffsetY):
(WebCore::RenderBoxModelObject::paddingTop):
(WebCore::RenderBoxModelObject::paddingBottom):
(WebCore::RenderBoxModelObject::paddingLeft):
(WebCore::RenderBoxModelObject::paddingRight):
(WebCore::RenderBoxModelObject::paddingBefore):
(WebCore::RenderBoxModelObject::paddingAfter):
(WebCore::RenderBoxModelObject::paddingStart):
(WebCore::RenderBoxModelObject::paddingEnd):
(WebCore::RenderBoxModelObject::getBackgroundRoundedRect):
(WebCore::RenderBoxModelObject::calculateFillTileSize):
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
(WebCore::computeBorderImageSide):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
(WebCore::RenderBoxModelObject::paintBorder):
(WebCore::RenderBoxModelObject::paintBoxShadow):

  • rendering/RenderFlexibleBox.cpp: Ditto.

(WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
(WebCore::RenderFlexibleBox::resolveFlexibleLengths):

  • rendering/RenderInline.cpp: Ditto.

(WebCore::computeMargin):
(WebCore::RenderInline::lineHeight):

  • rendering/RenderMenuList.cpp: Ditto.

(WebCore::RenderMenuList::updateOptionsWidth):

  • rendering/RenderObject.cpp: Ditto.

(WebCore::RenderObject::repaintAfterLayoutIfNeeded):

  • rendering/RenderReplaced.cpp: Ditto.

(WebCore::RenderReplaced::paint):

  • rendering/RenderScrollbarPart.cpp: Ditto.

(WebCore::calcScrollbarThicknessUsing):
(WebCore::RenderScrollbarPart::computeScrollbarWidth):
(WebCore::RenderScrollbarPart::computeScrollbarHeight):

  • rendering/RenderTable.cpp: Ditto.

(WebCore::RenderTable::computeLogicalWidth):
(WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):

  • rendering/RenderTableCell.cpp: Ditto.

(WebCore::RenderTableCell::logicalHeightForRowSizing):

  • rendering/RenderTableSection.cpp: Ditto.

(WebCore::RenderTableSection::calcRowLogicalHeight):

  • rendering/RenderText.h: Ditto.

(WebCore::RenderText::marginLeft):
(WebCore::RenderText::marginRight):

  • rendering/RenderThemeMac.mm: Ditto.

(WebCore::RenderThemeMac::paintMenuListButtonGradients):

  • rendering/RenderView.h:

(WebCore::RenderView::viewportSize):

  • rendering/RenderWidget.cpp: Ditto.

(WebCore::RenderWidget::paint):

  • rendering/RootInlineBox.cpp: Ditto.

(WebCore::RootInlineBox::verticalPositionForBox):

  • rendering/style/RenderStyle.cpp: Ditto.

(WebCore::calcRadiiFor):
(WebCore::RenderStyle::getRoundedBorderFor):

  • rendering/style/RenderStyle.h: Ditto.
  • rendering/svg/RenderSVGRoot.cpp: Ditto.

(WebCore::resolveLengthAttributeForSVG):
(WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
(WebCore::RenderSVGRoot::computeReplacedLogicalHeight):

LayoutTests:

  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-getStyle-expected.txt: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-getStyle.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh-absolute-expected.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh-absolute.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh-expected.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin-absolute-expected.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin-absolute.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin-expected.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw-absolute-expected.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw-absolute.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw-expected.html: Added.
  • css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw.html: Added.
  • fast/dom/Window/window-properties-expected.txt:
  • platform/gtk/fast/dom/Window/window-properties-expected.txt:
  • platform/mac/fast/dom/Window/window-properties-expected.txt:
  • platform/qt/fast/dom/Window/window-properties-expected.txt:
  • platform/win/fast/dom/Window/window-properties-expected.txt:
Location:
trunk
Files:
14 added
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r112280 r112301  
     12012-03-27  Joe Thomas  <joethomas@motorola.com>
     2
     3        Implement vw/vh/vmin (viewport sizes) from CSS3 Values and Units
     4        https://bugs.webkit.org/show_bug.cgi?id=27160
     5
     6        Reviewed by Antti Koivisto.
     7
     8        vw/vh/vmin are implemented as primitive length units. Added the parsing logic for these new units.
     9        New Length types such as ViewportRelativeWidth, ViewportRelativeHeight and ViewportRelativeMin are added for these length units
     10        and included the support for fetching the value of these relative units based on the current viewport size.
     11
     12        The specification related to this implementation is http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths.
     13
     14        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-getStyle-expected.txt: Added.
     15        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-getStyle.html: Added.
     16        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh-absolute-expected.html: Added.
     17        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh-absolute.html: Added.
     18        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh-expected.html: Added.
     19        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh.html: Added.
     20        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin-absolute-expected.html: Added.
     21        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin-absolute.html: Added.
     22        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin-expected.html: Added.
     23        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin.html: Added.
     24        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw-absolute-expected.html: Added.
     25        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw-absolute.html: Added.
     26        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw-expected.html: Added.
     27        * css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw.html: Added.
     28        * fast/dom/Window/window-properties-expected.txt:
     29        * platform/gtk/fast/dom/Window/window-properties-expected.txt:
     30        * platform/mac/fast/dom/Window/window-properties-expected.txt:
     31        * platform/qt/fast/dom/Window/window-properties-expected.txt:
     32        * platform/win/fast/dom/Window/window-properties-expected.txt:
     33
    1342012-03-27  Andreas Kling  <kling@webkit.org>
    235
  • trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt

    r109785 r112301  
    290290window.CSSPrimitiveValue.CSS_UNKNOWN [number]
    291291window.CSSPrimitiveValue.CSS_URI [number]
     292window.CSSPrimitiveValue.CSS_VH [number]
     293window.CSSPrimitiveValue.CSS_VMIN [number]
     294window.CSSPrimitiveValue.CSS_VW [number]
    292295window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype]
    293296window.CSSPrimitiveValue.prototype.CSS_ATTR [number]
     
    321324window.CSSPrimitiveValue.prototype.CSS_URI [number]
    322325window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number]
     326window.CSSPrimitiveValue.prototype.CSS_VH [number]
     327window.CSSPrimitiveValue.prototype.CSS_VMIN [number]
     328window.CSSPrimitiveValue.prototype.CSS_VW [number]
    323329window.CSSPrimitiveValue.prototype.getCounterValue [function]
    324330window.CSSPrimitiveValue.prototype.getFloatValue [function]
  • trunk/LayoutTests/platform/gtk/fast/dom/Window/window-properties-expected.txt

    r111878 r112301  
    293293window.CSSPrimitiveValue.CSS_UNKNOWN [number]
    294294window.CSSPrimitiveValue.CSS_URI [number]
     295window.CSSPrimitiveValue.CSS_VH [number]
     296window.CSSPrimitiveValue.CSS_VMIN [number]
     297window.CSSPrimitiveValue.CSS_VW [number]
    295298window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype]
    296299window.CSSPrimitiveValue.prototype.CSS_ATTR [number]
     
    324327window.CSSPrimitiveValue.prototype.CSS_URI [number]
    325328window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number]
     329window.CSSPrimitiveValue.prototype.CSS_VH [number]
     330window.CSSPrimitiveValue.prototype.CSS_VMIN [number]
     331window.CSSPrimitiveValue.prototype.CSS_VW [number]
    326332window.CSSPrimitiveValue.prototype.getCounterValue [function]
    327333window.CSSPrimitiveValue.prototype.getFloatValue [function]
  • trunk/LayoutTests/platform/mac/fast/dom/Window/window-properties-expected.txt

    r111975 r112301  
    318318window.CSSPrimitiveValue.CSS_UNKNOWN [number]
    319319window.CSSPrimitiveValue.CSS_URI [number]
     320window.CSSPrimitiveValue.CSS_VH [number]
     321window.CSSPrimitiveValue.CSS_VMIN [number]
     322window.CSSPrimitiveValue.CSS_VW [number]
    320323window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype]
    321324window.CSSPrimitiveValue.prototype.CSS_ATTR [number]
     
    349352window.CSSPrimitiveValue.prototype.CSS_URI [number]
    350353window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number]
     354window.CSSPrimitiveValue.prototype.CSS_VH [number]
     355window.CSSPrimitiveValue.prototype.CSS_VMIN [number]
     356window.CSSPrimitiveValue.prototype.CSS_VW [number]
    351357window.CSSPrimitiveValue.prototype.getCounterValue [function]
    352358window.CSSPrimitiveValue.prototype.getFloatValue [function]
  • trunk/LayoutTests/platform/qt/fast/dom/Window/window-properties-expected.txt

    r110685 r112301  
    289289window.CSSPrimitiveValue.CSS_UNKNOWN [number]
    290290window.CSSPrimitiveValue.CSS_URI [number]
     291window.CSSPrimitiveValue.CSS_VH [number]
     292window.CSSPrimitiveValue.CSS_VMIN [number]
     293window.CSSPrimitiveValue.CSS_VW [number]
    291294window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype]
    292295window.CSSPrimitiveValue.prototype.CSS_ATTR [number]
     
    320323window.CSSPrimitiveValue.prototype.CSS_URI [number]
    321324window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number]
     325window.CSSPrimitiveValue.prototype.CSS_VH [number]
     326window.CSSPrimitiveValue.prototype.CSS_VMIN [number]
     327window.CSSPrimitiveValue.prototype.CSS_VW [number]
    322328window.CSSPrimitiveValue.prototype.getCounterValue [function]
    323329window.CSSPrimitiveValue.prototype.getFloatValue [function]
  • trunk/LayoutTests/platform/win/fast/dom/Window/window-properties-expected.txt

    r109785 r112301  
    290290window.CSSPrimitiveValue.CSS_UNKNOWN [number]
    291291window.CSSPrimitiveValue.CSS_URI [number]
     292window.CSSPrimitiveValue.CSS_VH [number]
     293window.CSSPrimitiveValue.CSS_VMIN [number]
     294window.CSSPrimitiveValue.CSS_VW [number]
    292295window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype]
    293296window.CSSPrimitiveValue.prototype.CSS_ATTR [number]
     
    321324window.CSSPrimitiveValue.prototype.CSS_URI [number]
    322325window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number]
     326window.CSSPrimitiveValue.prototype.CSS_VH [number]
     327window.CSSPrimitiveValue.prototype.CSS_VMIN [number]
     328window.CSSPrimitiveValue.prototype.CSS_VW [number]
    323329window.CSSPrimitiveValue.prototype.getCounterValue [function]
    324330window.CSSPrimitiveValue.prototype.getFloatValue [function]
  • trunk/Source/WebCore/ChangeLog

    r112299 r112301  
     12012-03-27  Joe Thomas  <joethomas@motorola.com>
     2
     3        Implement vw/vh/vmin (viewport sizes) from CSS3 Values and Units
     4        https://bugs.webkit.org/show_bug.cgi?id=27160
     5
     6        Reviewed by Antti Koivisto.
     7
     8        vw/vh/vmin are implemented as primitive length units. Added the parsing logic for these new units.
     9        New Length types such as ViewportRelativeWidth, ViewportRelativeHeight and ViewportRelativeMin are added for these length units
     10        and included the support for fetching the value of these relative units based on the current viewport size.
     11
     12        The specification related to this implementation is http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths.
     13
     14        Tests: css3/viewport-relative-lengths/css3-viewport-relative-lengths-getStyle.html
     15               css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh-absolute.html
     16               css3/viewport-relative-lengths/css3-viewport-relative-lengths-vh.html
     17               css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin-absolute.html
     18               css3/viewport-relative-lengths/css3-viewport-relative-lengths-vmin.html
     19               css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw-absolute.html
     20               css3/viewport-relative-lengths/css3-viewport-relative-lengths-vw.html
     21
     22        * accessibility/gtk/WebKitAccessibleInterfaceText.cpp: Modified to support viewport relative Length types.
     23        (getAttributeSetForAccessibilityObject):
     24        * css/CSSComputedStyleDeclaration.cpp: Ditto.
     25        (WebCore::getPositionOffsetValue):
     26        (WebCore::getBorderRadiusCornerValues):
     27        (WebCore::getBorderRadiusCornerValue):
     28        (WebCore::getBorderRadiusShorthandValue):
     29        (WebCore::lineHeightFromStyle):
     30        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     31        * css/CSSGrammar.y: Added vw/vh/vmin support.
     32        * css/CSSParser.cpp: Parsing of relative units and creation of CSSPrimitiveValue.
     33        (WebCore::CSSParser::validUnit): Added vw/vh/vmin to the valid units.
     34        (WebCore::CSSParser::createPrimitiveNumericValue): Added vw/vh/vmin as valid primitive units.
     35        (WebCore::unitFromString):
     36        (WebCore::CSSParser::parseValidPrimitive): Creation of CSSPrimitiveValue for vw/vh/vmin.
     37        (WebCore::CSSParser::detectNumberToken): Parsing the vw/vh/vmin tokens.
     38        * css/CSSPrimitiveValue.cpp:
     39        (WebCore::isValidCSSUnitTypeForDoubleConversion): Added support for vw/vh/vmin.
     40        (WebCore::unitCategory): Ditto.
     41        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     42        (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory): Added support for vw/vh/vmin.
     43        (WebCore::CSSPrimitiveValue::customCssText): Ditto.
     44        (WebCore::CSSPrimitiveValue::viewportRelativeLength): Function to create the Length structure for the viewport-relative unit types.
     45        (WebCore):
     46        * css/CSSPrimitiveValue.h:
     47        (WebCore::CSSPrimitiveValue::isViewportRelativeLength): Checks whether the primitive value is ViewportRelative Lengths.
     48        (CSSPrimitiveValue):
     49        * css/CSSPrimitiveValue.idl: Added support for vw/vh/vmin.
     50        * css/CSSPrimitiveValueMappings.h:
     51        (WebCore::CSSPrimitiveValue::convertToLength): Ditto.
     52        * css/CSSStyleApplyProperty.cpp: Applying relative viewport length units to the specific CSS property.
     53        (WebCore::ApplyPropertyLength::applyValue):
     54        (WebCore::ApplyPropertyBorderRadius::applyValue):
     55        (WebCore::ApplyPropertyFontSize::applyValue):
     56        (WebCore::ApplyPropertyLineHeight::applyValue):
     57        (WebCore::ApplyPropertyVerticalAlign::applyValue):
     58        * css/CSSStyleSelector.cpp: Added support for viewport relative units.
     59        * css/LengthFunctions.cpp: Calcuation of length value based on the current viewport size.
     60        (WebCore::miminumValueForLength):
     61        (WebCore::valueForLength):
     62        (WebCore::floatValueForLength):
     63        * css/LengthFunctions.h: Added new RenderView argument.
     64        (WebCore):
     65        * dom/Document.cpp:
     66        (WebCore::Document::pageSizeAndMarginsInPixels): Modified to support viewport relative Length types.
     67        (WebCore::Document::viewportSize): New function to fetch the current viewport size.
     68        (WebCore):
     69        * dom/Document.h: Ditto.
     70        (Document):
     71        * html/HTMLAreaElement.cpp: Modified to support viewport relative Length types.
     72        (WebCore::HTMLAreaElement::getRegion):
     73        * platform/Length.h:
     74        (WebCore::Length::isViewportRelative): To check the Length is of type ViewportRelative.
     75        (WebCore::Length::viewportRelativeLength): To get the relative value.
     76        * rendering/RenderBR.cpp: Modified to support viewport relative Length types.
     77        (WebCore::RenderBR::lineHeight):
     78        * rendering/RenderBlock.cpp: Ditto.
     79        (WebCore::RenderBlock::textIndentOffset):
     80        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
     81        (WebCore::RenderBlock::lineHeight):
     82        * rendering/RenderBox.cpp: Ditto.
     83        (WebCore::RenderBox::reflectionOffset):
     84        (WebCore::RenderBox::paintBoxDecorations):
     85        (WebCore::RenderBox::clipRect):
     86        (WebCore::RenderBox::computeLogicalWidthInRegion):
     87        (WebCore::RenderBox::computeLogicalWidthInRegionUsing):
     88        (WebCore::RenderBox::computeInlineDirectionMargins):
     89        (WebCore::RenderBox::computeContentLogicalHeightUsing):
     90        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
     91        (WebCore::RenderBox::computeBlockDirectionMargins):
     92        (WebCore::RenderBox::computePositionedLogicalWidthUsing):
     93        (WebCore::RenderBox::computePositionedLogicalHeightUsing):
     94        (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
     95        (WebCore::RenderBox::computePositionedLogicalHeightReplaced):
     96        * rendering/RenderBoxModelObject.cpp: Ditto.
     97        (WebCore::RenderBoxModelObject::relativePositionOffsetX):
     98        (WebCore::RenderBoxModelObject::relativePositionOffsetY):
     99        (WebCore::RenderBoxModelObject::paddingTop):
     100        (WebCore::RenderBoxModelObject::paddingBottom):
     101        (WebCore::RenderBoxModelObject::paddingLeft):
     102        (WebCore::RenderBoxModelObject::paddingRight):
     103        (WebCore::RenderBoxModelObject::paddingBefore):
     104        (WebCore::RenderBoxModelObject::paddingAfter):
     105        (WebCore::RenderBoxModelObject::paddingStart):
     106        (WebCore::RenderBoxModelObject::paddingEnd):
     107        (WebCore::RenderBoxModelObject::getBackgroundRoundedRect):
     108        (WebCore::RenderBoxModelObject::calculateFillTileSize):
     109        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
     110        (WebCore::computeBorderImageSide):
     111        (WebCore::RenderBoxModelObject::paintNinePieceImage):
     112        (WebCore::RenderBoxModelObject::paintBorder):
     113        (WebCore::RenderBoxModelObject::paintBoxShadow):
     114        * rendering/RenderFlexibleBox.cpp: Ditto.
     115        (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
     116        (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
     117        (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
     118        * rendering/RenderInline.cpp: Ditto.
     119        (WebCore::computeMargin):
     120        (WebCore::RenderInline::lineHeight):
     121        * rendering/RenderMenuList.cpp: Ditto.
     122        (WebCore::RenderMenuList::updateOptionsWidth):
     123        * rendering/RenderObject.cpp: Ditto.
     124        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
     125        * rendering/RenderReplaced.cpp: Ditto.
     126        (WebCore::RenderReplaced::paint):
     127        * rendering/RenderScrollbarPart.cpp: Ditto.
     128        (WebCore::calcScrollbarThicknessUsing):
     129        (WebCore::RenderScrollbarPart::computeScrollbarWidth):
     130        (WebCore::RenderScrollbarPart::computeScrollbarHeight):
     131        * rendering/RenderTable.cpp: Ditto.
     132        (WebCore::RenderTable::computeLogicalWidth):
     133        (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
     134        * rendering/RenderTableCell.cpp: Ditto.
     135        (WebCore::RenderTableCell::logicalHeightForRowSizing):
     136        * rendering/RenderTableSection.cpp: Ditto.
     137        (WebCore::RenderTableSection::calcRowLogicalHeight):
     138        * rendering/RenderText.h: Ditto.
     139        (WebCore::RenderText::marginLeft):
     140        (WebCore::RenderText::marginRight):
     141        * rendering/RenderThemeMac.mm: Ditto.
     142        (WebCore::RenderThemeMac::paintMenuListButtonGradients):
     143        * rendering/RenderView.h:
     144        (WebCore::RenderView::viewportSize):
     145        * rendering/RenderWidget.cpp: Ditto.
     146        (WebCore::RenderWidget::paint):
     147        * rendering/RootInlineBox.cpp: Ditto.
     148        (WebCore::RootInlineBox::verticalPositionForBox):
     149        * rendering/style/RenderStyle.cpp: Ditto.
     150        (WebCore::calcRadiiFor):
     151        (WebCore::RenderStyle::getRoundedBorderFor):
     152        * rendering/style/RenderStyle.h: Ditto.
     153        * rendering/svg/RenderSVGRoot.cpp: Ditto.
     154        (WebCore::resolveLengthAttributeForSVG):
     155        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
     156        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
     157
    11582012-03-27  Gao Chun  <chun.gao@intel.com>
    2159
  • trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp

    r111354 r112301  
    241241
    242242    if (!style->textIndent().isUndefined()) {
    243         int indentation = valueForLength(style->textIndent(), object->size().width());
     243        int indentation = valueForLength(style->textIndent(), object->size().width(), renderer->view());
    244244        buffer.set(g_strdup_printf("%i", indentation));
    245245        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r112254 r112301  
    5858#include "RenderLayer.h"
    5959#include "RenderStyle.h"
     60#include "RenderView.h"
    6061#include "ShadowValue.h"
    6162#include "StylePropertySet.h"
     
    546547}
    547548
    548 static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int propertyID, CSSValuePool* cssValuePool)
     549static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int propertyID, CSSValuePool* cssValuePool, RenderView* renderView)
    549550{
    550551    if (!style)
     
    572573        if (l.type() == WebCore::Fixed)
    573574            return zoomAdjustedPixelValue(l.value(), style, cssValuePool);
     575        else if (l.isViewportRelative())
     576            return zoomAdjustedPixelValue(valueForLength(l, 0, renderView), style, cssValuePool);
    574577        return cssValuePool->createValue(l);
    575578    }
     
    593596}
    594597
    595 static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool)
     598static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool, RenderView* renderView)
    596599{
    597600    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     
    599602        list->append(cssValuePool->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
    600603    else
    601         list->append(zoomAdjustedPixelValue(radius.width().value(), style, cssValuePool));
     604        list->append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style, cssValuePool));
    602605    if (radius.height().type() == Percent)
    603606        list->append(cssValuePool->createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
    604607    else
    605         list->append(zoomAdjustedPixelValue(radius.height().value(), style, cssValuePool));
     608        list->append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style, cssValuePool));
    606609    return list.release();
    607610}
    608611
    609 static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool)
     612static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool, RenderView* renderView)
    610613{
    611614    if (radius.width() == radius.height()) {
    612615        if (radius.width().type() == Percent)
    613616            return cssValuePool->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
    614         return zoomAdjustedPixelValue(radius.width().value(), style, cssValuePool);
     617        return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style, cssValuePool);
    615618    }
    616     return getBorderRadiusCornerValues(radius, style, cssValuePool);
    617 }
    618 
    619 static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, CSSValuePool* cssValuePool)
     619    return getBorderRadiusCornerValues(radius, style, cssValuePool, renderView);
     620}
     621
     622static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, CSSValuePool* cssValuePool, RenderView* renderView)
    620623{
    621624    RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
     
    629632    bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height());
    630633
    631     RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, cssValuePool);
    632     RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, cssValuePool);
    633     RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, cssValuePool);
    634     RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, cssValuePool);
     634    RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, cssValuePool, renderView);
     635    RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, cssValuePool, renderView);
     636    RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, cssValuePool, renderView);
     637    RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, cssValuePool, renderView);
    635638
    636639    RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
     
    12601263}
    12611264
    1262 static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, CSSValuePool* cssValuePool)
     1265static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, CSSValuePool* cssValuePool, RenderView* renderView)
    12631266{
    12641267    Length length = style->lineHeight();
     
    12711274        // that here either.
    12721275        return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style, cssValuePool);
    1273     return zoomAdjustedPixelValue(length.value(), style, cssValuePool);
     1276    return zoomAdjustedPixelValue(valueForLength(length, 0, renderView), style, cssValuePool);
    12741277}
    12751278
     
    15401543            return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get(), cssValuePool);
    15411544        case CSSPropertyBottom:
    1542             return getPositionOffsetValue(style.get(), CSSPropertyBottom, cssValuePool);
     1545            return getPositionOffsetValue(style.get(), CSSPropertyBottom, cssValuePool, m_node->document()->renderView());
    15431546        case CSSPropertyWebkitBoxAlign:
    15441547            return cssValuePool->createValue(style->boxAlign());
     
    16581661            computedFont->weight = fontWeightFromStyle(style.get(), cssValuePool);
    16591662            computedFont->size = fontSizeFromStyle(style.get(), cssValuePool);
    1660             computedFont->lineHeight = lineHeightFromStyle(style.get(), cssValuePool);
     1663            computedFont->lineHeight = lineHeightFromStyle(style.get(), cssValuePool, m_node->document()->renderView());
    16611664            computedFont->family = fontFamilyFromStyle(style.get(), cssValuePool);
    16621665            return computedFont.release();
     
    17411744            return CSSPrimitiveValue::create(style->imageRendering());
    17421745        case CSSPropertyLeft:
    1743             return getPositionOffsetValue(style.get(), CSSPropertyLeft, cssValuePool);
     1746            return getPositionOffsetValue(style.get(), CSSPropertyLeft, cssValuePool, m_node->document()->renderView());
    17441747        case CSSPropertyLetterSpacing:
    17451748            if (!style->letterSpacing())
     
    17511754            return cssValuePool->createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
    17521755        case CSSPropertyLineHeight:
    1753             return lineHeightFromStyle(style.get(), cssValuePool);
     1756            return lineHeightFromStyle(style.get(), cssValuePool, m_node->document()->renderView());
    17541757        case CSSPropertyListStyleImage:
    17551758            if (style->listStyleImage())
     
    17751778                return zoomAdjustedPixelValueForLength(marginRight, style.get(), cssValuePool);
    17761779            int value;
    1777             if (marginRight.isPercent())
     1780            if (marginRight.isPercent() || marginRight.isViewportRelative())
    17781781                // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
    17791782                // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
    17801783                // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
    1781                 value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent());
     1784                value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document()->renderView());
    17821785            else
    17831786                value = toRenderBox(renderer)->marginRight();
     
    18741877            return cssValuePool->createValue(style->position());
    18751878        case CSSPropertyRight:
    1876             return getPositionOffsetValue(style.get(), CSSPropertyRight, cssValuePool);
     1879            return getPositionOffsetValue(style.get(), CSSPropertyRight, cssValuePool, m_node->document()->renderView());
    18771880        case CSSPropertyTableLayout:
    18781881            return cssValuePool->createValue(style->tableLayout());
     
    19321935            return cssValuePool->createValue(style->textTransform());
    19331936        case CSSPropertyTop:
    1934             return getPositionOffsetValue(style.get(), CSSPropertyTop, cssValuePool);
     1937            return getPositionOffsetValue(style.get(), CSSPropertyTop, cssValuePool, m_node->document()->renderView());
    19351938        case CSSPropertyUnicodeBidi:
    19361939            return renderUnicodeBidiFlagsToCSSValue(style->unicodeBidi(), cssValuePool);
     
    21912194            if (renderer) {
    21922195                LayoutRect box = sizingBox(renderer);
    2193                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width()), style.get(), cssValuePool));
    2194                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height()), style.get(), cssValuePool));
     2196                RenderView* renderView = m_node->document()->renderView();
     2197                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get(), cssValuePool));
     2198                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get(), cssValuePool));
    21952199            }
    21962200            else {
     
    22122216            return cssValuePool->createValue(style->userSelect());
    22132217        case CSSPropertyBorderBottomLeftRadius:
    2214             return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), cssValuePool);
     2218            return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), cssValuePool, m_node->document()->renderView());
    22152219        case CSSPropertyBorderBottomRightRadius:
    2216             return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), cssValuePool);
     2220            return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), cssValuePool, m_node->document()->renderView());
    22172221        case CSSPropertyBorderTopLeftRadius:
    2218             return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), cssValuePool);
     2222            return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), cssValuePool, m_node->document()->renderView());
    22192223        case CSSPropertyBorderTopRightRadius:
    2220             return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), cssValuePool);
     2224            return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), cssValuePool, m_node->document()->renderView());
    22212225        case CSSPropertyClip: {
    22222226            if (!style->hasClip())
     
    22372241            if (renderer) {
    22382242                IntRect box = sizingBox(renderer);
    2239                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width()), style.get(), cssValuePool));
    2240                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height()), style.get(), cssValuePool));
     2243                RenderView* renderView = m_node->document()->renderView();
     2244                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get(), cssValuePool));
     2245                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get(), cssValuePool));
    22412246                if (style->transformOriginZ() != 0)
    22422247                    list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), cssValuePool));
     
    23572362            return valueForNinePieceImage(style->borderImage(), cssValuePool);
    23582363        case CSSPropertyBorderRadius:
    2359             return getBorderRadiusShorthandValue(style.get(), cssValuePool);
     2364            return getBorderRadiusShorthandValue(style.get(), cssValuePool, m_node->document()->renderView());
    23602365        case CSSPropertyBorderRight:
    23612366            return getCSSPropertyValuesForShorthandProperties(borderRightLonghand());
  • trunk/Source/WebCore/css/CSSGrammar.y

    r112281 r112301  
    100100%}
    101101
    102 %expect 55
     102%expect 58
    103103
    104104%nonassoc LOWEST_PREC
     
    189189%token <number> FLOATTOKEN
    190190%token <number> INTEGER
     191%token <number> VW
     192%token <number> VH
     193%token <number> VMIN
    191194
    192195%token <string> URI
     
    14731476          doc->setUsesRemUnits(true);
    14741477  }
     1478  | VW maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VW; }
     1479  | VH maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; }
     1480  | VMIN maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; }
    14751481  ;
    14761482
  • trunk/Source/WebCore/css/CSSParser.cpp

    r112281 r112301  
    12071207    case CSSPrimitiveValue::CSS_PT:
    12081208    case CSSPrimitiveValue::CSS_PC:
     1209    case CSSPrimitiveValue::CSS_VW:
     1210    case CSSPrimitiveValue::CSS_VH:
     1211    case CSSPrimitiveValue::CSS_VMIN:
    12091212        b = (unitflags & FLength);
    12101213        break;
     
    12381241               
    12391242    ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
    1240            || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS));
     1243           || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
     1244           || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN));
    12411245    return cssValuePool()->createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
    12421246}
     
    12871291    if (equal(value->string, "kHz"))
    12881292        return CSSPrimitiveValue::CSS_KHZ;
     1293    if (equal(value->string, "vw"))
     1294        return CSSPrimitiveValue::CSS_VW;
     1295    if (equal(value->string, "vh"))
     1296        return CSSPrimitiveValue::CSS_VH;
     1297    if (equal(value->string, "vmin"))
     1298        return CSSPrimitiveValue::CSS_VMIN;
    12891299
    12901300    return 0;
     
    13311341        return createPrimitiveNumericValue(value);
    13321342    if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
     1343        return createPrimitiveNumericValue(value);
     1344    if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)
    13331345        return createPrimitiveNumericValue(value);
    13341346    if (value->unit >= CSSParserValue::Q_EMS)
     
    82488260            m_token = TURNS;
    82498261        return;
     8262    case 'v':
     8263        if (length == 2) {
     8264            if (isASCIIAlphaCaselessEqual(type[1], 'w'))
     8265                m_token = VW;
     8266            else if (isASCIIAlphaCaselessEqual(type[1], 'h'))
     8267                m_token = VH;
     8268        } else if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'm')
     8269                && isASCIIAlphaCaselessEqual(type[2], 'i') && isASCIIAlphaCaselessEqual(type[3], 'n'))
     8270            m_token = VMIN;
     8271        return;
    82508272
    82518273    default:
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r111444 r112301  
    7878    case CSSPrimitiveValue:: CSS_S:
    7979    case CSSPrimitiveValue:: CSS_TURN:
     80    case CSSPrimitiveValue:: CSS_VW:
     81    case CSSPrimitiveValue:: CSS_VH:
     82    case CSSPrimitiveValue:: CSS_VMIN:
    8083        return true;
    8184    case CSSPrimitiveValue:: CSS_ATTR:
     
    131134    case CSSPrimitiveValue::CSS_KHZ:
    132135        return CSSPrimitiveValue::UFrequency;
     136    case CSSPrimitiveValue::CSS_VW:
     137    case CSSPrimitiveValue::CSS_VH:
     138    case CSSPrimitiveValue::CSS_VMIN:
     139        return CSSPrimitiveValue::UViewportRelativeLength;
    133140    default:
    134141        return CSSPrimitiveValue::UOther;
     
    247254            m_value.num = length.percent();
    248255            break;
     256        case ViewportRelativeWidth:
     257            m_primitiveUnitType = CSS_VW;
     258            m_value.num = length.viewportRelativeLength();
     259            break;
     260        case ViewportRelativeHeight:
     261            m_primitiveUnitType = CSS_VH;
     262            m_value.num = length.viewportRelativeLength();
     263            break;
     264        case ViewportRelativeMin:
     265            m_primitiveUnitType = CSS_VMIN;
     266            m_value.num = length.viewportRelativeLength();
     267            break;
    249268        case Calculated:
    250269        case Relative:
     
    575594    case UFrequency:
    576595        return CSS_HZ;
     596    case UViewportRelativeLength:
     597        return CSS_UNKNOWN; // Cannot convert between numbers and relative lengths.
    577598    default:
    578599        return CSS_UNKNOWN;
     
    9951016            text = m_value.shape->cssText();
    9961017            break;
     1018        case CSS_VW:
     1019            text = formatNumber(m_value.num) + "vw";
     1020            break;
     1021        case CSS_VH:
     1022            text = formatNumber(m_value.num) + "vh";
     1023            break;
     1024        case CSS_VMIN:
     1025            text = formatNumber(m_value.num) + "vmin";
     1026            break;
    9971027    }
    9981028
     
    10091039}
    10101040
     1041Length CSSPrimitiveValue::viewportRelativeLength()
     1042{
     1043    ASSERT(isViewportRelativeLength());
     1044    Length viewportLength;
     1045    switch (m_primitiveUnitType) {
     1046    case CSS_VW:
     1047        viewportLength = Length(getDoubleValue(), ViewportRelativeWidth);
     1048        break;
     1049    case CSS_VH:
     1050        viewportLength = Length(getDoubleValue(), ViewportRelativeHeight);
     1051        break;
     1052    case CSS_VMIN:
     1053        viewportLength = Length(getDoubleValue(), ViewportRelativeMin);
     1054        break;
     1055    default:
     1056        break;
     1057    }
     1058    return viewportLength;
     1059}
     1060
    10111061} // namespace WebCore
  • trunk/Source/WebCore/css/CSSPrimitiveValue.h

    r111444 r112301  
    8181        CSS_RECT = 24,
    8282        CSS_RGBCOLOR = 25,
     83        // From CSS Values and Units. Viewport Relative Lengths (vw/vh/vmin).
     84        CSS_VW = 26,
     85        CSS_VH = 27,
     86        CSS_VMIN = 28,
    8387        CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
    8488        CSS_DASHBOARD_REGION = 101, // FIXME: Dashboard region should not be a primitive value.
     
    119123        UTime,
    120124        UFrequency,
     125        UViewportRelativeLength,
    121126        UOther
    122127    };
     
    154159    bool isCalculatedPercentageWithNumber() const { return primitiveType() == CSS_CALC_PERCENTAGE_WITH_NUMBER; }
    155160    bool isCalculatedPercentageWithLength() const { return primitiveType() == CSS_CALC_PERCENTAGE_WITH_LENGTH; }
     161    bool isViewportRelativeLength() const { return m_primitiveUnitType >= CSS_VW && m_primitiveUnitType <= CSS_VMIN; }
    156162
    157163    static PassRefPtr<CSSPrimitiveValue> createIdentifier(int identifier) { return adoptRef(new CSSPrimitiveValue(identifier)); }
     
    268274
    269275    void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
     276
     277    Length viewportRelativeLength();
    270278
    271279private:
  • trunk/Source/WebCore/css/CSSPrimitiveValue.idl

    r109785 r112301  
    4949        const unsigned short CSS_RECT       = 24;
    5050        const unsigned short CSS_RGBCOLOR   = 25;
    51 
     51        const unsigned short CSS_VW         = 26;
     52        const unsigned short CSS_VH         = 27;
     53        const unsigned short CSS_VMIN       = 28;
     54       
    5255        readonly attribute unsigned short primitiveType;
    5356
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r111631 r112301  
    37753775    PercentConversion = 1 << 3,
    37763776    FractionConversion = 1 << 4,
    3777     CalculatedConversion = 1 << 5
     3777    CalculatedConversion = 1 << 5,
     3778    ViewportRelativeConversion = 1 << 6
    37783779};
    37793780
     
    37943795    if ((supported & CalculatedConversion) && isCalculated())
    37953796        return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier));
     3797    if ((supported & ViewportRelativeConversion) && isViewportRelativeLength())
     3798        return viewportRelativeLength();
    37963799    return Length(Undefined);
    37973800}
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r112125 r112301  
    4040#include "RenderObject.h"
    4141#include "RenderStyle.h"
     42#include "RenderView.h"
    4243#include "Settings.h"
    4344#include <wtf/StdLibExtras.h>
     
    393394            else if (primitiveValue->isCalculatedPercentageWithLength())
    394395                setValue(selector->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom())));           
     396            else if (primitiveValue->isViewportRelativeLength())
     397                setValue(selector->style(), primitiveValue->viewportRelativeLength());
    395398        }
    396399    }
     
    444447        if (pair->first()->isPercentage())
    445448            radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
     449        else if (pair->first()->isViewportRelativeLength())
     450            radiusWidth = pair->first()->viewportRelativeLength();
    446451        else if (pair->first()->isCalculatedPercentageWithLength()) {
    447452            // FIXME calc(): http://webkit.org/b/16662
     
    452457        if (pair->second()->isPercentage())
    453458            radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
     459        else if (pair->second()->isViewportRelativeLength())
     460            radiusHeight = pair->second()->viewportRelativeLength();
    454461        else if (pair->second()->isCalculatedPercentageWithLength()) {
    455462            // FIXME calc(): http://webkit.org/b/16662
     
    746753            else if (primitiveValue->isCalculatedPercentageWithLength())
    747754                size = primitiveValue->cssCalcValue()->toCalcValue(selector->parentStyle(), selector->rootElementStyle())->evaluate(parentSize);               
     755            else if (primitiveValue->isViewportRelativeLength())
     756                size = valueForLength(primitiveValue->viewportRelativeLength(), 0, selector->document()->renderView());
    748757            else
    749758                return;
     
    12071216            // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
    12081217            lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
     1218        } else if (primitiveValue->isViewportRelativeLength()) {
     1219            lineHeight = primitiveValue->viewportRelativeLength();
    12091220        } else
    12101221            return;
     
    15681579            return selector->style()->setVerticalAlign(*primitiveValue);
    15691580
    1570         selector->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()));
     1581        selector->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportRelativeConversion>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()));
    15711582    }
    15721583
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r112281 r112301  
    25492549Length CSSStyleSelector::convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)
    25502550{
    2551     return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion>(style, rootStyle, multiplier) : Length(Undefined);
     2551    return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | ViewportRelativeConversion>(style, rootStyle, multiplier) : Length(Undefined);
    25522552}
    25532553
    25542554Length CSSStyleSelector::convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)
    25552555{
    2556     return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | FractionConversion>(style, rootStyle, multiplier) : Length(Undefined);
     2556    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | FractionConversion | ViewportRelativeConversion>(style, rootStyle, multiplier) : Length(Undefined);
    25572557}
    25582558
     
    29392939static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, CSSStyleSelector* selector, Length& length)
    29402940{
    2941     Length workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
     2941    Length workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportRelativeConversion | AutoConversion>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
    29422942    if (workingLength.isUndefined())
    29432943        return false;
     
    42834283    else if (primitiveValue->isCalculatedPercentageWithLength())
    42844284        l = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), m_rootElementStyle, zoomFactor));
     4285    else if (primitiveValue->isViewportRelativeLength())
     4286        l = primitiveValue->viewportRelativeLength();
    42854287    else
    42864288        return;
     
    43084310    else if (primitiveValue->isCalculatedPercentageWithLength())
    43094311        l = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), m_rootElementStyle, zoomFactor));
     4312    else if (primitiveValue->isViewportRelativeLength())
     4313        l = primitiveValue->viewportRelativeLength();
    43104314    else
    43114315        return;
  • trunk/Source/WebCore/css/LengthFunctions.cpp

    r112198 r112301  
    2626
    2727#include "Length.h"
     28#include "RenderView.h"
    2829
    2930namespace WebCore {
    3031
    31 int minimumValueForLength(Length length, int maximumValue, bool roundPercentages)
     32int minimumValueForLength(Length length, int maximumValue, RenderView* renderView, bool roundPercentages)
    3233{
    3334    switch (length.type()) {
     
    4142    case Calculated:
    4243        return length.nonNanCalculatedValue(maximumValue);
     44    case ViewportRelativeWidth:
     45        if (renderView)
     46            return static_cast<int>(renderView->viewportSize().width() * length.viewportRelativeLength() / 100.0f);
     47        return 0;
     48    case ViewportRelativeHeight:
     49        if (renderView)
     50            return static_cast<int>(renderView->viewportSize().height() * length.viewportRelativeLength() / 100.0f);
     51        return 0;
     52    case ViewportRelativeMin:
     53        if (renderView) {
     54            IntSize viewportSize = renderView->viewportSize();
     55            return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportRelativeLength() / 100.0f);
     56        }
     57        return 0;
    4358    case Auto:
    4459        return 0;
     
    5469}
    5570
    56 int valueForLength(Length length, int maximumValue, bool roundPercentages)
     71int valueForLength(Length length, int maximumValue, RenderView* renderView, bool roundPercentages)
    5772{
    5873    switch (length.type()) {
     
    6075    case Percent:
    6176    case Calculated:
    62         return minimumValueForLength(length, maximumValue, roundPercentages);
     77    case ViewportRelativeWidth:
     78    case ViewportRelativeHeight:
     79    case ViewportRelativeMin:
     80        return minimumValueForLength(length, maximumValue, renderView, roundPercentages);
    6381    case Auto:
    6482        return maximumValue;
     
    7593
    7694// FIXME: when subpixel layout is supported this copy of floatValueForLength() can be removed. See bug 71143.
    77 float floatValueForLength(Length length, int maximumValue)
     95float floatValueForLength(Length length, int maximumValue, RenderView* renderView)
    7896{
    7997    switch (length.type()) {
     
    86104    case Calculated:
    87105        return length.nonNanCalculatedValue(maximumValue);               
     106    case ViewportRelativeWidth:
     107        if (renderView)
     108            return static_cast<int>(renderView->viewportSize().width() * length.viewportRelativeLength() / 100.0f);
     109        return 0;
     110    case ViewportRelativeHeight:
     111        if (renderView)
     112            return static_cast<int>(renderView->viewportSize().height() * length.viewportRelativeLength() / 100.0f);
     113        return 0;
     114    case ViewportRelativeMin:
     115        if (renderView) {
     116            IntSize viewportSize = renderView->viewportSize();
     117            return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportRelativeLength() / 100.0f);
     118        }
     119        return 0;
    88120    case Relative:
    89121    case Intrinsic:
     
    97129}
    98130
    99 float floatValueForLength(Length length, float maximumValue)
     131float floatValueForLength(Length length, float maximumValue, RenderView* renderView)
    100132{
    101133    switch (length.type()) {
     
    108140    case Calculated:
    109141        return length.nonNanCalculatedValue(maximumValue);
     142    case ViewportRelativeWidth:
     143        if (renderView)
     144            return static_cast<int>(renderView->viewportSize().width() * length.viewportRelativeLength() / 100.0f);
     145        return 0;
     146    case ViewportRelativeHeight:
     147        if (renderView)
     148            return static_cast<int>(renderView->viewportSize().height() * length.viewportRelativeLength() / 100.0f);
     149        return 0;
     150    case ViewportRelativeMin:
     151        if (renderView) {
     152            IntSize viewportSize = renderView->viewportSize();
     153            return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportRelativeLength() / 100.0f);
     154        }
     155        return 0;
    110156    case Relative:
    111157    case Intrinsic:
  • trunk/Source/WebCore/css/LengthFunctions.h

    r112198 r112301  
    2727namespace WebCore {
    2828
     29class RenderView;
    2930struct Length;
    3031
    31 int minimumValueForLength(Length, int maximumValue, bool roundPercentages = false);
    32 int valueForLength(Length, int maximumValue, bool roundPercentages = false);
    33 float floatValueForLength(Length, int maximumValue);
    34 float floatValueForLength(Length, float maximumValue);
     32int minimumValueForLength(Length, int maximumValue, RenderView* = 0, bool roundPercentages = false);
     33int valueForLength(Length, int maximumValue, RenderView* = 0, bool roundPercentages = false);
     34float floatValueForLength(Length, int maximumValue, RenderView* = 0);
     35float floatValueForLength(Length, float maximumValue, RenderView* = 0);
    3536
    3637} // namespace WebCore
  • trunk/Source/WebCore/dom/Document.cpp

    r112258 r112301  
    18101810{
    18111811    RefPtr<RenderStyle> style = styleForPage(pageIndex);
     1812    RenderView* view = renderView();
    18121813
    18131814    int width = pageSize.width();
     
    18281829        ASSERT(size.width().isFixed());
    18291830        ASSERT(size.height().isFixed());
    1830         width = valueForLength(size.width(), 0);
    1831         height = valueForLength(size.height(), 0);
     1831        width = valueForLength(size.width(), 0, view);
     1832        height = valueForLength(size.height(), 0, view);
    18321833        break;
    18331834    }
     
    18391840    // The percentage is calculated with respect to the width even for margin top and bottom.
    18401841    // http://www.w3.org/TR/CSS2/box.html#margin-properties
    1841     marginTop = style->marginTop().isAuto() ? marginTop : valueForLength(style->marginTop(), width);
    1842     marginRight = style->marginRight().isAuto() ? marginRight : valueForLength(style->marginRight(), width);
    1843     marginBottom = style->marginBottom().isAuto() ? marginBottom : valueForLength(style->marginBottom(), width);
    1844     marginLeft = style->marginLeft().isAuto() ? marginLeft : valueForLength(style->marginLeft(), width);
     1842    marginTop = style->marginTop().isAuto() ? marginTop : valueForLength(style->marginTop(), width, view);
     1843    marginRight = style->marginRight().isAuto() ? marginRight : valueForLength(style->marginRight(), width, view);
     1844    marginBottom = style->marginBottom().isAuto() ? marginBottom : valueForLength(style->marginBottom(), width, view);
     1845    marginLeft = style->marginLeft().isAuto() ? marginLeft : valueForLength(style->marginLeft(), width, view);
    18451846}
    18461847
     
    57475748#endif
    57485749
     5750IntSize Document::viewportSize() const
     5751{
     5752    if (!view())
     5753        return IntSize();
     5754    return view()->visibleContentRect(/* includeScrollbars */ true).size();
     5755}
     5756
    57495757} // namespace WebCore
  • trunk/Source/WebCore/dom/Document.h

    r112258 r112301  
    11341134    void resumeScheduledTasks();
    11351135
     1136    IntSize viewportSize() const;
     1137
    11361138protected:
    11371139    Document(Frame*, const KURL&, bool isXHTML, bool isHTML);
  • trunk/Source/WebCore/html/HTMLAreaElement.cpp

    r112198 r112301  
    3232#include "Path.h"
    3333#include "RenderImage.h"
     34#include "RenderView.h"
    3435
    3536using namespace std;
     
    144145
    145146    Path path;
     147    RenderView* renderView = document()->renderView();
    146148    switch (shape) {
    147149        case Poly:
    148150            if (m_coordsLen >= 6) {
    149151                int numPoints = m_coordsLen / 2;
    150                 path.moveTo(FloatPoint(minimumValueForLength(m_coords[0], width), minimumValueForLength(m_coords[1], height)));
     152                path.moveTo(FloatPoint(minimumValueForLength(m_coords[0], width, renderView), minimumValueForLength(m_coords[1], height, renderView)));
    151153                for (int i = 1; i < numPoints; ++i)
    152                     path.addLineTo(FloatPoint(minimumValueForLength(m_coords[i * 2], width), minimumValueForLength(m_coords[i * 2 + 1], height)));
     154                    path.addLineTo(FloatPoint(minimumValueForLength(m_coords[i * 2], width, renderView), minimumValueForLength(m_coords[i * 2 + 1], height, renderView)));
    153155                path.closeSubpath();
    154156            }
     
    157159            if (m_coordsLen >= 3) {
    158160                Length radius = m_coords[2];
    159                 int r = 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));
     161                int r = min(minimumValueForLength(radius, width, renderView), minimumValueForLength(radius, height, renderView));
     162                path.addEllipse(FloatRect(minimumValueForLength(m_coords[0], width, renderView) - r, minimumValueForLength(m_coords[1], height, renderView) - r, 2 * r, 2 * r));
    161163            }
    162164            break;
    163165        case Rect:
    164166            if (m_coordsLen >= 4) {
    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);
     167                int x0 = minimumValueForLength(m_coords[0], width, renderView);
     168                int y0 = minimumValueForLength(m_coords[1], height, renderView);
     169                int x1 = minimumValueForLength(m_coords[2], width, renderView);
     170                int y1 = minimumValueForLength(m_coords[3], height, renderView);
    169171                path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
    170172            }
  • trunk/Source/WebCore/platform/Length.h

    r111156 r112301  
    3434namespace WebCore {
    3535
    36 enum LengthType { Auto, Relative, Percent, Fixed, Intrinsic, MinIntrinsic, Calculated, Undefined };
     36enum LengthType { Auto, Relative, Percent, Fixed, Intrinsic, MinIntrinsic, Calculated, ViewportRelativeWidth, ViewportRelativeHeight, ViewportRelativeMin, Undefined };
    3737 
    3838class CalculationValue;   
     
    227227    float nonNanCalculatedValue(int maxValue) const;
    228228
     229    bool isViewportRelative() const
     230    {
     231        LengthType lengthType = type();
     232        return lengthType >= ViewportRelativeWidth && lengthType <= ViewportRelativeMin;
     233    }
     234    float viewportRelativeLength() const
     235    {
     236        ASSERT(isViewportRelative());
     237        return getFloatValue();
     238    }
    229239private:
    230240    int getIntValue() const
  • trunk/Source/WebCore/rendering/RenderBR.cpp

    r109785 r112301  
    4444        RenderStyle* s = style(firstLine);
    4545        if (s != style())
    46             return s->computedLineHeight();
     46            return s->computedLineHeight(view());
    4747    }
    4848   
    4949    if (m_lineHeight == -1)
    50         m_lineHeight = style()->computedLineHeight();
     50        m_lineHeight = style()->computedLineHeight(view());
    5151   
    5252    return m_lineHeight;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r112198 r112301  
    39203920{
    39213921    LayoutUnit cw = 0;
     3922    RenderView* renderView = 0;
    39223923    if (style()->textIndent().isPercent())
    39233924        cw = containingBlock()->availableLogicalWidth();
    3924     return minimumValueForLength(style()->textIndent(), cw);
     3925    else if (style()->textIndent().isViewportRelative())
     3926        renderView = view();
     3927    return minimumValueForLength(style()->textIndent(), cw, renderView);
    39253928}
    39263929
     
    55625565                if (!addedTextIndent) {
    55635566                    addedTextIndent = true;
    5564                     ti = minimumValueForLength(styleToUse->textIndent(), cw);
     5567                    ti = minimumValueForLength(styleToUse->textIndent(), cw, view());
    55655568                    childMin += ti;
    55665569                    childMax += ti;
     
    56335636                if (!addedTextIndent) {
    56345637                    addedTextIndent = true;
    5635                     ti = minimumValueForLength(styleToUse->textIndent(), cw);
     5638                    ti = minimumValueForLength(styleToUse->textIndent(), cw, view());
    56365639                    childMin+=ti; beginMin += ti;
    56375640                    childMax+=ti; beginMax += ti;
     
    58275830        RenderStyle* s = style(firstLine);
    58285831        if (s != style())
    5829             return s->computedLineHeight();
     5832            return s->computedLineHeight(view());
    58305833    }
    58315834   
    58325835    if (m_lineHeight == -1)
    5833         m_lineHeight = style()->computedLineHeight();
     5836        m_lineHeight = style()->computedLineHeight(view());
    58345837
    58355838    return m_lineHeight;
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r112198 r112301  
    623623    if (!style()->boxReflect())
    624624        return 0;
     625    RenderView* renderView = view();
    625626    if (style()->boxReflect()->direction() == ReflectionLeft || style()->boxReflect()->direction() == ReflectionRight)
    626         return valueForLength(style()->boxReflect()->offset(), borderBoxRect().width());
    627     return valueForLength(style()->boxReflect()->offset(), borderBoxRect().height());
     627        return valueForLength(style()->boxReflect()->offset(), borderBoxRect().width(), renderView);
     628    return valueForLength(style()->boxReflect()->offset(), borderBoxRect().height(), renderView);
    628629}
    629630
     
    992993        // into a transparency layer, and then clip that in one go (which requires setting up the clip before
    993994        // beginning the layer).
    994         RoundedRect border = style()->getRoundedBorderFor(paintRect);
     995        RoundedRect border = style()->getRoundedBorderFor(paintRect, view());
    995996        stateSaver.save();
    996997        paintInfo.context->addRoundedRectClip(border);
     
    12931294    LayoutRect borderBoxRect = borderBoxRectInRegion(region);
    12941295    LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size());
     1296    RenderView* renderView = view();
    12951297
    12961298    if (!style()->clipLeft().isAuto()) {
    1297         LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width());
     1299        LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width(), renderView);
    12981300        clipRect.move(c, 0);
    12991301        clipRect.contract(c, 0);
     
    13041306
    13051307    if (!style()->clipRight().isAuto())
    1306         clipRect.contract(width() - valueForLength(style()->clipRight(), width()), 0);
     1308        clipRect.contract(width() - valueForLength(style()->clipRight(), width(), renderView), 0);
    13071309
    13081310    if (!style()->clipTop().isAuto()) {
    1309         LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height());
     1311        LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height(), renderView);
    13101312        clipRect.move(0, c);
    13111313        clipRect.contract(0, c);
     
    13131315
    13141316    if (!style()->clipBottom().isAuto())
    1315         clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height()));
     1317        clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height(), renderView));
    13161318
    13171319    return clipRect;
     
    17801782    if (isInline() && !isInlineBlockOrInlineTable()) {
    17811783        // just calculate margins
    1782         setMarginStart(minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth));
    1783         setMarginEnd(minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth));
     1784        RenderView* renderView = view();
     1785        setMarginStart(minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth, renderView));
     1786        setMarginEnd(minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth, renderView));
    17841787        if (treatAsReplaced)
    17851788            setLogicalWidth(max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
     
    18191822    // Margin calculations.
    18201823    if (logicalWidthLength.isAuto() || hasPerpendicularContainingBlock) {
    1821         setMarginStart(minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth));
    1822         setMarginEnd(minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth));
     1824        RenderView* renderView = view();
     1825        setMarginStart(minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth, renderView));
     1826        setMarginEnd(minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth, renderView));
    18231827    } else
    18241828        computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth());
     
    18431847
    18441848    if (logicalWidth.isIntrinsicOrAuto()) {
    1845         LayoutUnit marginStart = minimumValueForLength(styleToUse->marginStart(), availableLogicalWidth);
    1846         LayoutUnit marginEnd = minimumValueForLength(styleToUse->marginEnd(), availableLogicalWidth);
     1849        RenderView* renderView = view();
     1850        LayoutUnit marginStart = minimumValueForLength(styleToUse->marginStart(), availableLogicalWidth, renderView);
     1851        LayoutUnit marginEnd = minimumValueForLength(styleToUse->marginEnd(), availableLogicalWidth, renderView);
    18471852        logicalWidthResult = availableLogicalWidth - marginStart - marginEnd;
    18481853
     
    18551860        }
    18561861    } else // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead.
    1857         logicalWidthResult = computeBorderBoxLogicalWidth(valueForLength(logicalWidth, availableLogicalWidth));
     1862        logicalWidthResult = computeBorderBoxLogicalWidth(valueForLength(logicalWidth, availableLogicalWidth, view()));
    18581863
    18591864    return logicalWidthResult;
     
    19231928    Length marginStartLength = style()->marginStartUsing(containingBlockStyle);
    19241929    Length marginEndLength = style()->marginEndUsing(containingBlockStyle);
     1930    RenderView* renderView = view();
    19251931
    19261932    if (isFloating() || isInline()) {
    19271933        // Inline blocks/tables and floats don't have their margins increased.
    1928         containingBlock->setMarginStartForChild(this, minimumValueForLength(marginStartLength, containerWidth));
    1929         containingBlock->setMarginEndForChild(this, minimumValueForLength(marginEndLength, containerWidth));
     1934        containingBlock->setMarginStartForChild(this, minimumValueForLength(marginStartLength, containerWidth, renderView));
     1935        containingBlock->setMarginEndForChild(this, minimumValueForLength(marginEndLength, containerWidth, renderView));
    19301936        return;
    19311937    }
     
    19411947    // Case Two: The object is being pushed to the start of the containing block's available logical width.
    19421948    if (marginEndLength.isAuto() && childWidth < containerWidth) {
    1943         containingBlock->setMarginStartForChild(this, valueForLength(marginStartLength, containerWidth));
     1949        containingBlock->setMarginStartForChild(this, valueForLength(marginStartLength, containerWidth, renderView));
    19441950        containingBlock->setMarginEndForChild(this, containerWidth - childWidth - containingBlock->marginStartForChild(this));
    19451951        return;
     
    19501956        || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
    19511957    if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) {
    1952         containingBlock->setMarginEndForChild(this, valueForLength(marginEndLength, containerWidth));
     1958        containingBlock->setMarginEndForChild(this, valueForLength(marginEndLength, containerWidth, renderView));
    19531959        containingBlock->setMarginStartForChild(this, containerWidth - childWidth - containingBlock->marginEndForChild(this));
    19541960        return;
     
    19571963    // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3).  In that case
    19581964    // auto margins will just turn into 0.
    1959     containingBlock->setMarginStartForChild(this, minimumValueForLength(marginStartLength, containerWidth));
    1960     containingBlock->setMarginEndForChild(this, minimumValueForLength(marginEndLength, containerWidth));
     1965    containingBlock->setMarginStartForChild(this, minimumValueForLength(marginStartLength, containerWidth, renderView));
     1966    containingBlock->setMarginEndForChild(this, minimumValueForLength(marginEndLength, containerWidth, renderView));
    19611967}
    19621968
     
    21692175        else if (height.isPercent())
    21702176            logicalHeight = computePercentageLogicalHeight(height);
     2177        else if (height.isViewportRelative())
     2178            logicalHeight = valueForLength(height, 0, view());
    21712179    }
    21722180    return logicalHeight;
     
    23542362            return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight));
    23552363        }
     2364        case ViewportRelativeWidth:
     2365        case ViewportRelativeHeight:
     2366        case ViewportRelativeMin:
     2367            return computeContentBoxLogicalHeight(valueForLength(logicalHeight, 0, view()));
    23562368        default:
    23572369            return intrinsicLogicalHeight();
     
    24172429    // the containing block (8.3)
    24182430    LayoutUnit cw = containingBlockLogicalWidthForContent();
    2419 
     2431    RenderView* renderView = view();
    24202432    RenderStyle* containingBlockStyle = containingBlock->style();
    2421     containingBlock->setMarginBeforeForChild(this, minimumValueForLength(style()->marginBeforeUsing(containingBlockStyle), cw));
    2422     containingBlock->setMarginAfterForChild(this, minimumValueForLength(style()->marginAfterUsing(containingBlockStyle), cw));
     2433    containingBlock->setMarginBeforeForChild(this, minimumValueForLength(style()->marginBeforeUsing(containingBlockStyle), cw, renderView));
     2434    containingBlock->setMarginAfterForChild(this, minimumValueForLength(style()->marginAfterUsing(containingBlockStyle), cw, renderView));
    24232435}
    24242436
     
    27432755    bool logicalLeftIsAuto = logicalLeft.isAuto();
    27442756    bool logicalRightIsAuto = logicalRight.isAuto();
     2757    RenderView* renderView = view();
    27452758
    27462759    if (!logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) {
     
    27602773        // case because the value is not used for any further calculations.
    27612774
    2762         logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    2763         logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
    2764 
    2765         const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth) + bordersPlusPadding);
     2775        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
     2776        logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth, renderView));
     2777
     2778        const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth, renderView) + bordersPlusPadding);
    27662779
    27672780        // Margins are now the only unknown
     
    27842797        } else if (marginLogicalLeft.isAuto()) {
    27852798            // Solve for left margin
    2786             marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth);
     2799            marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth, renderView);
    27872800            marginLogicalLeftValue = availableSpace - marginLogicalRightValue;
    27882801        } else if (marginLogicalRight.isAuto()) {
    27892802            // Solve for right margin
    2790             marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth);
     2803            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth, renderView);
    27912804            marginLogicalRightValue = availableSpace - marginLogicalLeftValue;
    27922805        } else {
    27932806            // Over-constrained, solve for left if direction is RTL
    2794             marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth);
    2795             marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth);
     2807            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth, renderView);
     2808            marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth, renderView);
    27962809
    27972810            // Use the containing block's direction rather than the parent block's
     
    28432856
    28442857        // Calculate margins, 'auto' margins are ignored.
    2845         marginLogicalLeftValue = minimumValueForLength(marginLogicalLeft, containerLogicalWidth);
    2846         marginLogicalRightValue = minimumValueForLength(marginLogicalRight, containerLogicalWidth);
     2858        marginLogicalLeftValue = minimumValueForLength(marginLogicalLeft, containerLogicalWidth, renderView);
     2859        marginLogicalRightValue = minimumValueForLength(marginLogicalRight, containerLogicalWidth, renderView);
    28472860
    28482861        const LayoutUnit availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding);
     
    28522865        if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
    28532866            // RULE 1: (use shrink-to-fit for width, and solve of left)
    2854             LayoutUnit logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
     2867            LayoutUnit logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
    28552868
    28562869            // FIXME: would it be better to have shrink-to-fit in one step?
     
    28622875        } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAuto) {
    28632876            // RULE 3: (use shrink-to-fit for width, and no need solve of right)
    2864             logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     2877            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
    28652878
    28662879            // FIXME: would it be better to have shrink-to-fit in one step?
     
    28712884        } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) {
    28722885            // RULE 4: (solve for left)
    2873             logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
    2874             logicalLeftValue = availableSpace - (logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth));
     2886            logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth, renderView));
     2887            logicalLeftValue = availableSpace - (logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth, renderView));
    28752888        } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
    28762889            // RULE 5: (solve for width)
    2877             logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    2878             logicalWidthValue = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth));
     2890            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
     2891            logicalWidthValue = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth, renderView));
    28792892        } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAuto) {
    28802893            // RULE 6: (no need solve for right)
    2881             logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    2882             logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
     2894            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
     2895            logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth, renderView));
    28832896        }
    28842897    }
     
    30763089    bool logicalTopIsAuto = logicalTop.isAuto();
    30773090    bool logicalBottomIsAuto = logicalBottom.isAuto();
     3091    RenderView* renderView = view();
    30783092
    30793093    // Height is never unsolved for tables.
     
    30953109        // case because the value is not used for any further calculations.
    30963110
    3097         logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
    3098         logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    3099 
    3100         const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight) + bordersPlusPadding);
     3111        logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight, renderView));
     3112        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
     3113
     3114        const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView) + bordersPlusPadding);
    31013115
    31023116        // Margins are now the only unknown
     
    31083122        } else if (marginBefore.isAuto()) {
    31093123            // Solve for top margin
    3110             marginAfterValue = valueForLength(marginAfter, containerLogicalHeight);
     3124            marginAfterValue = valueForLength(marginAfter, containerLogicalHeight, renderView);
    31113125            marginBeforeValue = availableSpace - marginAfterValue;
    31123126        } else if (marginAfter.isAuto()) {
    31133127            // Solve for bottom margin
    3114             marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight);
     3128            marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight, renderView);
    31153129            marginAfterValue = availableSpace - marginBeforeValue;
    31163130        } else {
    31173131            // Over-constrained, (no need solve for bottom)
    3118             marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight);
    3119             marginAfterValue = valueForLength(marginAfter, containerLogicalHeight);
     3132            marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight, renderView);
     3133            marginAfterValue = valueForLength(marginAfter, containerLogicalHeight, renderView);
    31203134        }
    31213135    } else {
     
    31463160
    31473161        // Calculate margins, 'auto' margins are ignored.
    3148         marginBeforeValue = minimumValueForLength(marginBefore, containerLogicalHeight);
    3149         marginAfterValue = minimumValueForLength(marginAfter, containerLogicalHeight);
     3162        marginBeforeValue = minimumValueForLength(marginBefore, containerLogicalHeight, renderView);
     3163        marginAfterValue = minimumValueForLength(marginAfter, containerLogicalHeight, renderView);
    31503164
    31513165        const LayoutUnit availableSpace = containerLogicalHeight - (marginBeforeValue + marginAfterValue + bordersPlusPadding);
     
    31553169            // RULE 1: (height is content based, solve of top)
    31563170            logicalHeightValue = contentLogicalHeight;
    3157             logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight));
     3171            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView));
    31583172        } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) {
    31593173            // RULE 3: (height is content based, no need solve of bottom)
    3160             logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3174            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
    31613175            logicalHeightValue = contentLogicalHeight;
    31623176        } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) {
    31633177            // RULE 4: (solve of top)
    3164             logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
    3165             logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight));
     3178            logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight, renderView));
     3179            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView));
    31663180        } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) {
    31673181            // RULE 5: (solve of height)
    3168             logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    3169             logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight)));
     3182            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
     3183            logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight, renderView)));
    31703184        } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) {
    31713185            // RULE 6: (no need solve of bottom)
    3172             logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
    3173             logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3186            logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight, renderView));
     3187            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
    31743188        }
    31753189    }
     
    32473261    LayoutUnit logicalLeftValue = 0;
    32483262    LayoutUnit logicalRightValue = 0;
     3263    RenderView* renderView = view();
    32493264
    32503265    if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
     
    32523267        ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto()));
    32533268
    3254         logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    3255         logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
     3269        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
     3270        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
    32563271
    32573272        LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRightValue);
     
    32763291    \*-----------------------------------------------------------------------*/
    32773292    } else if (logicalLeft.isAuto()) {
    3278         marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
    3279         marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
    3280         logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
     3293        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth, renderView);
     3294        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth, renderView);
     3295        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
    32813296
    32823297        // Solve for 'left'
    32833298        logicalLeftValue = availableSpace - (logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias);
    32843299    } else if (logicalRight.isAuto()) {
    3285         marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
    3286         marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
    3287         logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     3300        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth, renderView);
     3301        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth, renderView);
     3302        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
    32883303
    32893304        // Solve for 'right'
    32903305        logicalRightValue = availableSpace - (logicalLeftValue + marginLogicalLeftAlias + marginLogicalRightAlias);
    32913306    } else if (marginLogicalLeft.isAuto()) {
    3292         marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
    3293         logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    3294         logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
     3307        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth, renderView);
     3308        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
     3309        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
    32953310
    32963311        // Solve for 'margin-left'
    32973312        marginLogicalLeftAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalRightAlias);
    32983313    } else if (marginLogicalRight.isAuto()) {
    3299         marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
    3300         logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    3301         logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
     3314        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth, renderView);
     3315        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
     3316        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
    33023317
    33033318        // Solve for 'margin-right'
     
    33053320    } else {
    33063321        // Nothing is 'auto', just calculate the values.
    3307         marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
    3308         marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
    3309         logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
    3310         logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     3322        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth, renderView);
     3323        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth, renderView);
     3324        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
     3325        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
    33113326        // If the containing block is right-to-left, then push the left position as far to the right as possible
    33123327        if (containerDirection == RTL) {
     
    33713386    Length logicalTop = style()->logicalTop();
    33723387    Length logicalBottom = style()->logicalBottom();
     3388    RenderView* renderView = view();
    33733389
    33743390    /*-----------------------------------------------------------------------*\
     
    34143430        ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto()));
    34153431
    3416         logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    3417         logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
     3432        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
     3433        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView);
    34183434
    34193435        LayoutUnit difference = availableSpace - (logicalTopValue + logicalBottomValue);
     
    34273443    \*-----------------------------------------------------------------------*/
    34283444    } else if (logicalTop.isAuto()) {
    3429         marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
    3430         marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
    3431         logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
     3445        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight, renderView);
     3446        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight, renderView);
     3447        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView);
    34323448
    34333449        // Solve for 'top'
    34343450        logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAlias + marginAfterAlias);
    34353451    } else if (logicalBottom.isAuto()) {
    3436         marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
    3437         marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
    3438         logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3452        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight, renderView);
     3453        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight, renderView);
     3454        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
    34393455
    34403456        // Solve for 'bottom'
     
    34423458        // use the value.
    34433459    } else if (marginBefore.isAuto()) {
    3444         marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
    3445         logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    3446         logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
     3460        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight, renderView);
     3461        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
     3462        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView);
    34473463
    34483464        // Solve for 'margin-top'
    34493465        marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginAfterAlias);
    34503466    } else if (marginAfter.isAuto()) {
    3451         marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
    3452         logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    3453         logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
     3467        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight, renderView);
     3468        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
     3469        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView);
    34543470
    34553471        // Solve for 'margin-bottom'
     
    34573473    } else {
    34583474        // Nothing is 'auto', just calculate the values.
    3459         marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
    3460         marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
    3461         logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3475        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight, renderView);
     3476        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight, renderView);
     3477        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
    34623478        // NOTE: It is not necessary to solve for 'bottom' because we don't ever
    34633479        // use the value.
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r112198 r112301  
    438438        RenderBlock* cb = containingBlock();
    439439        if (!style()->right().isAuto() && !cb->style()->isLeftToRightDirection())
    440             return -valueForLength(style()->right(), cb->availableWidth());
    441         return offset + valueForLength(style()->left(), cb->availableWidth());
     440            return -valueForLength(style()->right(), cb->availableWidth(), view());
     441        return offset + valueForLength(style()->left(), cb->availableWidth(), view());
    442442    }
    443443    if (!style()->right().isAuto()) {
    444444        RenderBlock* cb = containingBlock();
    445         return offset + -valueForLength(style()->right(), cb->availableWidth());
     445        return offset + -valueForLength(style()->right(), cb->availableWidth(), view());
    446446    }
    447447    return offset;
     
    463463            || !style()->top().isPercent()
    464464            || containingBlock->stretchesToViewport()))
    465         return offset + valueForLength(style()->top(), containingBlock->availableHeight());
     465        return offset + valueForLength(style()->top(), containingBlock->availableHeight(), view());
    466466
    467467    if (!style()->bottom().isAuto()
     
    469469            || !style()->bottom().isPercent()
    470470            || containingBlock->stretchesToViewport()))
    471         return offset + -valueForLength(style()->bottom(), containingBlock->availableHeight());
     471        return offset + -valueForLength(style()->bottom(), containingBlock->availableHeight(), view());
    472472
    473473    return offset;
     
    554554{
    555555    LayoutUnit w = 0;
     556    RenderView* renderView = 0;
    556557    Length padding = style()->paddingTop();
    557558    if (padding.isPercent())
    558559        w = containingBlock()->availableLogicalWidth();
    559     return minimumValueForLength(padding, w);
     560    else if (padding.isViewportRelative())
     561        renderView = view();
     562    return minimumValueForLength(padding, w, renderView);
    560563}
    561564
     
    563566{
    564567    LayoutUnit w = 0;
     568    RenderView* renderView = 0;
    565569    Length padding = style()->paddingBottom();
    566570    if (padding.isPercent())
    567571        w = containingBlock()->availableLogicalWidth();
    568     return minimumValueForLength(padding, w);
     572    else if (padding.isViewportRelative())
     573        renderView = view();
     574    return minimumValueForLength(padding, w, renderView);
    569575}
    570576
     
    572578{
    573579    LayoutUnit w = 0;
     580    RenderView* renderView = 0;
    574581    Length padding = style()->paddingLeft();
    575582    if (padding.isPercent())
    576583        w = containingBlock()->availableLogicalWidth();
    577     return minimumValueForLength(padding, w);
     584    else if (padding.isViewportRelative())
     585        renderView = view();
     586    return minimumValueForLength(padding, w, renderView);
    578587}
    579588
     
    581590{
    582591    LayoutUnit w = 0;
     592    RenderView* renderView = 0;
    583593    Length padding = style()->paddingRight();
    584594    if (padding.isPercent())
    585595        w = containingBlock()->availableLogicalWidth();
    586     return minimumValueForLength(padding, w);
     596    else if (padding.isViewportRelative())
     597        renderView = view();
     598    return minimumValueForLength(padding, w, renderView);
    587599}
    588600
     
    590602{
    591603    LayoutUnit w = 0;
     604    RenderView* renderView = 0;
    592605    Length padding = style()->paddingBefore();
    593606    if (padding.isPercent())
    594607        w = containingBlock()->availableLogicalWidth();
    595     return minimumValueForLength(padding, w);
     608    else if (padding.isViewportRelative())
     609        renderView = view();
     610    return minimumValueForLength(padding, w, renderView);
    596611}
    597612
     
    599614{
    600615    LayoutUnit w = 0;
     616    RenderView* renderView = 0;
    601617    Length padding = style()->paddingAfter();
    602618    if (padding.isPercent())
    603619        w = containingBlock()->availableLogicalWidth();
    604     return minimumValueForLength(padding, w);
     620    else if (padding.isViewportRelative())
     621        renderView = view();
     622    return minimumValueForLength(padding, w, renderView);
    605623}
    606624
     
    608626{
    609627    LayoutUnit w = 0;
     628    RenderView* renderView = 0;
    610629    Length padding = style()->paddingStart();
    611630    if (padding.isPercent())
    612631        w = containingBlock()->availableLogicalWidth();
    613     return minimumValueForLength(padding, w);
     632    else if (padding.isViewportRelative())
     633        renderView = view();
     634    return minimumValueForLength(padding, w, renderView);
    614635}
    615636
     
    617638{
    618639    LayoutUnit w = 0;
     640    RenderView* renderView = 0;
    619641    Length padding = style()->paddingEnd();
    620642    if (padding.isPercent())
    621643        w = containingBlock()->availableLogicalWidth();
    622     return minimumValueForLength(padding, w);
     644    else if (padding.isViewportRelative())
     645        renderView = view();
     646    return minimumValueForLength(padding, w, renderView);
    623647}
    624648
     
    626650    bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
    627651{
    628     RoundedRect border = style()->getRoundedBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
     652    RenderView* renderView = view();
     653    RoundedRect border = style()->getRoundedBorderFor(borderRect, renderView, includeLogicalLeftEdge, includeLogicalRightEdge);
    629654    if (box && (box->nextLineBox() || box->prevLineBox())) {
    630         RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightEdge);
     655        RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), renderView, includeLogicalLeftEdge, includeLogicalRightEdge);
    631656        border.setRadii(segmentBorder.radii());
    632657    }
     
    9871012
    9881013    IntSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize);
    989 
     1014    RenderView* renderView = view();
    9901015    switch (type) {
    9911016        case SizeLength: {
     
    9981023            if (layerWidth.isFixed())
    9991024                w = layerWidth.value();
    1000             else if (layerWidth.isPercent())
    1001                 w = valueForLength(layerWidth, positioningAreaSize.width());
     1025            else if (layerWidth.isPercent() || layerHeight.isViewportRelative())
     1026                w = valueForLength(layerWidth, positioningAreaSize.width(), renderView);
    10021027           
    10031028            if (layerHeight.isFixed())
    10041029                h = layerHeight.value();
    1005             else if (layerHeight.isPercent())
    1006                 h = valueForLength(layerHeight, positioningAreaSize.height());
     1030            else if (layerHeight.isPercent() || layerHeight.isViewportRelative())
     1031                h = valueForLength(layerHeight, positioningAreaSize.height(), renderView);
    10071032           
    10081033            // If one of the values is auto we have to use the appropriate
     
    11391164    EFillRepeat backgroundRepeatX = fillLayer->repeatX();
    11401165    EFillRepeat backgroundRepeatY = fillLayer->repeatY();
    1141 
    1142     LayoutUnit xPosition = minimumValueForLength(fillLayer->xPosition(), positioningAreaSize.width() - geometry.tileSize().width(), true);
     1166    RenderView* renderView = view();
     1167
     1168    LayoutUnit xPosition = minimumValueForLength(fillLayer->xPosition(), positioningAreaSize.width() - geometry.tileSize().width(), renderView, true);
    11431169    if (backgroundRepeatX == RepeatFill)
    11441170        geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - (xPosition + left) % geometry.tileSize().width() : 0);
     
    11461172        geometry.setNoRepeatX(xPosition + left);
    11471173
    1148     LayoutUnit yPosition = minimumValueForLength(fillLayer->yPosition(), positioningAreaSize.height() - geometry.tileSize().height(), true);
     1174    LayoutUnit yPosition = minimumValueForLength(fillLayer->yPosition(), positioningAreaSize.height() - geometry.tileSize().height(), renderView, true);
    11491175    if (backgroundRepeatY == RepeatFill)
    11501176        geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - (yPosition + top) % geometry.tileSize().height() : 0);
     
    11591185}
    11601186
    1161 static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent)
     1187static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent, RenderView* renderView)
    11621188{
    11631189    if (borderSlice.isRelative())
     
    11651191    if (borderSlice.isAuto())
    11661192        return imageSide;
    1167     return valueForLength(borderSlice, boxExtent);
     1193    return valueForLength(borderSlice, boxExtent, renderView);
    11681194}
    11691195
     
    12021228    int imageWidth = imageSize.width() / style->effectiveZoom();
    12031229    int imageHeight = imageSize.height() / style->effectiveZoom();
    1204 
    1205     int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight));
    1206     int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth));
    1207     int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight));
    1208     int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth));
     1230    RenderView* renderView = view();
     1231
     1232    int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight, renderView));
     1233    int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth, renderView));
     1234    int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight, renderView));
     1235    int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth, renderView));
    12091236
    12101237    ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
    12111238    ENinePieceImageRule vRule = ninePieceImage.verticalRule();
    1212    
    1213     LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height());
    1214     LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width());
    1215     LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height());
    1216     LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width());
     1239
     1240    LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height(), renderView);
     1241    LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width(), renderView);
     1242    LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), renderView);
     1243    LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width(), renderView);
    12171244   
    12181245    // Reduce the widths if they're too large.
     
    17581785    BorderEdge edges[4];
    17591786    getBorderEdgeInfo(edges, style, includeLogicalLeftEdge, includeLogicalRightEdge);
    1760 
    1761     RoundedRect outerBorder = style->getRoundedBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
     1787    RoundedRect outerBorder = style->getRoundedBorderFor(rect, view(), includeLogicalLeftEdge, includeLogicalRightEdge);
    17621788    RoundedRect innerBorder = style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
    17631789
     
    20442070    GraphicsContextStateSaver stateSaver(*graphicsContext, false);
    20452071    if (style->hasBorderRadius()) {
    2046         border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(),
     2072        border.includeLogicalEdges(style->getRoundedBorderFor(border.rect(), view()).radii(),
    20472073                                   horizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
    20482074        if (border.isRounded()) {
     
    26972723
    26982724    RoundedRect border = (shadowStyle == Inset) ? s->getRoundedInnerBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge)
    2699                                                    : s->getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge);
     2725                                                   : s->getRoundedBorderFor(paintRect, view(), includeLogicalLeftEdge, includeLogicalRightEdge);
    27002726
    27012727    bool hasBorderRadius = s->hasBorderRadius();
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r112198 r112301  
    587587        return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child);
    588588    }
    589     return minimumValueForLength(mainAxisLength, mainAxisContentExtent());
     589    return minimumValueForLength(mainAxisLength, mainAxisContentExtent(), view());
    590590}
    591591
     
    661661{
    662662    LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent();
     663    RenderView* renderView = view();
    663664    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
    664665        flexOrderValues.add(child->style()->flexOrder());
     
    678679        // computes the start/end margins.
    679680        if (isHorizontalFlow()) {
    680             child->setMarginLeft(minimumValueForLength(child->style()->marginLeft(), flexboxAvailableContentExtent));
    681             child->setMarginRight(minimumValueForLength(child->style()->marginRight(), flexboxAvailableContentExtent));
     681            child->setMarginLeft(minimumValueForLength(child->style()->marginLeft(), flexboxAvailableContentExtent, renderView));
     682            child->setMarginRight(minimumValueForLength(child->style()->marginRight(), flexboxAvailableContentExtent, renderView));
    682683        } else {
    683             child->setMarginTop(minimumValueForLength(child->style()->marginTop(), flexboxAvailableContentExtent));
    684             child->setMarginBottom(minimumValueForLength(child->style()->marginBottom(), flexboxAvailableContentExtent));
     684            child->setMarginTop(minimumValueForLength(child->style()->marginTop(), flexboxAvailableContentExtent, renderView));
     685            child->setMarginBottom(minimumValueForLength(child->style()->marginBottom(), flexboxAvailableContentExtent, renderView));
    685686        }
    686687    }
     
    705706    Length max = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight();
    706707    Length min = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight();
     708    RenderView* renderView = view();
    707709    // FIXME: valueForLength isn't quite right in quirks mode: percentage heights should check parents until a value is found.
    708710    // https://bugs.webkit.org/show_bug.cgi?id=81809
    709     if (max.isSpecified() && childSize > valueForLength(max, flexboxAvailableContentExtent))
    710         childSize = valueForLength(max, flexboxAvailableContentExtent);
    711     if (min.isSpecified() && childSize < valueForLength(min, flexboxAvailableContentExtent))
    712         childSize = valueForLength(min, flexboxAvailableContentExtent);
     711    if (max.isSpecified() && childSize > valueForLength(max, flexboxAvailableContentExtent, renderView))
     712        childSize = valueForLength(max, flexboxAvailableContentExtent, renderView);
     713    if (min.isSpecified() && childSize < valueForLength(min, flexboxAvailableContentExtent, renderView))
     714        childSize = valueForLength(min, flexboxAvailableContentExtent, renderView);
    713715    return childSize;
    714716}
     
    766768{
    767769    childSizes.clear();
    768 
    769770    LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent();
    770771    LayoutUnit totalViolation = 0;
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r112237 r112301  
    703703    if (margin.isPercent())
    704704        return minimumValueForLength(margin, max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
     705    if (margin.isViewportRelative())
     706        return valueForLength(margin, 0, renderer->view());
    705707    return 0;
    706708}
     
    13141316        RenderStyle* s = style(firstLine);
    13151317        if (s != style())
    1316             return s->computedLineHeight();
    1317     }
    1318 
    1319     return style()->computedLineHeight();
     1318            return s->computedLineHeight(view());
     1319    }
     1320
     1321    return style()->computedLineHeight(view());
    13201322}
    13211323
  • trunk/Source/WebCore/rendering/RenderMenuList.cpp

    r112198 r112301  
    163163            float optionWidth = 0;
    164164            if (RenderStyle* optionStyle = element->renderStyle())
    165                 optionWidth += minimumValueForLength(optionStyle->textIndent(), 0);
     165                optionWidth += minimumValueForLength(optionStyle->textIndent(), 0, view());
    166166            if (!text.isEmpty())
    167167                optionWidth += style()->font().width(text);
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r112200 r112301  
    14431443        int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
    14441444        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : zeroLayoutUnit;
    1445         LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderRight, max<LayoutUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth), valueForLength(style()->borderBottomRightRadius().width(), boxWidth)))) + max<LayoutUnit>(ow, shadowRight);
     1445        LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderRight, max<LayoutUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth, v), valueForLength(style()->borderBottomRightRadius().width(), boxWidth, v)))) + max<LayoutUnit>(ow, shadowRight);
    14461446        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
    14471447            newOutlineBox.y(),
     
    14621462        int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
    14631463        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : zeroLayoutUnit;
    1464         LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderBottom, max<LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight), valueForLength(style()->borderBottomRightRadius().height(), boxHeight)))) + max<LayoutUnit>(ow, shadowBottom);
     1464        LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderBottom, max<LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight, v), valueForLength(style()->borderBottomRightRadius().height(), boxHeight, v)))) + max<LayoutUnit>(ow, shadowBottom);
    14651465        LayoutRect bottomRect(newOutlineBox.x(),
    14661466            min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight,
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r112229 r112301  
    146146            // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
    147147            paintInfo.context->save();
    148             paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(paintRect));
     148            paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(paintRect, view()));
    149149        }
    150150    }
  • trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp

    r112198 r112301  
    8080}
    8181
    82 static int calcScrollbarThicknessUsing(const Length& l, int containingLength)
     82static int calcScrollbarThicknessUsing(const Length& length, int containingLength, RenderView* renderView)
    8383{
    84     if (l.isIntrinsicOrAuto())
     84    if (length.isIntrinsicOrAuto())
    8585        return ScrollbarTheme::theme()->scrollbarThickness();
    86     return minimumValueForLength(l, containingLength);
     86    return minimumValueForLength(length, containingLength, renderView);
    8787}
    8888
     
    9191    if (!m_scrollbar->owningRenderer())
    9292        return;
     93    RenderView* renderView = view();
    9394    int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->borderLeft() - m_scrollbar->owningRenderer()->borderRight();
    94     int w = calcScrollbarThicknessUsing(style()->width(), visibleSize);
    95     int minWidth = calcScrollbarThicknessUsing(style()->minWidth(), visibleSize);
    96     int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(style()->maxWidth(), visibleSize);
     95    int w = calcScrollbarThicknessUsing(style()->width(), visibleSize, renderView);
     96    int minWidth = calcScrollbarThicknessUsing(style()->minWidth(), visibleSize, renderView);
     97    int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(style()->maxWidth(), visibleSize, renderView);
    9798    setWidth(max(minWidth, min(maxWidth, w)));
    9899   
    99100    // Buttons and track pieces can all have margins along the axis of the scrollbar.
    100     m_marginLeft = minimumValueForLength(style()->marginLeft(), visibleSize);
    101     m_marginRight = minimumValueForLength(style()->marginRight(), visibleSize);
     101    m_marginLeft = minimumValueForLength(style()->marginLeft(), visibleSize, renderView);
     102    m_marginRight = minimumValueForLength(style()->marginRight(), visibleSize, renderView);
    102103}
    103104
     
    106107    if (!m_scrollbar->owningRenderer())
    107108        return;
     109    RenderView* renderView = view();
    108110    int visibleSize = m_scrollbar->owningRenderer()->height() -  m_scrollbar->owningRenderer()->borderTop() - m_scrollbar->owningRenderer()->borderBottom();
    109     int h = calcScrollbarThicknessUsing(style()->height(), visibleSize);
    110     int minHeight = calcScrollbarThicknessUsing(style()->minHeight(), visibleSize);
    111     int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(style()->maxHeight(), visibleSize);
     111    int h = calcScrollbarThicknessUsing(style()->height(), visibleSize, renderView);
     112    int minHeight = calcScrollbarThicknessUsing(style()->minHeight(), visibleSize, renderView);
     113    int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(style()->maxHeight(), visibleSize, renderView);
    112114    setHeight(max(minHeight, min(maxHeight, h)));
    113115
    114116    // Buttons and track pieces can all have margins along the axis of the scrollbar.
    115     m_marginTop = minimumValueForLength(style()->marginTop(), visibleSize);
    116     m_marginBottom = minimumValueForLength(style()->marginBottom(), visibleSize);
     117    m_marginTop = minimumValueForLength(style()->marginTop(), visibleSize, renderView);
     118    m_marginBottom = minimumValueForLength(style()->marginBottom(), visibleSize, renderView);
    117119}
    118120
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r112198 r112301  
    223223
    224224    RenderBlock* cb = containingBlock();
     225    RenderView* renderView = view();
    225226
    226227    LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent();
     
    233234    else {
    234235        // Subtract out any fixed margins from our available width for auto width tables.
    235         LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), availableLogicalWidth);
    236         LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidth);
     236        LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), availableLogicalWidth, renderView);
     237        LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidth, renderView);
    237238        LayoutUnit marginTotal = marginStart + marginEnd;
    238        
     239
    239240        // Subtract out our margins to get the available content width.
    240241        LayoutUnit availableContentLogicalWidth = max<LayoutUnit>(0, containerWidthInInlineDirection - marginTotal);
     
    262263        computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth());
    263264    else {
    264         setMarginStart(minimumValueForLength(style()->marginStart(), availableLogicalWidth));
    265         setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogicalWidth));
     265        setMarginStart(minimumValueForLength(style()->marginStart(), availableLogicalWidth, renderView));
     266        setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogicalWidth, renderView));
    266267    }
    267268}
     
    277278        borders = borderStart() + borderEnd() + (collapseBorders() ? 0 : paddingStart() + paddingEnd());
    278279    }
    279     return minimumValueForLength(styleLogicalWidth, availableWidth) + borders;
     280    return minimumValueForLength(styleLogicalWidth, availableWidth, view()) + borders;
    280281}
    281282
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r111126 r112301  
    9696    LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
    9797
    98     LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0);
     98    LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0, view());
    9999    if (document()->inQuirksMode() || style()->boxSizing() == BORDER_BOX) {
    100100        // Explicit heights use the border box in quirks mode.
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r112198 r112301  
    328328
    329329    int spacing = table()->vBorderSpacing();
    330 
    331     LayoutStateMaintainer statePusher(view());
     330   
     331    RenderView* viewRenderer = view();
     332    LayoutStateMaintainer statePusher(viewRenderer);
    332333
    333334    m_rowPos.resize(m_grid.size() + 1);
     
    339340
    340341        // Our base size is the biggest logical height from our cells' styles (excluding row spanning cells).
    341         m_rowPos[r + 1] = max(m_rowPos[r] + minimumValueForLength(m_grid[r].logicalHeight, 0), 0);
     342        m_rowPos[r + 1] = max(m_rowPos[r] + minimumValueForLength(m_grid[r].logicalHeight, 0, viewRenderer), 0);
    342343
    343344        Row& row = m_grid[r].row;
  • trunk/Source/WebCore/rendering/RenderText.h

    r112200 r112301  
    2525
    2626#include "RenderObject.h"
     27#include "RenderView.h"
    2728#include <wtf/Forward.h>
    2829
     
    100101    virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
    101102
    102     virtual LayoutUnit marginLeft() const { return minimumValueForLength(style()->marginLeft(), 0); }
    103     virtual LayoutUnit marginRight() const { return minimumValueForLength(style()->marginRight(), 0); }
     103    virtual LayoutUnit marginLeft() const { return minimumValueForLength(style()->marginLeft(), 0, view()); }
     104    virtual LayoutUnit marginRight() const { return minimumValueForLength(style()->marginRight(), 0, view()); }
    104105
    105106    virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r111764 r112301  
    10751075    GraphicsContextStateSaver stateSaver(*paintInfo.context);
    10761076
    1077     RoundedRect border = o->style()->getRoundedBorderFor(r);
     1077    RoundedRect border = o->style()->getRoundedBorderFor(r, o->view());
    10781078    int radius = border.radii().topLeft().width();
    10791079
  • trunk/Source/WebCore/rendering/RenderView.h

    r110224 r112301  
    192192    IntervalArena* intervalArena();
    193193
     194    IntSize viewportSize() const { return document()->viewportSize(); }
    194195protected:
    195196    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
  • trunk/Source/WebCore/rendering/RenderWidget.cpp

    r111515 r112301  
    279279        // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
    280280        paintInfo.context->save();
    281         paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect));
     281        paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect, view()));
    282282    }
    283283
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r111126 r112301  
    845845            verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection);
    846846        else if (verticalAlign == LENGTH)
    847             verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), renderer->lineHeight(firstLine, lineDirection));
     847            verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), renderer->lineHeight(firstLine, lineDirection), renderer->view());
    848848    }
    849849
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r111126 r112301  
    875875}
    876876
    877 static RoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize size)
     877static RoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize size, RenderView* renderView)
    878878{
    879879    return RoundedRect::Radii(
    880         IntSize(valueForLength(border.topLeft().width(), size.width()),
    881                 valueForLength(border.topLeft().height(), size.height())),
    882         IntSize(valueForLength(border.topRight().width(), size.width()),
    883                 valueForLength(border.topRight().height(), size.height())),
    884         IntSize(valueForLength(border.bottomLeft().width(), size.width()),
    885                 valueForLength(border.bottomLeft().height(), size.height())),
    886         IntSize(valueForLength(border.bottomRight().width(), size.width()),
    887                 valueForLength(border.bottomRight().height(), size.height())));
     880        IntSize(valueForLength(border.topLeft().width(), size.width(), renderView),
     881                valueForLength(border.topLeft().height(), size.height(), renderView)),
     882        IntSize(valueForLength(border.topRight().width(), size.width(), renderView),
     883                valueForLength(border.topRight().height(), size.height(), renderView)),
     884        IntSize(valueForLength(border.bottomLeft().width(), size.width(), renderView),
     885                valueForLength(border.bottomLeft().height(), size.height(), renderView)),
     886        IntSize(valueForLength(border.bottomRight().width(), size.width(), renderView),
     887                valueForLength(border.bottomRight().height(), size.height(), renderView)));
    888888}
    889889
     
    920920}
    921921
    922 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
     922RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, RenderView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
    923923{
    924924    RoundedRect roundedRect(pixelSnappedIntRect(borderRect));
    925925    if (hasBorderRadius()) {
    926         RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size());
     926        RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView);
    927927        radii.scale(calcConstraintScaleFor(borderRect, radii));
    928928        roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r112198 r112301  
    623623
    624624    Length lineHeight() const { return inherited->line_height; }
    625     int computedLineHeight() const
     625    int computedLineHeight(RenderView* renderView = 0) const
    626626    {
    627627        const Length& lh = inherited->line_height;
     
    633633        if (lh.isPercent())
    634634            return minimumValueForLength(lh, fontSize());
     635
     636        if (lh.isViewportRelative())
     637            return valueForLength(lh, 0, renderView);
    635638
    636639        return lh.value();
     
    10661069    }
    10671070   
    1068     RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
     1071    RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
    10691072    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
    10701073
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r112091 r112301  
    154154}
    155155
    156 static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize)
    157 {
    158     return static_cast<LayoutUnit>(valueForLength(length, maxSize) * (length.isFixed() ? scale : 1));
     156static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize, RenderView* renderView)
     157{
     158    return static_cast<LayoutUnit>(valueForLength(length, maxSize, renderView) * (length.isFixed() ? scale : 1));
    159159}
    160160
     
    172172
    173173    if (svg->widthAttributeEstablishesViewport())
    174         return resolveLengthAttributeForSVG(svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogicalWidth());
     174        return resolveLengthAttributeForSVG(svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogicalWidth(), view());
    175175
    176176    // Only SVGs embedded in <object> reach this point.
     
    203203            RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this));
    204204
    205         return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), containingBlock()->availableLogicalHeight());
     205        return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), containingBlock()->availableLogicalHeight(), view());
    206206    }
    207207
Note: See TracChangeset for help on using the changeset viewer.