Changeset 112301 in webkit
- Timestamp:
- Mar 27, 2012 12:19:59 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 14 added
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r112280 r112301 1 2012-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 1 34 2012-03-27 Andreas Kling <kling@webkit.org> 2 35 -
trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt
r109785 r112301 290 290 window.CSSPrimitiveValue.CSS_UNKNOWN [number] 291 291 window.CSSPrimitiveValue.CSS_URI [number] 292 window.CSSPrimitiveValue.CSS_VH [number] 293 window.CSSPrimitiveValue.CSS_VMIN [number] 294 window.CSSPrimitiveValue.CSS_VW [number] 292 295 window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype] 293 296 window.CSSPrimitiveValue.prototype.CSS_ATTR [number] … … 321 324 window.CSSPrimitiveValue.prototype.CSS_URI [number] 322 325 window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number] 326 window.CSSPrimitiveValue.prototype.CSS_VH [number] 327 window.CSSPrimitiveValue.prototype.CSS_VMIN [number] 328 window.CSSPrimitiveValue.prototype.CSS_VW [number] 323 329 window.CSSPrimitiveValue.prototype.getCounterValue [function] 324 330 window.CSSPrimitiveValue.prototype.getFloatValue [function] -
trunk/LayoutTests/platform/gtk/fast/dom/Window/window-properties-expected.txt
r111878 r112301 293 293 window.CSSPrimitiveValue.CSS_UNKNOWN [number] 294 294 window.CSSPrimitiveValue.CSS_URI [number] 295 window.CSSPrimitiveValue.CSS_VH [number] 296 window.CSSPrimitiveValue.CSS_VMIN [number] 297 window.CSSPrimitiveValue.CSS_VW [number] 295 298 window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype] 296 299 window.CSSPrimitiveValue.prototype.CSS_ATTR [number] … … 324 327 window.CSSPrimitiveValue.prototype.CSS_URI [number] 325 328 window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number] 329 window.CSSPrimitiveValue.prototype.CSS_VH [number] 330 window.CSSPrimitiveValue.prototype.CSS_VMIN [number] 331 window.CSSPrimitiveValue.prototype.CSS_VW [number] 326 332 window.CSSPrimitiveValue.prototype.getCounterValue [function] 327 333 window.CSSPrimitiveValue.prototype.getFloatValue [function] -
trunk/LayoutTests/platform/mac/fast/dom/Window/window-properties-expected.txt
r111975 r112301 318 318 window.CSSPrimitiveValue.CSS_UNKNOWN [number] 319 319 window.CSSPrimitiveValue.CSS_URI [number] 320 window.CSSPrimitiveValue.CSS_VH [number] 321 window.CSSPrimitiveValue.CSS_VMIN [number] 322 window.CSSPrimitiveValue.CSS_VW [number] 320 323 window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype] 321 324 window.CSSPrimitiveValue.prototype.CSS_ATTR [number] … … 349 352 window.CSSPrimitiveValue.prototype.CSS_URI [number] 350 353 window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number] 354 window.CSSPrimitiveValue.prototype.CSS_VH [number] 355 window.CSSPrimitiveValue.prototype.CSS_VMIN [number] 356 window.CSSPrimitiveValue.prototype.CSS_VW [number] 351 357 window.CSSPrimitiveValue.prototype.getCounterValue [function] 352 358 window.CSSPrimitiveValue.prototype.getFloatValue [function] -
trunk/LayoutTests/platform/qt/fast/dom/Window/window-properties-expected.txt
r110685 r112301 289 289 window.CSSPrimitiveValue.CSS_UNKNOWN [number] 290 290 window.CSSPrimitiveValue.CSS_URI [number] 291 window.CSSPrimitiveValue.CSS_VH [number] 292 window.CSSPrimitiveValue.CSS_VMIN [number] 293 window.CSSPrimitiveValue.CSS_VW [number] 291 294 window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype] 292 295 window.CSSPrimitiveValue.prototype.CSS_ATTR [number] … … 320 323 window.CSSPrimitiveValue.prototype.CSS_URI [number] 321 324 window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number] 325 window.CSSPrimitiveValue.prototype.CSS_VH [number] 326 window.CSSPrimitiveValue.prototype.CSS_VMIN [number] 327 window.CSSPrimitiveValue.prototype.CSS_VW [number] 322 328 window.CSSPrimitiveValue.prototype.getCounterValue [function] 323 329 window.CSSPrimitiveValue.prototype.getFloatValue [function] -
trunk/LayoutTests/platform/win/fast/dom/Window/window-properties-expected.txt
r109785 r112301 290 290 window.CSSPrimitiveValue.CSS_UNKNOWN [number] 291 291 window.CSSPrimitiveValue.CSS_URI [number] 292 window.CSSPrimitiveValue.CSS_VH [number] 293 window.CSSPrimitiveValue.CSS_VMIN [number] 294 window.CSSPrimitiveValue.CSS_VW [number] 292 295 window.CSSPrimitiveValue.prototype [object CSSPrimitiveValuePrototype] 293 296 window.CSSPrimitiveValue.prototype.CSS_ATTR [number] … … 321 324 window.CSSPrimitiveValue.prototype.CSS_URI [number] 322 325 window.CSSPrimitiveValue.prototype.CSS_VALUE_LIST [number] 326 window.CSSPrimitiveValue.prototype.CSS_VH [number] 327 window.CSSPrimitiveValue.prototype.CSS_VMIN [number] 328 window.CSSPrimitiveValue.prototype.CSS_VW [number] 323 329 window.CSSPrimitiveValue.prototype.getCounterValue [function] 324 330 window.CSSPrimitiveValue.prototype.getFloatValue [function] -
trunk/Source/WebCore/ChangeLog
r112299 r112301 1 2012-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 1 158 2012-03-27 Gao Chun <chun.gao@intel.com> 2 159 -
trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp
r111354 r112301 241 241 242 242 if (!style->textIndent().isUndefined()) { 243 int indentation = valueForLength(style->textIndent(), object->size().width() );243 int indentation = valueForLength(style->textIndent(), object->size().width(), renderer->view()); 244 244 buffer.set(g_strdup_printf("%i", indentation)); 245 245 result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get()); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r112254 r112301 58 58 #include "RenderLayer.h" 59 59 #include "RenderStyle.h" 60 #include "RenderView.h" 60 61 #include "ShadowValue.h" 61 62 #include "StylePropertySet.h" … … 546 547 } 547 548 548 static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int propertyID, CSSValuePool* cssValuePool )549 static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int propertyID, CSSValuePool* cssValuePool, RenderView* renderView) 549 550 { 550 551 if (!style) … … 572 573 if (l.type() == WebCore::Fixed) 573 574 return zoomAdjustedPixelValue(l.value(), style, cssValuePool); 575 else if (l.isViewportRelative()) 576 return zoomAdjustedPixelValue(valueForLength(l, 0, renderView), style, cssValuePool); 574 577 return cssValuePool->createValue(l); 575 578 } … … 593 596 } 594 597 595 static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool )598 static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool, RenderView* renderView) 596 599 { 597 600 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); … … 599 602 list->append(cssValuePool->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE)); 600 603 else 601 list->append(zoomAdjustedPixelValue( radius.width().value(), style, cssValuePool));604 list->append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style, cssValuePool)); 602 605 if (radius.height().type() == Percent) 603 606 list->append(cssValuePool->createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE)); 604 607 else 605 list->append(zoomAdjustedPixelValue( radius.height().value(), style, cssValuePool));608 list->append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style, cssValuePool)); 606 609 return list.release(); 607 610 } 608 611 609 static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool )612 static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool, RenderView* renderView) 610 613 { 611 614 if (radius.width() == radius.height()) { 612 615 if (radius.width().type() == Percent) 613 616 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); 615 618 } 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 622 static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, CSSValuePool* cssValuePool, RenderView* renderView) 620 623 { 621 624 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); … … 629 632 bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height()); 630 633 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); 635 638 636 639 RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated(); … … 1260 1263 } 1261 1264 1262 static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, CSSValuePool* cssValuePool )1265 static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, CSSValuePool* cssValuePool, RenderView* renderView) 1263 1266 { 1264 1267 Length length = style->lineHeight(); … … 1271 1274 // that here either. 1272 1275 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); 1274 1277 } 1275 1278 … … 1540 1543 return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get(), cssValuePool); 1541 1544 case CSSPropertyBottom: 1542 return getPositionOffsetValue(style.get(), CSSPropertyBottom, cssValuePool );1545 return getPositionOffsetValue(style.get(), CSSPropertyBottom, cssValuePool, m_node->document()->renderView()); 1543 1546 case CSSPropertyWebkitBoxAlign: 1544 1547 return cssValuePool->createValue(style->boxAlign()); … … 1658 1661 computedFont->weight = fontWeightFromStyle(style.get(), cssValuePool); 1659 1662 computedFont->size = fontSizeFromStyle(style.get(), cssValuePool); 1660 computedFont->lineHeight = lineHeightFromStyle(style.get(), cssValuePool );1663 computedFont->lineHeight = lineHeightFromStyle(style.get(), cssValuePool, m_node->document()->renderView()); 1661 1664 computedFont->family = fontFamilyFromStyle(style.get(), cssValuePool); 1662 1665 return computedFont.release(); … … 1741 1744 return CSSPrimitiveValue::create(style->imageRendering()); 1742 1745 case CSSPropertyLeft: 1743 return getPositionOffsetValue(style.get(), CSSPropertyLeft, cssValuePool );1746 return getPositionOffsetValue(style.get(), CSSPropertyLeft, cssValuePool, m_node->document()->renderView()); 1744 1747 case CSSPropertyLetterSpacing: 1745 1748 if (!style->letterSpacing()) … … 1751 1754 return cssValuePool->createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER); 1752 1755 case CSSPropertyLineHeight: 1753 return lineHeightFromStyle(style.get(), cssValuePool );1756 return lineHeightFromStyle(style.get(), cssValuePool, m_node->document()->renderView()); 1754 1757 case CSSPropertyListStyleImage: 1755 1758 if (style->listStyleImage()) … … 1775 1778 return zoomAdjustedPixelValueForLength(marginRight, style.get(), cssValuePool); 1776 1779 int value; 1777 if (marginRight.isPercent() )1780 if (marginRight.isPercent() || marginRight.isViewportRelative()) 1778 1781 // RenderBox gives a marginRight() that is the distance between the right-edge of the child box 1779 1782 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute 1780 1783 // 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()); 1782 1785 else 1783 1786 value = toRenderBox(renderer)->marginRight(); … … 1874 1877 return cssValuePool->createValue(style->position()); 1875 1878 case CSSPropertyRight: 1876 return getPositionOffsetValue(style.get(), CSSPropertyRight, cssValuePool );1879 return getPositionOffsetValue(style.get(), CSSPropertyRight, cssValuePool, m_node->document()->renderView()); 1877 1880 case CSSPropertyTableLayout: 1878 1881 return cssValuePool->createValue(style->tableLayout()); … … 1932 1935 return cssValuePool->createValue(style->textTransform()); 1933 1936 case CSSPropertyTop: 1934 return getPositionOffsetValue(style.get(), CSSPropertyTop, cssValuePool );1937 return getPositionOffsetValue(style.get(), CSSPropertyTop, cssValuePool, m_node->document()->renderView()); 1935 1938 case CSSPropertyUnicodeBidi: 1936 1939 return renderUnicodeBidiFlagsToCSSValue(style->unicodeBidi(), cssValuePool); … … 2191 2194 if (renderer) { 2192 2195 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)); 2195 2199 } 2196 2200 else { … … 2212 2216 return cssValuePool->createValue(style->userSelect()); 2213 2217 case CSSPropertyBorderBottomLeftRadius: 2214 return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), cssValuePool );2218 return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), cssValuePool, m_node->document()->renderView()); 2215 2219 case CSSPropertyBorderBottomRightRadius: 2216 return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), cssValuePool );2220 return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), cssValuePool, m_node->document()->renderView()); 2217 2221 case CSSPropertyBorderTopLeftRadius: 2218 return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), cssValuePool );2222 return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), cssValuePool, m_node->document()->renderView()); 2219 2223 case CSSPropertyBorderTopRightRadius: 2220 return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), cssValuePool );2224 return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), cssValuePool, m_node->document()->renderView()); 2221 2225 case CSSPropertyClip: { 2222 2226 if (!style->hasClip()) … … 2237 2241 if (renderer) { 2238 2242 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)); 2241 2246 if (style->transformOriginZ() != 0) 2242 2247 list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), cssValuePool)); … … 2357 2362 return valueForNinePieceImage(style->borderImage(), cssValuePool); 2358 2363 case CSSPropertyBorderRadius: 2359 return getBorderRadiusShorthandValue(style.get(), cssValuePool );2364 return getBorderRadiusShorthandValue(style.get(), cssValuePool, m_node->document()->renderView()); 2360 2365 case CSSPropertyBorderRight: 2361 2366 return getCSSPropertyValuesForShorthandProperties(borderRightLonghand()); -
trunk/Source/WebCore/css/CSSGrammar.y
r112281 r112301 100 100 %} 101 101 102 %expect 5 5102 %expect 58 103 103 104 104 %nonassoc LOWEST_PREC … … 189 189 %token <number> FLOATTOKEN 190 190 %token <number> INTEGER 191 %token <number> VW 192 %token <number> VH 193 %token <number> VMIN 191 194 192 195 %token <string> URI … … 1473 1476 doc->setUsesRemUnits(true); 1474 1477 } 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; } 1475 1481 ; 1476 1482 -
trunk/Source/WebCore/css/CSSParser.cpp
r112281 r112301 1207 1207 case CSSPrimitiveValue::CSS_PT: 1208 1208 case CSSPrimitiveValue::CSS_PC: 1209 case CSSPrimitiveValue::CSS_VW: 1210 case CSSPrimitiveValue::CSS_VH: 1211 case CSSPrimitiveValue::CSS_VMIN: 1209 1212 b = (unitflags & FLength); 1210 1213 break; … … 1238 1241 1239 1242 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)); 1241 1245 return cssValuePool()->createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit)); 1242 1246 } … … 1287 1291 if (equal(value->string, "kHz")) 1288 1292 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; 1289 1299 1290 1300 return 0; … … 1331 1341 return createPrimitiveNumericValue(value); 1332 1342 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) 1333 1345 return createPrimitiveNumericValue(value); 1334 1346 if (value->unit >= CSSParserValue::Q_EMS) … … 8248 8260 m_token = TURNS; 8249 8261 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; 8250 8272 8251 8273 default: -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r111444 r112301 78 78 case CSSPrimitiveValue:: CSS_S: 79 79 case CSSPrimitiveValue:: CSS_TURN: 80 case CSSPrimitiveValue:: CSS_VW: 81 case CSSPrimitiveValue:: CSS_VH: 82 case CSSPrimitiveValue:: CSS_VMIN: 80 83 return true; 81 84 case CSSPrimitiveValue:: CSS_ATTR: … … 131 134 case CSSPrimitiveValue::CSS_KHZ: 132 135 return CSSPrimitiveValue::UFrequency; 136 case CSSPrimitiveValue::CSS_VW: 137 case CSSPrimitiveValue::CSS_VH: 138 case CSSPrimitiveValue::CSS_VMIN: 139 return CSSPrimitiveValue::UViewportRelativeLength; 133 140 default: 134 141 return CSSPrimitiveValue::UOther; … … 247 254 m_value.num = length.percent(); 248 255 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; 249 268 case Calculated: 250 269 case Relative: … … 575 594 case UFrequency: 576 595 return CSS_HZ; 596 case UViewportRelativeLength: 597 return CSS_UNKNOWN; // Cannot convert between numbers and relative lengths. 577 598 default: 578 599 return CSS_UNKNOWN; … … 995 1016 text = m_value.shape->cssText(); 996 1017 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; 997 1027 } 998 1028 … … 1009 1039 } 1010 1040 1041 Length 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 1011 1061 } // namespace WebCore -
trunk/Source/WebCore/css/CSSPrimitiveValue.h
r111444 r112301 81 81 CSS_RECT = 24, 82 82 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, 83 87 CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.) 84 88 CSS_DASHBOARD_REGION = 101, // FIXME: Dashboard region should not be a primitive value. … … 119 123 UTime, 120 124 UFrequency, 125 UViewportRelativeLength, 121 126 UOther 122 127 }; … … 154 159 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CSS_CALC_PERCENTAGE_WITH_NUMBER; } 155 160 bool isCalculatedPercentageWithLength() const { return primitiveType() == CSS_CALC_PERCENTAGE_WITH_LENGTH; } 161 bool isViewportRelativeLength() const { return m_primitiveUnitType >= CSS_VW && m_primitiveUnitType <= CSS_VMIN; } 156 162 157 163 static PassRefPtr<CSSPrimitiveValue> createIdentifier(int identifier) { return adoptRef(new CSSPrimitiveValue(identifier)); } … … 268 274 269 275 void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*); 276 277 Length viewportRelativeLength(); 270 278 271 279 private: -
trunk/Source/WebCore/css/CSSPrimitiveValue.idl
r109785 r112301 49 49 const unsigned short CSS_RECT = 24; 50 50 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 52 55 readonly attribute unsigned short primitiveType; 53 56 -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r111631 r112301 3775 3775 PercentConversion = 1 << 3, 3776 3776 FractionConversion = 1 << 4, 3777 CalculatedConversion = 1 << 5 3777 CalculatedConversion = 1 << 5, 3778 ViewportRelativeConversion = 1 << 6 3778 3779 }; 3779 3780 … … 3794 3795 if ((supported & CalculatedConversion) && isCalculated()) 3795 3796 return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier)); 3797 if ((supported & ViewportRelativeConversion) && isViewportRelativeLength()) 3798 return viewportRelativeLength(); 3796 3799 return Length(Undefined); 3797 3800 } -
trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp
r112125 r112301 40 40 #include "RenderObject.h" 41 41 #include "RenderStyle.h" 42 #include "RenderView.h" 42 43 #include "Settings.h" 43 44 #include <wtf/StdLibExtras.h> … … 393 394 else if (primitiveValue->isCalculatedPercentageWithLength()) 394 395 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()); 395 398 } 396 399 } … … 444 447 if (pair->first()->isPercentage()) 445 448 radiusWidth = Length(pair->first()->getDoubleValue(), Percent); 449 else if (pair->first()->isViewportRelativeLength()) 450 radiusWidth = pair->first()->viewportRelativeLength(); 446 451 else if (pair->first()->isCalculatedPercentageWithLength()) { 447 452 // FIXME calc(): http://webkit.org/b/16662 … … 452 457 if (pair->second()->isPercentage()) 453 458 radiusHeight = Length(pair->second()->getDoubleValue(), Percent); 459 else if (pair->second()->isViewportRelativeLength()) 460 radiusHeight = pair->second()->viewportRelativeLength(); 454 461 else if (pair->second()->isCalculatedPercentageWithLength()) { 455 462 // FIXME calc(): http://webkit.org/b/16662 … … 746 753 else if (primitiveValue->isCalculatedPercentageWithLength()) 747 754 size = primitiveValue->cssCalcValue()->toCalcValue(selector->parentStyle(), selector->rootElementStyle())->evaluate(parentSize); 755 else if (primitiveValue->isViewportRelativeLength()) 756 size = valueForLength(primitiveValue->viewportRelativeLength(), 0, selector->document()->renderView()); 748 757 else 749 758 return; … … 1207 1216 // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent). 1208 1217 lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent); 1218 } else if (primitiveValue->isViewportRelativeLength()) { 1219 lineHeight = primitiveValue->viewportRelativeLength(); 1209 1220 } else 1210 1221 return; … … 1568 1579 return selector->style()->setVerticalAlign(*primitiveValue); 1569 1580 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())); 1571 1582 } 1572 1583 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r112281 r112301 2549 2549 Length CSSStyleSelector::convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier) 2550 2550 { 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); 2552 2552 } 2553 2553 2554 2554 Length CSSStyleSelector::convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier) 2555 2555 { 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); 2557 2557 } 2558 2558 … … 2939 2939 static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, CSSStyleSelector* selector, Length& length) 2940 2940 { 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()); 2942 2942 if (workingLength.isUndefined()) 2943 2943 return false; … … 4283 4283 else if (primitiveValue->isCalculatedPercentageWithLength()) 4284 4284 l = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), m_rootElementStyle, zoomFactor)); 4285 else if (primitiveValue->isViewportRelativeLength()) 4286 l = primitiveValue->viewportRelativeLength(); 4285 4287 else 4286 4288 return; … … 4308 4310 else if (primitiveValue->isCalculatedPercentageWithLength()) 4309 4311 l = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), m_rootElementStyle, zoomFactor)); 4312 else if (primitiveValue->isViewportRelativeLength()) 4313 l = primitiveValue->viewportRelativeLength(); 4310 4314 else 4311 4315 return; -
trunk/Source/WebCore/css/LengthFunctions.cpp
r112198 r112301 26 26 27 27 #include "Length.h" 28 #include "RenderView.h" 28 29 29 30 namespace WebCore { 30 31 31 int minimumValueForLength(Length length, int maximumValue, bool roundPercentages)32 int minimumValueForLength(Length length, int maximumValue, RenderView* renderView, bool roundPercentages) 32 33 { 33 34 switch (length.type()) { … … 41 42 case Calculated: 42 43 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; 43 58 case Auto: 44 59 return 0; … … 54 69 } 55 70 56 int valueForLength(Length length, int maximumValue, bool roundPercentages)71 int valueForLength(Length length, int maximumValue, RenderView* renderView, bool roundPercentages) 57 72 { 58 73 switch (length.type()) { … … 60 75 case Percent: 61 76 case Calculated: 62 return minimumValueForLength(length, maximumValue, roundPercentages); 77 case ViewportRelativeWidth: 78 case ViewportRelativeHeight: 79 case ViewportRelativeMin: 80 return minimumValueForLength(length, maximumValue, renderView, roundPercentages); 63 81 case Auto: 64 82 return maximumValue; … … 75 93 76 94 // FIXME: when subpixel layout is supported this copy of floatValueForLength() can be removed. See bug 71143. 77 float floatValueForLength(Length length, int maximumValue )95 float floatValueForLength(Length length, int maximumValue, RenderView* renderView) 78 96 { 79 97 switch (length.type()) { … … 86 104 case Calculated: 87 105 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; 88 120 case Relative: 89 121 case Intrinsic: … … 97 129 } 98 130 99 float floatValueForLength(Length length, float maximumValue )131 float floatValueForLength(Length length, float maximumValue, RenderView* renderView) 100 132 { 101 133 switch (length.type()) { … … 108 140 case Calculated: 109 141 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; 110 156 case Relative: 111 157 case Intrinsic: -
trunk/Source/WebCore/css/LengthFunctions.h
r112198 r112301 27 27 namespace WebCore { 28 28 29 class RenderView; 29 30 struct Length; 30 31 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 );32 int minimumValueForLength(Length, int maximumValue, RenderView* = 0, bool roundPercentages = false); 33 int valueForLength(Length, int maximumValue, RenderView* = 0, bool roundPercentages = false); 34 float floatValueForLength(Length, int maximumValue, RenderView* = 0); 35 float floatValueForLength(Length, float maximumValue, RenderView* = 0); 35 36 36 37 } // namespace WebCore -
trunk/Source/WebCore/dom/Document.cpp
r112258 r112301 1810 1810 { 1811 1811 RefPtr<RenderStyle> style = styleForPage(pageIndex); 1812 RenderView* view = renderView(); 1812 1813 1813 1814 int width = pageSize.width(); … … 1828 1829 ASSERT(size.width().isFixed()); 1829 1830 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); 1832 1833 break; 1833 1834 } … … 1839 1840 // The percentage is calculated with respect to the width even for margin top and bottom. 1840 1841 // 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); 1845 1846 } 1846 1847 … … 5747 5748 #endif 5748 5749 5750 IntSize Document::viewportSize() const 5751 { 5752 if (!view()) 5753 return IntSize(); 5754 return view()->visibleContentRect(/* includeScrollbars */ true).size(); 5755 } 5756 5749 5757 } // namespace WebCore -
trunk/Source/WebCore/dom/Document.h
r112258 r112301 1134 1134 void resumeScheduledTasks(); 1135 1135 1136 IntSize viewportSize() const; 1137 1136 1138 protected: 1137 1139 Document(Frame*, const KURL&, bool isXHTML, bool isHTML); -
trunk/Source/WebCore/html/HTMLAreaElement.cpp
r112198 r112301 32 32 #include "Path.h" 33 33 #include "RenderImage.h" 34 #include "RenderView.h" 34 35 35 36 using namespace std; … … 144 145 145 146 Path path; 147 RenderView* renderView = document()->renderView(); 146 148 switch (shape) { 147 149 case Poly: 148 150 if (m_coordsLen >= 6) { 149 151 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))); 151 153 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))); 153 155 path.closeSubpath(); 154 156 } … … 157 159 if (m_coordsLen >= 3) { 158 160 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)); 161 163 } 162 164 break; 163 165 case Rect: 164 166 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); 169 171 path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0)); 170 172 } -
trunk/Source/WebCore/platform/Length.h
r111156 r112301 34 34 namespace WebCore { 35 35 36 enum LengthType { Auto, Relative, Percent, Fixed, Intrinsic, MinIntrinsic, Calculated, Undefined };36 enum LengthType { Auto, Relative, Percent, Fixed, Intrinsic, MinIntrinsic, Calculated, ViewportRelativeWidth, ViewportRelativeHeight, ViewportRelativeMin, Undefined }; 37 37 38 38 class CalculationValue; … … 227 227 float nonNanCalculatedValue(int maxValue) const; 228 228 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 } 229 239 private: 230 240 int getIntValue() const -
trunk/Source/WebCore/rendering/RenderBR.cpp
r109785 r112301 44 44 RenderStyle* s = style(firstLine); 45 45 if (s != style()) 46 return s->computedLineHeight( );46 return s->computedLineHeight(view()); 47 47 } 48 48 49 49 if (m_lineHeight == -1) 50 m_lineHeight = style()->computedLineHeight( );50 m_lineHeight = style()->computedLineHeight(view()); 51 51 52 52 return m_lineHeight; -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r112198 r112301 3920 3920 { 3921 3921 LayoutUnit cw = 0; 3922 RenderView* renderView = 0; 3922 3923 if (style()->textIndent().isPercent()) 3923 3924 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); 3925 3928 } 3926 3929 … … 5562 5565 if (!addedTextIndent) { 5563 5566 addedTextIndent = true; 5564 ti = minimumValueForLength(styleToUse->textIndent(), cw );5567 ti = minimumValueForLength(styleToUse->textIndent(), cw, view()); 5565 5568 childMin += ti; 5566 5569 childMax += ti; … … 5633 5636 if (!addedTextIndent) { 5634 5637 addedTextIndent = true; 5635 ti = minimumValueForLength(styleToUse->textIndent(), cw );5638 ti = minimumValueForLength(styleToUse->textIndent(), cw, view()); 5636 5639 childMin+=ti; beginMin += ti; 5637 5640 childMax+=ti; beginMax += ti; … … 5827 5830 RenderStyle* s = style(firstLine); 5828 5831 if (s != style()) 5829 return s->computedLineHeight( );5832 return s->computedLineHeight(view()); 5830 5833 } 5831 5834 5832 5835 if (m_lineHeight == -1) 5833 m_lineHeight = style()->computedLineHeight( );5836 m_lineHeight = style()->computedLineHeight(view()); 5834 5837 5835 5838 return m_lineHeight; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r112198 r112301 623 623 if (!style()->boxReflect()) 624 624 return 0; 625 RenderView* renderView = view(); 625 626 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); 628 629 } 629 630 … … 992 993 // into a transparency layer, and then clip that in one go (which requires setting up the clip before 993 994 // beginning the layer). 994 RoundedRect border = style()->getRoundedBorderFor(paintRect );995 RoundedRect border = style()->getRoundedBorderFor(paintRect, view()); 995 996 stateSaver.save(); 996 997 paintInfo.context->addRoundedRectClip(border); … … 1293 1294 LayoutRect borderBoxRect = borderBoxRectInRegion(region); 1294 1295 LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size()); 1296 RenderView* renderView = view(); 1295 1297 1296 1298 if (!style()->clipLeft().isAuto()) { 1297 LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width() );1299 LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width(), renderView); 1298 1300 clipRect.move(c, 0); 1299 1301 clipRect.contract(c, 0); … … 1304 1306 1305 1307 if (!style()->clipRight().isAuto()) 1306 clipRect.contract(width() - valueForLength(style()->clipRight(), width() ), 0);1308 clipRect.contract(width() - valueForLength(style()->clipRight(), width(), renderView), 0); 1307 1309 1308 1310 if (!style()->clipTop().isAuto()) { 1309 LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height() );1311 LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height(), renderView); 1310 1312 clipRect.move(0, c); 1311 1313 clipRect.contract(0, c); … … 1313 1315 1314 1316 if (!style()->clipBottom().isAuto()) 1315 clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height() ));1317 clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height(), renderView)); 1316 1318 1317 1319 return clipRect; … … 1780 1782 if (isInline() && !isInlineBlockOrInlineTable()) { 1781 1783 // 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)); 1784 1787 if (treatAsReplaced) 1785 1788 setLogicalWidth(max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth())); … … 1819 1822 // Margin calculations. 1820 1823 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)); 1823 1827 } else 1824 1828 computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth()); … … 1843 1847 1844 1848 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); 1847 1852 logicalWidthResult = availableLogicalWidth - marginStart - marginEnd; 1848 1853 … … 1855 1860 } 1856 1861 } 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())); 1858 1863 1859 1864 return logicalWidthResult; … … 1923 1928 Length marginStartLength = style()->marginStartUsing(containingBlockStyle); 1924 1929 Length marginEndLength = style()->marginEndUsing(containingBlockStyle); 1930 RenderView* renderView = view(); 1925 1931 1926 1932 if (isFloating() || isInline()) { 1927 1933 // 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)); 1930 1936 return; 1931 1937 } … … 1941 1947 // Case Two: The object is being pushed to the start of the containing block's available logical width. 1942 1948 if (marginEndLength.isAuto() && childWidth < containerWidth) { 1943 containingBlock->setMarginStartForChild(this, valueForLength(marginStartLength, containerWidth ));1949 containingBlock->setMarginStartForChild(this, valueForLength(marginStartLength, containerWidth, renderView)); 1944 1950 containingBlock->setMarginEndForChild(this, containerWidth - childWidth - containingBlock->marginStartForChild(this)); 1945 1951 return; … … 1950 1956 || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT)); 1951 1957 if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) { 1952 containingBlock->setMarginEndForChild(this, valueForLength(marginEndLength, containerWidth ));1958 containingBlock->setMarginEndForChild(this, valueForLength(marginEndLength, containerWidth, renderView)); 1953 1959 containingBlock->setMarginStartForChild(this, containerWidth - childWidth - containingBlock->marginEndForChild(this)); 1954 1960 return; … … 1957 1963 // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3). In that case 1958 1964 // 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)); 1961 1967 } 1962 1968 … … 2169 2175 else if (height.isPercent()) 2170 2176 logicalHeight = computePercentageLogicalHeight(height); 2177 else if (height.isViewportRelative()) 2178 logicalHeight = valueForLength(height, 0, view()); 2171 2179 } 2172 2180 return logicalHeight; … … 2354 2362 return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight)); 2355 2363 } 2364 case ViewportRelativeWidth: 2365 case ViewportRelativeHeight: 2366 case ViewportRelativeMin: 2367 return computeContentBoxLogicalHeight(valueForLength(logicalHeight, 0, view())); 2356 2368 default: 2357 2369 return intrinsicLogicalHeight(); … … 2417 2429 // the containing block (8.3) 2418 2430 LayoutUnit cw = containingBlockLogicalWidthForContent(); 2419 2431 RenderView* renderView = view(); 2420 2432 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)); 2423 2435 } 2424 2436 … … 2743 2755 bool logicalLeftIsAuto = logicalLeft.isAuto(); 2744 2756 bool logicalRightIsAuto = logicalRight.isAuto(); 2757 RenderView* renderView = view(); 2745 2758 2746 2759 if (!logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) { … … 2760 2773 // case because the value is not used for any further calculations. 2761 2774 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); 2766 2779 2767 2780 // Margins are now the only unknown … … 2784 2797 } else if (marginLogicalLeft.isAuto()) { 2785 2798 // Solve for left margin 2786 marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth );2799 marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth, renderView); 2787 2800 marginLogicalLeftValue = availableSpace - marginLogicalRightValue; 2788 2801 } else if (marginLogicalRight.isAuto()) { 2789 2802 // Solve for right margin 2790 marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth );2803 marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth, renderView); 2791 2804 marginLogicalRightValue = availableSpace - marginLogicalLeftValue; 2792 2805 } else { 2793 2806 // 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); 2796 2809 2797 2810 // Use the containing block's direction rather than the parent block's … … 2843 2856 2844 2857 // 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); 2847 2860 2848 2861 const LayoutUnit availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding); … … 2852 2865 if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) { 2853 2866 // 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); 2855 2868 2856 2869 // FIXME: would it be better to have shrink-to-fit in one step? … … 2862 2875 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAuto) { 2863 2876 // 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); 2865 2878 2866 2879 // FIXME: would it be better to have shrink-to-fit in one step? … … 2871 2884 } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) { 2872 2885 // 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)); 2875 2888 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) { 2876 2889 // 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)); 2879 2892 } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAuto) { 2880 2893 // 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)); 2883 2896 } 2884 2897 } … … 3076 3089 bool logicalTopIsAuto = logicalTop.isAuto(); 3077 3090 bool logicalBottomIsAuto = logicalBottom.isAuto(); 3091 RenderView* renderView = view(); 3078 3092 3079 3093 // Height is never unsolved for tables. … … 3095 3109 // case because the value is not used for any further calculations. 3096 3110 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); 3101 3115 3102 3116 // Margins are now the only unknown … … 3108 3122 } else if (marginBefore.isAuto()) { 3109 3123 // Solve for top margin 3110 marginAfterValue = valueForLength(marginAfter, containerLogicalHeight );3124 marginAfterValue = valueForLength(marginAfter, containerLogicalHeight, renderView); 3111 3125 marginBeforeValue = availableSpace - marginAfterValue; 3112 3126 } else if (marginAfter.isAuto()) { 3113 3127 // Solve for bottom margin 3114 marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight );3128 marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight, renderView); 3115 3129 marginAfterValue = availableSpace - marginBeforeValue; 3116 3130 } else { 3117 3131 // 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); 3120 3134 } 3121 3135 } else { … … 3146 3160 3147 3161 // 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); 3150 3164 3151 3165 const LayoutUnit availableSpace = containerLogicalHeight - (marginBeforeValue + marginAfterValue + bordersPlusPadding); … … 3155 3169 // RULE 1: (height is content based, solve of top) 3156 3170 logicalHeightValue = contentLogicalHeight; 3157 logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight ));3171 logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView)); 3158 3172 } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) { 3159 3173 // RULE 3: (height is content based, no need solve of bottom) 3160 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight );3174 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); 3161 3175 logicalHeightValue = contentLogicalHeight; 3162 3176 } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { 3163 3177 // 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)); 3166 3180 } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { 3167 3181 // 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))); 3170 3184 } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) { 3171 3185 // 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); 3174 3188 } 3175 3189 } … … 3247 3261 LayoutUnit logicalLeftValue = 0; 3248 3262 LayoutUnit logicalRightValue = 0; 3263 RenderView* renderView = view(); 3249 3264 3250 3265 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) { … … 3252 3267 ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto())); 3253 3268 3254 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth );3255 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth );3269 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView); 3270 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView); 3256 3271 3257 3272 LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRightValue); … … 3276 3291 \*-----------------------------------------------------------------------*/ 3277 3292 } 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); 3281 3296 3282 3297 // Solve for 'left' 3283 3298 logicalLeftValue = availableSpace - (logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias); 3284 3299 } 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); 3288 3303 3289 3304 // Solve for 'right' 3290 3305 logicalRightValue = availableSpace - (logicalLeftValue + marginLogicalLeftAlias + marginLogicalRightAlias); 3291 3306 } 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); 3295 3310 3296 3311 // Solve for 'margin-left' 3297 3312 marginLogicalLeftAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalRightAlias); 3298 3313 } 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); 3302 3317 3303 3318 // Solve for 'margin-right' … … 3305 3320 } else { 3306 3321 // 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); 3311 3326 // If the containing block is right-to-left, then push the left position as far to the right as possible 3312 3327 if (containerDirection == RTL) { … … 3371 3386 Length logicalTop = style()->logicalTop(); 3372 3387 Length logicalBottom = style()->logicalBottom(); 3388 RenderView* renderView = view(); 3373 3389 3374 3390 /*-----------------------------------------------------------------------*\ … … 3414 3430 ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto())); 3415 3431 3416 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight );3417 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight );3432 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); 3433 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView); 3418 3434 3419 3435 LayoutUnit difference = availableSpace - (logicalTopValue + logicalBottomValue); … … 3427 3443 \*-----------------------------------------------------------------------*/ 3428 3444 } 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); 3432 3448 3433 3449 // Solve for 'top' 3434 3450 logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAlias + marginAfterAlias); 3435 3451 } 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); 3439 3455 3440 3456 // Solve for 'bottom' … … 3442 3458 // use the value. 3443 3459 } 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); 3447 3463 3448 3464 // Solve for 'margin-top' 3449 3465 marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginAfterAlias); 3450 3466 } 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); 3454 3470 3455 3471 // Solve for 'margin-bottom' … … 3457 3473 } else { 3458 3474 // 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); 3462 3478 // NOTE: It is not necessary to solve for 'bottom' because we don't ever 3463 3479 // use the value. -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r112198 r112301 438 438 RenderBlock* cb = containingBlock(); 439 439 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()); 442 442 } 443 443 if (!style()->right().isAuto()) { 444 444 RenderBlock* cb = containingBlock(); 445 return offset + -valueForLength(style()->right(), cb->availableWidth() );445 return offset + -valueForLength(style()->right(), cb->availableWidth(), view()); 446 446 } 447 447 return offset; … … 463 463 || !style()->top().isPercent() 464 464 || containingBlock->stretchesToViewport())) 465 return offset + valueForLength(style()->top(), containingBlock->availableHeight() );465 return offset + valueForLength(style()->top(), containingBlock->availableHeight(), view()); 466 466 467 467 if (!style()->bottom().isAuto() … … 469 469 || !style()->bottom().isPercent() 470 470 || containingBlock->stretchesToViewport())) 471 return offset + -valueForLength(style()->bottom(), containingBlock->availableHeight() );471 return offset + -valueForLength(style()->bottom(), containingBlock->availableHeight(), view()); 472 472 473 473 return offset; … … 554 554 { 555 555 LayoutUnit w = 0; 556 RenderView* renderView = 0; 556 557 Length padding = style()->paddingTop(); 557 558 if (padding.isPercent()) 558 559 w = containingBlock()->availableLogicalWidth(); 559 return minimumValueForLength(padding, w); 560 else if (padding.isViewportRelative()) 561 renderView = view(); 562 return minimumValueForLength(padding, w, renderView); 560 563 } 561 564 … … 563 566 { 564 567 LayoutUnit w = 0; 568 RenderView* renderView = 0; 565 569 Length padding = style()->paddingBottom(); 566 570 if (padding.isPercent()) 567 571 w = containingBlock()->availableLogicalWidth(); 568 return minimumValueForLength(padding, w); 572 else if (padding.isViewportRelative()) 573 renderView = view(); 574 return minimumValueForLength(padding, w, renderView); 569 575 } 570 576 … … 572 578 { 573 579 LayoutUnit w = 0; 580 RenderView* renderView = 0; 574 581 Length padding = style()->paddingLeft(); 575 582 if (padding.isPercent()) 576 583 w = containingBlock()->availableLogicalWidth(); 577 return minimumValueForLength(padding, w); 584 else if (padding.isViewportRelative()) 585 renderView = view(); 586 return minimumValueForLength(padding, w, renderView); 578 587 } 579 588 … … 581 590 { 582 591 LayoutUnit w = 0; 592 RenderView* renderView = 0; 583 593 Length padding = style()->paddingRight(); 584 594 if (padding.isPercent()) 585 595 w = containingBlock()->availableLogicalWidth(); 586 return minimumValueForLength(padding, w); 596 else if (padding.isViewportRelative()) 597 renderView = view(); 598 return minimumValueForLength(padding, w, renderView); 587 599 } 588 600 … … 590 602 { 591 603 LayoutUnit w = 0; 604 RenderView* renderView = 0; 592 605 Length padding = style()->paddingBefore(); 593 606 if (padding.isPercent()) 594 607 w = containingBlock()->availableLogicalWidth(); 595 return minimumValueForLength(padding, w); 608 else if (padding.isViewportRelative()) 609 renderView = view(); 610 return minimumValueForLength(padding, w, renderView); 596 611 } 597 612 … … 599 614 { 600 615 LayoutUnit w = 0; 616 RenderView* renderView = 0; 601 617 Length padding = style()->paddingAfter(); 602 618 if (padding.isPercent()) 603 619 w = containingBlock()->availableLogicalWidth(); 604 return minimumValueForLength(padding, w); 620 else if (padding.isViewportRelative()) 621 renderView = view(); 622 return minimumValueForLength(padding, w, renderView); 605 623 } 606 624 … … 608 626 { 609 627 LayoutUnit w = 0; 628 RenderView* renderView = 0; 610 629 Length padding = style()->paddingStart(); 611 630 if (padding.isPercent()) 612 631 w = containingBlock()->availableLogicalWidth(); 613 return minimumValueForLength(padding, w); 632 else if (padding.isViewportRelative()) 633 renderView = view(); 634 return minimumValueForLength(padding, w, renderView); 614 635 } 615 636 … … 617 638 { 618 639 LayoutUnit w = 0; 640 RenderView* renderView = 0; 619 641 Length padding = style()->paddingEnd(); 620 642 if (padding.isPercent()) 621 643 w = containingBlock()->availableLogicalWidth(); 622 return minimumValueForLength(padding, w); 644 else if (padding.isViewportRelative()) 645 renderView = view(); 646 return minimumValueForLength(padding, w, renderView); 623 647 } 624 648 … … 626 650 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 627 651 { 628 RoundedRect border = style()->getRoundedBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge); 652 RenderView* renderView = view(); 653 RoundedRect border = style()->getRoundedBorderFor(borderRect, renderView, includeLogicalLeftEdge, includeLogicalRightEdge); 629 654 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); 631 656 border.setRadii(segmentBorder.radii()); 632 657 } … … 987 1012 988 1013 IntSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize); 989 1014 RenderView* renderView = view(); 990 1015 switch (type) { 991 1016 case SizeLength: { … … 998 1023 if (layerWidth.isFixed()) 999 1024 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); 1002 1027 1003 1028 if (layerHeight.isFixed()) 1004 1029 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); 1007 1032 1008 1033 // If one of the values is auto we have to use the appropriate … … 1139 1164 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); 1140 1165 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); 1143 1169 if (backgroundRepeatX == RepeatFill) 1144 1170 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - (xPosition + left) % geometry.tileSize().width() : 0); … … 1146 1172 geometry.setNoRepeatX(xPosition + left); 1147 1173 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); 1149 1175 if (backgroundRepeatY == RepeatFill) 1150 1176 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - (yPosition + top) % geometry.tileSize().height() : 0); … … 1159 1185 } 1160 1186 1161 static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent )1187 static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent, RenderView* renderView) 1162 1188 { 1163 1189 if (borderSlice.isRelative()) … … 1165 1191 if (borderSlice.isAuto()) 1166 1192 return imageSide; 1167 return valueForLength(borderSlice, boxExtent );1193 return valueForLength(borderSlice, boxExtent, renderView); 1168 1194 } 1169 1195 … … 1202 1228 int imageWidth = imageSize.width() / style->effectiveZoom(); 1203 1229 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)); 1209 1236 1210 1237 ENinePieceImageRule hRule = ninePieceImage.horizontalRule(); 1211 1238 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); 1217 1244 1218 1245 // Reduce the widths if they're too large. … … 1758 1785 BorderEdge edges[4]; 1759 1786 getBorderEdgeInfo(edges, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1760 1761 RoundedRect outerBorder = style->getRoundedBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge); 1787 RoundedRect outerBorder = style->getRoundedBorderFor(rect, view(), includeLogicalLeftEdge, includeLogicalRightEdge); 1762 1788 RoundedRect innerBorder = style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge); 1763 1789 … … 2044 2070 GraphicsContextStateSaver stateSaver(*graphicsContext, false); 2045 2071 if (style->hasBorderRadius()) { 2046 border.includeLogicalEdges(style->getRoundedBorderFor(border.rect() ).radii(),2072 border.includeLogicalEdges(style->getRoundedBorderFor(border.rect(), view()).radii(), 2047 2073 horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); 2048 2074 if (border.isRounded()) { … … 2697 2723 2698 2724 RoundedRect border = (shadowStyle == Inset) ? s->getRoundedInnerBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge) 2699 : s->getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge);2725 : s->getRoundedBorderFor(paintRect, view(), includeLogicalLeftEdge, includeLogicalRightEdge); 2700 2726 2701 2727 bool hasBorderRadius = s->hasBorderRadius(); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r112198 r112301 587 587 return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child); 588 588 } 589 return minimumValueForLength(mainAxisLength, mainAxisContentExtent() );589 return minimumValueForLength(mainAxisLength, mainAxisContentExtent(), view()); 590 590 } 591 591 … … 661 661 { 662 662 LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); 663 RenderView* renderView = view(); 663 664 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { 664 665 flexOrderValues.add(child->style()->flexOrder()); … … 678 679 // computes the start/end margins. 679 680 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)); 682 683 } 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)); 685 686 } 686 687 } … … 705 706 Length max = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight(); 706 707 Length min = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); 708 RenderView* renderView = view(); 707 709 // FIXME: valueForLength isn't quite right in quirks mode: percentage heights should check parents until a value is found. 708 710 // 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); 713 715 return childSize; 714 716 } … … 766 768 { 767 769 childSizes.clear(); 768 769 770 LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); 770 771 LayoutUnit totalViolation = 0; -
trunk/Source/WebCore/rendering/RenderInline.cpp
r112237 r112301 703 703 if (margin.isPercent()) 704 704 return minimumValueForLength(margin, max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth())); 705 if (margin.isViewportRelative()) 706 return valueForLength(margin, 0, renderer->view()); 705 707 return 0; 706 708 } … … 1314 1316 RenderStyle* s = style(firstLine); 1315 1317 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()); 1320 1322 } 1321 1323 -
trunk/Source/WebCore/rendering/RenderMenuList.cpp
r112198 r112301 163 163 float optionWidth = 0; 164 164 if (RenderStyle* optionStyle = element->renderStyle()) 165 optionWidth += minimumValueForLength(optionStyle->textIndent(), 0 );165 optionWidth += minimumValueForLength(optionStyle->textIndent(), 0, view()); 166 166 if (!text.isEmpty()) 167 167 optionWidth += style()->font().width(text); -
trunk/Source/WebCore/rendering/RenderObject.cpp
r112200 r112301 1443 1443 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; 1444 1444 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); 1446 1446 LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth, 1447 1447 newOutlineBox.y(), … … 1462 1462 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; 1463 1463 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); 1465 1465 LayoutRect bottomRect(newOutlineBox.x(), 1466 1466 min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight, -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r112229 r112301 146 146 // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. 147 147 paintInfo.context->save(); 148 paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(paintRect ));148 paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(paintRect, view())); 149 149 } 150 150 } -
trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp
r112198 r112301 80 80 } 81 81 82 static int calcScrollbarThicknessUsing(const Length& l , int containingLength)82 static int calcScrollbarThicknessUsing(const Length& length, int containingLength, RenderView* renderView) 83 83 { 84 if (l .isIntrinsicOrAuto())84 if (length.isIntrinsicOrAuto()) 85 85 return ScrollbarTheme::theme()->scrollbarThickness(); 86 return minimumValueForLength(l , containingLength);86 return minimumValueForLength(length, containingLength, renderView); 87 87 } 88 88 … … 91 91 if (!m_scrollbar->owningRenderer()) 92 92 return; 93 RenderView* renderView = view(); 93 94 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); 97 98 setWidth(max(minWidth, min(maxWidth, w))); 98 99 99 100 // 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); 102 103 } 103 104 … … 106 107 if (!m_scrollbar->owningRenderer()) 107 108 return; 109 RenderView* renderView = view(); 108 110 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); 112 114 setHeight(max(minHeight, min(maxHeight, h))); 113 115 114 116 // 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); 117 119 } 118 120 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r112198 r112301 223 223 224 224 RenderBlock* cb = containingBlock(); 225 RenderView* renderView = view(); 225 226 226 227 LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent(); … … 233 234 else { 234 235 // 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); 237 238 LayoutUnit marginTotal = marginStart + marginEnd; 238 239 239 240 // Subtract out our margins to get the available content width. 240 241 LayoutUnit availableContentLogicalWidth = max<LayoutUnit>(0, containerWidthInInlineDirection - marginTotal); … … 262 263 computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth()); 263 264 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)); 266 267 } 267 268 } … … 277 278 borders = borderStart() + borderEnd() + (collapseBorders() ? 0 : paddingStart() + paddingEnd()); 278 279 } 279 return minimumValueForLength(styleLogicalWidth, availableWidth ) + borders;280 return minimumValueForLength(styleLogicalWidth, availableWidth, view()) + borders; 280 281 } 281 282 -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r111126 r112301 96 96 LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter()); 97 97 98 LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0 );98 LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0, view()); 99 99 if (document()->inQuirksMode() || style()->boxSizing() == BORDER_BOX) { 100 100 // Explicit heights use the border box in quirks mode. -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r112198 r112301 328 328 329 329 int spacing = table()->vBorderSpacing(); 330 331 LayoutStateMaintainer statePusher(view()); 330 331 RenderView* viewRenderer = view(); 332 LayoutStateMaintainer statePusher(viewRenderer); 332 333 333 334 m_rowPos.resize(m_grid.size() + 1); … … 339 340 340 341 // 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); 342 343 343 344 Row& row = m_grid[r].row; -
trunk/Source/WebCore/rendering/RenderText.h
r112200 r112301 25 25 26 26 #include "RenderObject.h" 27 #include "RenderView.h" 27 28 #include <wtf/Forward.h> 28 29 … … 100 101 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0); 101 102 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()); } 104 105 105 106 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r111764 r112301 1075 1075 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1076 1076 1077 RoundedRect border = o->style()->getRoundedBorderFor(r );1077 RoundedRect border = o->style()->getRoundedBorderFor(r, o->view()); 1078 1078 int radius = border.radii().topLeft().width(); 1079 1079 -
trunk/Source/WebCore/rendering/RenderView.h
r110224 r112301 192 192 IntervalArena* intervalArena(); 193 193 194 IntSize viewportSize() const { return document()->viewportSize(); } 194 195 protected: 195 196 virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const; -
trunk/Source/WebCore/rendering/RenderWidget.cpp
r111515 r112301 279 279 // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. 280 280 paintInfo.context->save(); 281 paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect ));281 paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect, view())); 282 282 } 283 283 -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r111126 r112301 845 845 verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection); 846 846 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()); 848 848 } 849 849 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r111126 r112301 875 875 } 876 876 877 static RoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize size )877 static RoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize size, RenderView* renderView) 878 878 { 879 879 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))); 888 888 } 889 889 … … 920 920 } 921 921 922 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const922 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, RenderView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const 923 923 { 924 924 RoundedRect roundedRect(pixelSnappedIntRect(borderRect)); 925 925 if (hasBorderRadius()) { 926 RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size() );926 RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView); 927 927 radii.scale(calcConstraintScaleFor(borderRect, radii)); 928 928 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge); -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r112198 r112301 623 623 624 624 Length lineHeight() const { return inherited->line_height; } 625 int computedLineHeight( ) const625 int computedLineHeight(RenderView* renderView = 0) const 626 626 { 627 627 const Length& lh = inherited->line_height; … … 633 633 if (lh.isPercent()) 634 634 return minimumValueForLength(lh, fontSize()); 635 636 if (lh.isViewportRelative()) 637 return valueForLength(lh, 0, renderView); 635 638 636 639 return lh.value(); … … 1066 1069 } 1067 1070 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; 1069 1072 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; 1070 1073 -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r112091 r112301 154 154 } 155 155 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));156 static 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)); 159 159 } 160 160 … … 172 172 173 173 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()); 175 175 176 176 // Only SVGs embedded in <object> reach this point. … … 203 203 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this)); 204 204 205 return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), containingBlock()->availableLogicalHeight() );205 return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), containingBlock()->availableLogicalHeight(), view()); 206 206 } 207 207
Note: See TracChangeset
for help on using the changeset viewer.