move calc*Value functions out from Length (and platform)
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Mar 2012 19:54:09 +0000 (19:54 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Mar 2012 19:54:09 +0000 (19:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80897

Moving the Length calc*Value functions out from Length structure and also from /WebCore/platform/ folder.
This helps to avoid the layering violation while length calculation. Otherwise layer violation can be avoided only by adding a virtual interface(bug 27160).

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

Source/WebCore:

* GNUmakefile.list.am: Build system changes for adding new files.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
(getAttributeSetForAccessibilityObject):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/LengthFunctions.h: Added. Moved calc*Value functions of Length.
(WebCore):
(WebCore::calculateMinimumValue):
(WebCore::calculateValue):
(WebCore::calculateFloatValue):
* dom/Document.cpp:
(WebCore::Document::pageSizeAndMarginsInPixels):
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::getRegion):
* platform/CalculationValue.h:
(WebCore::CalcExpressionLength::evaluate):
* platform/Length.h: Removed the calc*Value functions from Length structure.
(Length):
(WebCore::Length::getFloatValue):
(WebCore::Length::getIntValue):
* platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayer::setFilters):
* platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
(WebCore::CCRenderSurfaceFilters::apply):
* platform/graphics/filters/FilterOperations.cpp:
(WebCore::FilterOperations::getOutsets):
* platform/graphics/transforms/PerspectiveTransformOperation.cpp:
(WebCore::PerspectiveTransformOperation::blend):
* platform/graphics/transforms/PerspectiveTransformOperation.h:
(WebCore::PerspectiveTransformOperation::isIdentity):
(WebCore::PerspectiveTransformOperation::apply):
* platform/graphics/transforms/TranslateTransformOperation.h:
(WebCore::TranslateTransformOperation::x):
(WebCore::TranslateTransformOperation::y):
(WebCore::TranslateTransformOperation::z):
(WebCore::TranslateTransformOperation::isIdentity):
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::paint):
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::layout):
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::build):
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::layout):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::textIndentOffset):
(WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::reflectionOffset):
(WebCore::RenderBox::clipRect):
(WebCore::RenderBox::computeLogicalWidthInRegion):
(WebCore::RenderBox::computeLogicalWidthInRegionUsing):
(WebCore::RenderBox::computeInlineDirectionMargins):
(WebCore::RenderBox::computePercentageLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::availableLogicalHeightUsing):
(WebCore::RenderBox::computeBlockDirectionMargins):
(WebCore::RenderBox::computePositionedLogicalWidthUsing):
(WebCore::RenderBox::computePositionedLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalWidthReplaced):
(WebCore::RenderBox::computePositionedLogicalHeightReplaced):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::relativePositionOffsetX):
(WebCore::RenderBoxModelObject::relativePositionOffsetY):
(WebCore::RenderBoxModelObject::paddingTop):
(WebCore::RenderBoxModelObject::paddingBottom):
(WebCore::RenderBoxModelObject::paddingLeft):
(WebCore::RenderBoxModelObject::paddingRight):
(WebCore::RenderBoxModelObject::paddingBefore):
(WebCore::RenderBoxModelObject::paddingAfter):
(WebCore::RenderBoxModelObject::paddingStart):
(WebCore::RenderBoxModelObject::paddingEnd):
(WebCore::RenderBoxModelObject::calculateFillTileSize):
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
(WebCore::computeBorderImageSide):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
(WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithm):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::layOutAxis):
* rendering/RenderInline.cpp:
(WebCore::computeMargin):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::perspectiveTransform):
(WebCore::RenderLayer::perspectiveOrigin):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::computeTransformOrigin):
(WebCore::RenderLayerBacking::computePerspectiveOrigin):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::timerFired):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::updateOptionsWidth):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::repaintAfterLayoutIfNeeded):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth):
* rendering/RenderScrollbarPart.cpp:
(WebCore::calcScrollbarThicknessUsing):
(WebCore::RenderScrollbarPart::computeScrollbarWidth):
(WebCore::RenderScrollbarPart::computeScrollbarHeight):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::computeLogicalWidth):
(WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::logicalHeightForRowSizing):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::calcRowLogicalHeight):
* rendering/RenderText.h:
(WebCore::RenderText::marginLeft):
(WebCore::RenderText::marginRight):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::verticalPositionForBox):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::applyTransform):
(WebCore::calcRadiiFor):
* rendering/style/RenderStyle.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation):
(WebCore::resolveLengthAttributeForSVG):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::currentViewBoxRect):
(WebCore::SVGSVGElement::currentViewportSize):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::computeIntrinsicDimensions):

Source/WebKit2:

* WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
(WebKit::WebPopupMenu::setUpPlatformData):

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

49 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/LengthFunctions.h [new file with mode: 0644]
Source/WebCore/dom/Document.cpp
Source/WebCore/html/HTMLAreaElement.cpp
Source/WebCore/platform/CalculationValue.h
Source/WebCore/platform/Length.h
Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp
Source/WebCore/platform/graphics/filters/FilterOperations.cpp
Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h
Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
Source/WebCore/platform/win/PopupMenuWin.cpp
Source/WebCore/rendering/AutoTableLayout.cpp
Source/WebCore/rendering/FilterEffectRenderer.cpp
Source/WebCore/rendering/FixedTableLayout.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFrameSet.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderMarquee.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderScrollbarPart.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/RenderText.h
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/svg/SVGSVGElement.cpp
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp

index 836deadc07615f27cc1556290820027418435a5a..8790aa6378b7f15404e09f45cdd92b072f812769 100644 (file)
@@ -1,3 +1,146 @@
+2012-03-17  Joe Thomas  <joethomas@motorola.com>
+
+        move calc*Value functions out from Length (and platform)
+        https://bugs.webkit.org/show_bug.cgi?id=80897
+
+        Moving the Length calc*Value functions out from Length structure and also from /WebCore/platform/ folder.
+        This helps to avoid the layering violation while length calculation. Otherwise layer violation can be avoided only by adding a virtual interface(bug 27160).
+
+        Reviewed by Antti Koivisto.
+
+        * GNUmakefile.list.am: Build system changes for adding new files.
+        * Target.pri: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
+        (getAttributeSetForAccessibilityObject):
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/LengthFunctions.h: Added. Moved calc*Value functions of Length.
+        (WebCore):
+        (WebCore::calculateMinimumValue):
+        (WebCore::calculateValue):
+        (WebCore::calculateFloatValue):
+        * dom/Document.cpp:
+        (WebCore::Document::pageSizeAndMarginsInPixels):
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::getRegion):
+        * platform/CalculationValue.h:
+        (WebCore::CalcExpressionLength::evaluate):
+        * platform/Length.h: Removed the calc*Value functions from Length structure.
+        (Length):
+        (WebCore::Length::getFloatValue):
+        (WebCore::Length::getIntValue):
+        * platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayer::setFilters):
+        * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
+        (WebCore::CCRenderSurfaceFilters::apply):
+        * platform/graphics/filters/FilterOperations.cpp:
+        (WebCore::FilterOperations::getOutsets):
+        * platform/graphics/transforms/PerspectiveTransformOperation.cpp:
+        (WebCore::PerspectiveTransformOperation::blend):
+        * platform/graphics/transforms/PerspectiveTransformOperation.h:
+        (WebCore::PerspectiveTransformOperation::isIdentity):
+        (WebCore::PerspectiveTransformOperation::apply):
+        * platform/graphics/transforms/TranslateTransformOperation.h:
+        (WebCore::TranslateTransformOperation::x):
+        (WebCore::TranslateTransformOperation::y):
+        (WebCore::TranslateTransformOperation::z):
+        (WebCore::TranslateTransformOperation::isIdentity):
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::paint):
+        * rendering/AutoTableLayout.cpp:
+        (WebCore::AutoTableLayout::layout):
+        * rendering/FilterEffectRenderer.cpp:
+        (WebCore::FilterEffectRenderer::build):
+        * rendering/FixedTableLayout.cpp:
+        (WebCore::FixedTableLayout::layout):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::textIndentOffset):
+        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::reflectionOffset):
+        (WebCore::RenderBox::clipRect):
+        (WebCore::RenderBox::computeLogicalWidthInRegion):
+        (WebCore::RenderBox::computeLogicalWidthInRegionUsing):
+        (WebCore::RenderBox::computeInlineDirectionMargins):
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+        (WebCore::RenderBox::availableLogicalHeightUsing):
+        (WebCore::RenderBox::computeBlockDirectionMargins):
+        (WebCore::RenderBox::computePositionedLogicalWidthUsing):
+        (WebCore::RenderBox::computePositionedLogicalHeightUsing):
+        (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
+        (WebCore::RenderBox::computePositionedLogicalHeightReplaced):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::relativePositionOffsetX):
+        (WebCore::RenderBoxModelObject::relativePositionOffsetY):
+        (WebCore::RenderBoxModelObject::paddingTop):
+        (WebCore::RenderBoxModelObject::paddingBottom):
+        (WebCore::RenderBoxModelObject::paddingLeft):
+        (WebCore::RenderBoxModelObject::paddingRight):
+        (WebCore::RenderBoxModelObject::paddingBefore):
+        (WebCore::RenderBoxModelObject::paddingAfter):
+        (WebCore::RenderBoxModelObject::paddingStart):
+        (WebCore::RenderBoxModelObject::paddingEnd):
+        (WebCore::RenderBoxModelObject::calculateFillTileSize):
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+        (WebCore::computeBorderImageSide):
+        (WebCore::RenderBoxModelObject::paintNinePieceImage):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
+        (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
+        (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithm):
+        * rendering/RenderFrameSet.cpp:
+        (WebCore::RenderFrameSet::layOutAxis):
+        * rendering/RenderInline.cpp:
+        (WebCore::computeMargin):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::perspectiveTransform):
+        (WebCore::RenderLayer::perspectiveOrigin):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::computeTransformOrigin):
+        (WebCore::RenderLayerBacking::computePerspectiveOrigin):
+        * rendering/RenderMarquee.cpp:
+        (WebCore::RenderMarquee::timerFired):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::updateOptionsWidth):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::computeReplacedLogicalWidth):
+        * rendering/RenderScrollbarPart.cpp:
+        (WebCore::calcScrollbarThicknessUsing):
+        (WebCore::RenderScrollbarPart::computeScrollbarWidth):
+        (WebCore::RenderScrollbarPart::computeScrollbarHeight):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::computeLogicalWidth):
+        (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::logicalHeightForRowSizing):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::calcRowLogicalHeight):
+        * rendering/RenderText.h:
+        (WebCore::RenderText::marginLeft):
+        (WebCore::RenderText::marginRight):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::verticalPositionForBox):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::applyTransform):
+        (WebCore::calcRadiiFor):
+        * rendering/style/RenderStyle.h:
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation):
+        (WebCore::resolveLengthAttributeForSVG):
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::currentViewBoxRect):
+        (WebCore::SVGSVGElement::currentViewportSize):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::computeIntrinsicDimensions):
+
 2012-03-17  Nikolas Zimmermann  <nzimmermann@rim.com>
 
         Enable animVal support for SVGNumberOptionalNumber
index dc1a0b1e9cff433ed41da3bfbfe274f994542aeb..32ce0afc83dde72fa2b99a672f148aedffe18a30 100644 (file)
@@ -1645,6 +1645,7 @@ webcore_sources += \
        Source/WebCore/css/FontFeatureValue.h \
        Source/WebCore/css/FontValue.cpp \
        Source/WebCore/css/FontValue.h \
+       Source/WebCore/css/LengthFunctions.h \
        Source/WebCore/css/MediaFeatureNames.cpp \
        Source/WebCore/css/MediaFeatureNames.h \
        Source/WebCore/css/MediaList.cpp \
index 7063ac1b593658b99b1f51d3ca0e4e2b27cc8ac9..327c6e2289dd4b5c6dc7113a44b9969621c89124 100644 (file)
@@ -1609,6 +1609,7 @@ HEADERS += \
     css/CSSWrapShapes.h \
     css/FontFeatureValue.h \
     css/FontValue.h \
+    css/LengthFunctions.h \
     css/MediaFeatureNames.h \
     css/MediaList.h \
     css/MediaQuery.h \
index a5e845889a9fb025645ce8b865e9357c65e9fca0..3e6f482113b23c6b01a5ef9dec84e9105f9858e3 100644 (file)
@@ -89,6 +89,7 @@
             'css/CSSValue.h',
             'css/CSSValueList.h',
             'css/CSSWrapShapes.h',
+            'css/LengthFunctions.h',
             'css/Pair.h',
             'css/WebKitCSSFilterValue.h',
             'css/WebKitCSSShaderValue.h',
index 075c69b8f24f1905e61fd4c363166d7684ed42af..e07a73148545591473c4a46d5bf56b6df4478296 100755 (executable)
                                RelativePath="..\css\html.css"
                                >
                        </File>
+                       <File
+                               RelativePath="..\css\LengthFunctions.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\css\MediaAllInOne.cpp"
                                >
index bcdeaad13b516534d412b849e73e29e07be82cbd..77ddd765b5a5da62a96937002b62cdacc42d0622 100644 (file)
                E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C279570CF9741900E97B98 /* RenderMedia.h */; };
                E4D687770ED7AE3D006EA978 /* PurgeableBufferMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */; };
                E4D687790ED7AE4F006EA978 /* PurgeableBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */; };
+               E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
                ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */; settings = {ATTRIBUTES = (Private, ); }; };
                ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; };
                EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = EDE3A4FF0C7A430600956A37 /* ColorMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E4C279570CF9741900E97B98 /* RenderMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMedia.h; sourceTree = "<group>"; };
                E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PurgeableBufferMac.cpp; sourceTree = "<group>"; };
                E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgeableBuffer.h; sourceTree = "<group>"; };
+               E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthFunctions.h; sourceTree = "<group>"; };
                ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarker.h; sourceTree = "<group>"; };
                ED501DC50B249F2900AE18D9 /* EditorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = EditorMac.mm; path = mac/EditorMac.mm; sourceTree = "<group>"; };
                EDE3A4FF0C7A430600956A37 /* ColorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorMac.h; sourceTree = "<group>"; };
                                CD4E0AFA11F7BC27009D3811 /* fullscreen.css */,
                                CDBD93BA1333BD4B002570E3 /* fullscreenQuickTime.css */,
                                93CA4C9909DF93FA00DF8677 /* html.css */,
+                               E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */,
                                93CA4C9A09DF93FA00DF8677 /* make-css-file-arrays.pl */,
                                93CA4C9B09DF93FA00DF8677 /* makeprop.pl */,
                                93CA4C9D09DF93FA00DF8677 /* makevalues.pl */,
                                512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */,
                                BCE65BEB0EACDF16007E4533 /* Length.h in Headers */,
                                BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */,
+                               E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */,
                                BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */,
                                8CADF2A9135C7B36009EF43F /* LevelDBComparator.h in Headers */,
                                8CADF2AB135C7B36009EF43F /* LevelDBDatabase.h in Headers */,
index f7bbc30ef1fee55850f676a806f85be7ca02a87f..37bbe3a0c6686e39805a16dad2bd56d4229d489b 100644 (file)
@@ -240,7 +240,7 @@ static AtkAttributeSet* getAttributeSetForAccessibilityObject(const Accessibilit
     }
 
     if (!style->textIndent().isUndefined()) {
-        int indentation = style->textIndent().calcValue(object->size().width());
+        int indentation = valueForLength(style->textIndent(), object->size().width());
         buffer.set(g_strdup_printf("%i", indentation));
         result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
     }
index 1d7d44afc2184d1b059b0f57599b4a4b9b47ba7b..698a728f4300f09dceb9e122cae69db8df41eed0 100644 (file)
@@ -1774,7 +1774,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
                 // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
                 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
                 // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
-                value = marginRight.calcMinValue(toRenderBox(renderer)->containingBlockLogicalWidthForContent());
+                value = miminumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent());
             else
                 value = toRenderBox(renderer)->marginRight();
             return zoomAdjustedPixelValue(value, style.get(), cssValuePool);
@@ -2186,8 +2186,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
             if (renderer) {
                 LayoutRect box = sizingBox(renderer);
-                list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get(), cssValuePool));
-                list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get(), cssValuePool));
+                list->append(zoomAdjustedPixelValue(miminumValueForLength(style->perspectiveOriginX(), box.width()), style.get(), cssValuePool));
+                list->append(zoomAdjustedPixelValue(miminumValueForLength(style->perspectiveOriginY(), box.height()), style.get(), cssValuePool));
             }
             else {
                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get(), cssValuePool));
@@ -2232,8 +2232,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
             if (renderer) {
                 IntRect box = sizingBox(renderer);
-                list->append(zoomAdjustedPixelValue(style->transformOriginX().calcMinValue(box.width()), style.get(), cssValuePool));
-                list->append(zoomAdjustedPixelValue(style->transformOriginY().calcMinValue(box.height()), style.get(), cssValuePool));
+                list->append(zoomAdjustedPixelValue(miminumValueForLength(style->transformOriginX(), box.width()), style.get(), cssValuePool));
+                list->append(zoomAdjustedPixelValue(miminumValueForLength(style->transformOriginY(), box.height()), style.get(), cssValuePool));
                 if (style->transformOriginZ() != 0)
                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), cssValuePool));
             } else {
diff --git a/Source/WebCore/css/LengthFunctions.h b/Source/WebCore/css/LengthFunctions.h
new file mode 100644 (file)
index 0000000..425e3c9
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+    Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+    Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+    Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com)
+    Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
+    Copyright (C) 2012 Motorola Mobility, Inc. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef LengthFunctions_h
+#define LengthFunctions_h
+
+#include "Length.h"
+
+namespace WebCore {
+
+inline int miminumValueForLength(Length length, int maximumValue, bool roundPercentages = false)
+{
+    switch (length.type()) {
+    case Fixed:
+        return length.value();
+    case Percent:
+        if (roundPercentages)
+            return static_cast<int>(round(maximumValue * length.percent() / 100.0f));
+        // Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.
+        return static_cast<int>(static_cast<float>(maximumValue * length.percent() / 100.0f));
+    case Calculated:
+        return length.nonNanCalculatedValue(maximumValue);
+    case Auto:
+        return 0;
+    case Relative:
+    case Intrinsic:
+    case MinIntrinsic:
+    case Undefined:
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+inline int valueForLength(Length length, int maximumValue, bool roundPercentages = false)
+{
+    switch (length.type()) {
+    case Fixed:
+    case Percent:
+    case Calculated:
+        return miminumValueForLength(length, maximumValue, roundPercentages);
+    case Auto:
+        return maximumValue;
+    case Relative:
+    case Intrinsic:
+    case MinIntrinsic:
+    case Undefined:
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+// FIXME: when subpixel layout is supported this copy of floatValueForLength() can be removed. See bug 71143.
+inline float floatValueForLength(Length length, int maximumValue)
+{
+    switch (length.type()) {
+    case Fixed:
+        return length.getFloatValue();
+    case Percent:
+        return static_cast<float>(maximumValue * length.percent() / 100.0f);
+    case Auto:
+        return static_cast<float>(maximumValue);
+    case Calculated:
+        return length.nonNanCalculatedValue(maximumValue);                
+    case Relative:
+    case Intrinsic:
+    case MinIntrinsic:
+    case Undefined:
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+inline float floatValueForLength(Length length, float maximumValue)
+{
+    switch (length.type()) {
+    case Fixed:
+        return length.getFloatValue();
+    case Percent:
+        return static_cast<float>(maximumValue * length.percent() / 100.0f);
+    case Auto:
+        return static_cast<float>(maximumValue);
+    case Calculated:
+        return length.nonNanCalculatedValue(maximumValue);
+    case Relative:
+    case Intrinsic:
+    case MinIntrinsic:
+    case Undefined:
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+} // namespace WebCore
+
+#endif // LengthFunctions_h
index 581f56e8004927af5c5e38ef3be556522f0fd3bf..81db636903d49fd25877c671b1c5180fff921143 100644 (file)
@@ -1802,8 +1802,8 @@ void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
         LengthSize size = style->pageSize();
         ASSERT(size.width().isFixed());
         ASSERT(size.height().isFixed());
-        width = size.width().calcValue(0);
-        height = size.height().calcValue(0);
+        width = valueForLength(size.width(), 0);
+        height = valueForLength(size.height(), 0);
         break;
     }
     default:
@@ -1813,10 +1813,10 @@ void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
 
     // The percentage is calculated with respect to the width even for margin top and bottom.
     // http://www.w3.org/TR/CSS2/box.html#margin-properties
-    marginTop = style->marginTop().isAuto() ? marginTop : style->marginTop().calcValue(width);
-    marginRight = style->marginRight().isAuto() ? marginRight : style->marginRight().calcValue(width);
-    marginBottom = style->marginBottom().isAuto() ? marginBottom : style->marginBottom().calcValue(width);
-    marginLeft = style->marginLeft().isAuto() ? marginLeft : style->marginLeft().calcValue(width);
+    marginTop = style->marginTop().isAuto() ? marginTop : valueForLength(style->marginTop(), width);
+    marginRight = style->marginRight().isAuto() ? marginRight : valueForLength(style->marginRight(), width);
+    marginBottom = style->marginBottom().isAuto() ? marginBottom : valueForLength(style->marginBottom(), width);
+    marginLeft = style->marginLeft().isAuto() ? marginLeft : valueForLength(style->marginLeft(), width);
 }
 
 PassRefPtr<CSSValuePool> Document::cssValuePool() const
index 57b5f768d4886055b556fe9c94f0727b6020f3ba..5cce169154702217065b8842b1ee068fde674fa0 100644 (file)
@@ -147,25 +147,25 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const
         case Poly:
             if (m_coordsLen >= 6) {
                 int numPoints = m_coordsLen / 2;
-                path.moveTo(FloatPoint(m_coords[0].calcMinValue(width), m_coords[1].calcMinValue(height)));
+                path.moveTo(FloatPoint(miminumValueForLength(m_coords[0], width), miminumValueForLength(m_coords[1], height)));
                 for (int i = 1; i < numPoints; ++i)
-                    path.addLineTo(FloatPoint(m_coords[i * 2].calcMinValue(width), m_coords[i * 2 + 1].calcMinValue(height)));
+                    path.addLineTo(FloatPoint(miminumValueForLength(m_coords[i * 2], width), miminumValueForLength(m_coords[i * 2 + 1], height)));
                 path.closeSubpath();
             }
             break;
         case Circle:
             if (m_coordsLen >= 3) {
                 Length radius = m_coords[2];
-                int r = min(radius.calcMinValue(width), radius.calcMinValue(height));
-                path.addEllipse(FloatRect(m_coords[0].calcMinValue(width) - r, m_coords[1].calcMinValue(height) - r, 2 * r, 2 * r));
+                int r = min(miminumValueForLength(radius, width), miminumValueForLength(radius, height));
+                path.addEllipse(FloatRect(miminumValueForLength(m_coords[0], width) - r, miminumValueForLength(m_coords[1], height) - r, 2 * r, 2 * r));
             }
             break;
         case Rect:
             if (m_coordsLen >= 4) {
-                int x0 = m_coords[0].calcMinValue(width);
-                int y0 = m_coords[1].calcMinValue(height);
-                int x1 = m_coords[2].calcMinValue(width);
-                int y1 = m_coords[3].calcMinValue(height);
+                int x0 = miminumValueForLength(m_coords[0], width);
+                int y0 = miminumValueForLength(m_coords[1], height);
+                int x1 = miminumValueForLength(m_coords[2], width);
+                int y1 = miminumValueForLength(m_coords[3], height);
                 path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
             }
             break;
index c55845542110a775f32c8787f9f699991d93e55c..9339b105f1557b54cf4e3d478834d6396e3edfd8 100755 (executable)
@@ -32,6 +32,7 @@
 #define CalculationValue_h
 
 #include "Length.h"
+#include "LengthFunctions.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
@@ -101,7 +102,7 @@ public:
 
     virtual float evaluate(float maxValue) const
     {
-        return m_length.calcFloatValue(maxValue);
+        return floatValueForLength(m_length, maxValue);
     }
     
 private:
index 5e74742f259d345ebb9f3514fafd2c54ad9171b4..b2c3b116abad067f0c711f286c055b8b75265865 100644 (file)
@@ -159,96 +159,6 @@ public:
         *this = Length(value, Fixed);
     }
 
-    int calcValue(int maxValue, bool roundPercentages = false) const
-    {
-        switch (type()) {
-            case Fixed:
-            case Percent:
-            case Calculated:
-                return calcMinValue(maxValue, roundPercentages);
-            case Auto:
-                return maxValue;
-            case Relative:
-            case Intrinsic:
-            case MinIntrinsic:
-            case Undefined:
-                ASSERT_NOT_REACHED();
-                return 0;
-        }
-        ASSERT_NOT_REACHED();
-        return 0;
-    }
-
-    int calcMinValue(int maxValue, bool roundPercentages = false) const
-    {
-        switch (type()) {
-            case Fixed:
-                return value();
-            case Percent:
-                if (roundPercentages)
-                    return static_cast<int>(round(maxValue * percent() / 100.0f));
-                // Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.
-                return static_cast<int>(static_cast<float>(maxValue * percent() / 100.0f));
-            case Calculated:
-                return nonNanCalculatedValue(maxValue);
-            case Auto:
-                return 0;
-            case Relative:
-            case Intrinsic:
-            case MinIntrinsic:
-            case Undefined:
-                ASSERT_NOT_REACHED();
-                return 0;
-        }
-        ASSERT_NOT_REACHED();
-        return 0;
-    }
-
-    // FIXME: when subpixel layout is supported this copy of calcFloatValue() can be removed. See bug 71143.
-    float calcFloatValue(int maxValue) const
-    {
-        switch (type()) {
-            case Fixed:
-                return getFloatValue();
-            case Percent:
-                return static_cast<float>(maxValue * percent() / 100.0f);
-            case Auto:
-                return static_cast<float>(maxValue);
-            case Calculated:
-                return nonNanCalculatedValue(maxValue);                
-            case Relative:
-            case Intrinsic:
-            case MinIntrinsic:
-            case Undefined:
-                ASSERT_NOT_REACHED();
-                return 0;
-        }
-        ASSERT_NOT_REACHED();
-        return 0;
-    }
-
-    float calcFloatValue(float maxValue) const
-    {
-        switch (type()) {
-        case Fixed:
-            return getFloatValue();
-        case Percent:
-            return static_cast<float>(maxValue * percent() / 100.0f);
-        case Auto:
-            return static_cast<float>(maxValue);
-        case Calculated:
-            return nonNanCalculatedValue(maxValue);
-        case Relative:
-        case Intrinsic:
-        case MinIntrinsic:
-        case Undefined:
-            ASSERT_NOT_REACHED();
-            return 0;
-        }
-        ASSERT_NOT_REACHED();
-        return 0;
-    }
-
     bool isUndefined() const { return type() == Undefined; }
 
     // FIXME calc: https://bugs.webkit.org/show_bug.cgi?id=80357. A calculated Length 
@@ -312,19 +222,19 @@ public:
         return Length(WebCore::blend(fromValue, toValue, progress), resultType);
     }
 
-private:
-    int getIntValue() const
+    float getFloatValue() const
     {
         ASSERT(!isUndefined());
-        return m_isFloat ? static_cast<int>(m_floatValue) : m_intValue;
+        return m_isFloat ? m_floatValue : m_intValue;
     }
+    float nonNanCalculatedValue(int maxValue) const;
 
-    float getFloatValue() const
+private:
+    int getIntValue() const
     {
         ASSERT(!isUndefined());
-        return m_isFloat ? m_floatValue : m_intValue;
+        return m_isFloat ? static_cast<int>(m_floatValue) : m_intValue;
     }
-
     void initFromLength(const Length &length) 
     {
         m_quirk = length.m_quirk;
@@ -339,8 +249,7 @@ private:
         if (isCalculated())
             incrementCalculatedRef();
     }
-    
-    float nonNanCalculatedValue(int maxValue) const;
+
     int calculationHandle() const
     {
         ASSERT(isCalculated());
index 11be288835b97b712b4fe1bc2b3fa8b6af24f258..5cf10066a50e417e19480cbf03caa3f52ef03a67 100644 (file)
@@ -30,6 +30,7 @@
 #import "PlatformCAAnimation.h"
 
 #import "FloatConversion.h"
+#import "LengthFunctions.h"
 #import "PlatformString.h"
 #import "TimingFunction.h"
 #import <QuartzCore/QuartzCore.h>
@@ -502,7 +503,7 @@ static RetainPtr<id> filterValueForOperation(const FilterOperation* operation, i
 
         if (!operation->isDefault()) {
             const BlurFilterOperation* op = static_cast<const BlurFilterOperation*>(operation);
-            amount = op->stdDeviation().calcFloatValue(0);
+            amount = floatValueForLength(op->stdDeviation(), 0);
         }
         
         value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
index e124a1647333adc27936881bed454a9780e4342c..c33989c4790ab3908a94bc3f5a8c256cfcb72af9 100644 (file)
@@ -34,6 +34,7 @@
 #import "FloatConversion.h"
 #import "GraphicsContext.h"
 #import "GraphicsLayerCA.h"
+#import "LengthFunctions.h"
 #import "WebLayer.h"
 #import "WebTiledLayer.h"
 #import "WebTileCacheLayer.h"
@@ -823,7 +824,7 @@ void PlatformCALayer::setFilters(const FilterOperations& filters)
             const BlurFilterOperation* op = static_cast<const BlurFilterOperation*>(filterOperation);
             CIFilter* caFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
             [caFilter setDefaults];
-            [caFilter setValue:[NSNumber numberWithFloat:op->stdDeviation().calcFloatValue(0)] forKey:@"inputRadius"];
+            [caFilter setValue:[NSNumber numberWithFloat:floatValueForLength(op->stdDeviation(), 0)] forKey:@"inputRadius"];
             [caFilter setName:filterName];
             [array.get() addObject:caFilter];
             break;
index 8826830c4228c40e4bfdd2cd9dd2b378bd7f063e..513b4618af63907c01545ffe34059219f8dacd1c 100644 (file)
@@ -30,6 +30,7 @@
 #include "cc/CCRenderSurfaceFilters.h"
 
 #include "GraphicsContext3D.h"
+#include "LengthFunctions.h"
 #include "SkBlurImageFilter.h"
 #include "SkCanvas.h"
 #include "SkColorMatrixFilter.h"
@@ -269,8 +270,8 @@ SkBitmap CCRenderSurfaceFilters::apply(const FilterOperations& filters, unsigned
         }
         case FilterOperation::BLUR: {
             const BlurFilterOperation* op = static_cast<const BlurFilterOperation*>(filterOperation);
-            float stdX = op->stdDeviation().calcFloatValue(0);
-            float stdY = op->stdDeviation().calcFloatValue(1);
+            float stdX = floatValueForLength(op->stdDeviation(), 0);
+            float stdY = floatValueForLength(op->stdDeviation(), 1);
             SkAutoTUnref<SkImageFilter> filter(new SkBlurImageFilter(stdX, stdY));
             SkPaint paint;
             paint.setImageFilter(filter.get());
index 35282cb53bbfdda7a6e89fcd8fe75cf5225c24b5..7543a41932967668bfd14cf8c8a426af9a753046 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "FEGaussianBlur.h"
 #include "IntSize.h"
+#include "LengthFunctions.h"
 
 #if ENABLE(CSS_FILTERS)
 
@@ -107,7 +108,7 @@ void FilterOperations::getOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit
         switch (filterOperation->getOperationType()) {
         case FilterOperation::BLUR: {
             BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
-            float stdDeviation = blurOperation->stdDeviation().calcFloatValue(0);
+            float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0);
             IntSize outset = outsetSizeForBlur(stdDeviation);
             top += outset.height();
             right += outset.width();
index 6ab605d9e0eded1135107f48929ee1c23550679d..e8422925c2e6f490ae75aa232aebfe0a0055ce2b 100644 (file)
@@ -39,7 +39,7 @@ PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const Transf
         return this;
     
     if (blendToIdentity) {
-        double p = m_p.calcFloatValue(1);
+        double p = floatValueForLength(m_p, 1);
         p = WebCore::blend(p, 1.0, progress); // FIXME: this seems wrong. https://bugs.webkit.org/show_bug.cgi?id=52700
         return PerspectiveTransformOperation::create(Length(clampToPositiveInteger(p), Fixed));
     }
@@ -50,8 +50,8 @@ PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const Transf
 
     TransformationMatrix fromT;
     TransformationMatrix toT;
-    fromT.applyPerspective(fromP.calcFloatValue(1));
-    toT.applyPerspective(toP.calcFloatValue(1));
+    fromT.applyPerspective(floatValueForLength(fromP, 1));
+    toT.applyPerspective(floatValueForLength(toP, 1));
     toT.blend(fromT, progress);
     TransformationMatrix::DecomposedType decomp;
     toT.decompose(decomp);
index 52452b35c5bfc12c3641c71b6ccba1c99e8ecdfe..3730d4275662229ba21661ed67b24e9a95006910 100644 (file)
@@ -27,6 +27,7 @@
 #define PerspectiveTransformOperation_h
 
 #include "Length.h"
+#include "LengthFunctions.h"
 #include "TransformOperation.h"
 
 namespace WebCore {
@@ -41,7 +42,7 @@ public:
     Length perspective() const { return m_p; }
     
 private:
-    virtual bool isIdentity() const { return m_p.calcFloatValue(1) == 0; }
+    virtual bool isIdentity() const { return !floatValueForLength(m_p, 1); }
     virtual OperationType getOperationType() const { return PERSPECTIVE; }
     virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == PERSPECTIVE; }
 
@@ -55,7 +56,7 @@ private:
 
     virtual bool apply(TransformationMatrix& transform, const FloatSize&) const
     {
-        transform.applyPerspective(m_p.calcFloatValue(1));
+        transform.applyPerspective(floatValueForLength(m_p, 1));
         return false;
     }
 
index b194d839beb9ed8d2ff2d79af947e811b9dafa9b..fc2bc1f278e5594b735af1674b193c08b1e69ad1 100644 (file)
@@ -26,6 +26,7 @@
 #define TranslateTransformOperation_h
 
 #include "Length.h"
+#include "LengthFunctions.h"
 #include "TransformOperation.h"
 
 namespace WebCore {
@@ -42,16 +43,16 @@ public:
         return adoptRef(new TranslateTransformOperation(tx, ty, tz, type));
     }
 
-    double x(const FloatSize& borderBoxSize) const { return m_x.calcFloatValue(borderBoxSize.width()); }
-    double y(const FloatSize& borderBoxSize) const { return m_y.calcFloatValue(borderBoxSize.height()); }
-    double z(const FloatSize&) const { return m_z.calcFloatValue(1); }
+    double x(const FloatSize& borderBoxSize) const { return floatValueForLength(m_x, borderBoxSize.width()); }
+    double y(const FloatSize& borderBoxSize) const { return floatValueForLength(m_y, borderBoxSize.height()); }
+    double z(const FloatSize&) const { return floatValueForLength(m_z, 1); }
 
     Length x() const { return m_x; }
     Length y() const { return m_y; }
     Length z() const { return m_z; }
 
 private:
-    virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0 && m_z.calcFloatValue(1) == 0; }
+    virtual bool isIdentity() const { return !floatValueForLength(m_x, 1) && !floatValueForLength(m_y, 1) && !floatValueForLength(m_z, 1); }
 
     virtual OperationType getOperationType() const { return m_type; }
     virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
index 9ac2674c43ac0e2e18c0292e1310cb85780b73e6..b2bc4cc3ed1cc374bde2f8c2671d064ba272ba25 100644 (file)
@@ -33,6 +33,7 @@
 #include "HTMLNames.h"
 #include "HWndDC.h"
 #include "HostWindow.h"
+#include "LengthFunctions.h"
 #include "Page.h"
 #include "PlatformMouseEvent.h"
 #include "PlatformScreen.h"
@@ -654,7 +655,7 @@ void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc)
         if (itemStyle.isVisible()) {
             int textX = max(0, client()->clientPaddingLeft() - client()->clientInsetLeft());
             if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR)
-                textX += itemStyle.textIndent().calcMinValue(itemRect.width());
+                textX += miminumValueForLength(itemStyle.textIndent(), itemRect.width());
             int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2;
             context.drawBidiText(itemFont, textRun, IntPoint(textX, textY));
         }
index 2fa064f40e60183c30c37193ce04429028ead0d6..7076cdf2abc661f8e8565595da24005e371c18dd 100644 (file)
@@ -551,7 +551,7 @@ void AutoTableLayout::layout()
         for (size_t i = 0; i < nEffCols; ++i) {
             Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
             if (logicalWidth.isPercent()) {
-                int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, logicalWidth.calcMinValue(tableLogicalWidth));
+                int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, miminumValueForLength(logicalWidth, tableLogicalWidth));
                 available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth;
                 m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
             }
index af5ecaf2736a2273cdb3039bae02ad3ed7dc0223..4a94d5dc5c915262adfd0cc70baed82fa72d4f96 100644 (file)
@@ -237,7 +237,7 @@ void FilterEffectRenderer::build(Document* document, const FilterOperations& ope
         }
         case FilterOperation::BLUR: {
             BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
-            float stdDeviation = blurOperation->stdDeviation().calcFloatValue(0);
+            float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0);
             effect = FEGaussianBlur::create(this, stdDeviation, stdDeviation);
             break;
         }
index aaff0de9d8f1fff33cef87e4878c77ec1086ef64..6c4fcb6663f0a34d3ade65cc5d7d5eaa9494d1c4 100644 (file)
@@ -244,7 +244,7 @@ void FixedTableLayout::layout()
             calcWidth[i] = m_width[i].value();
             totalFixedWidth += calcWidth[i];
         } else if (m_width[i].isPercent()) {
-            calcWidth[i] = m_width[i].calcValue(tableLogicalWidth);
+            calcWidth[i] = valueForLength(m_width[i], tableLogicalWidth);
             totalPercentWidth += calcWidth[i];
             totalPercent += m_width[i].percent();
         } else if (m_width[i].isAuto()) {
index 9044cc848adbc65b51d7fc9765892ee4f77cd7d6..d145691105d6e5c1c817bf34ecec70b2c213efac 100755 (executable)
@@ -3901,7 +3901,7 @@ LayoutUnit RenderBlock::textIndentOffset() const
     LayoutUnit cw = 0;
     if (style()->textIndent().isPercent())
         cw = containingBlock()->availableLogicalWidth();
-    return style()->textIndent().calcMinValue(cw);
+    return miminumValueForLength(style()->textIndent(), cw);
 }
 
 LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
@@ -5541,7 +5541,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths()
                 LayoutUnit ti = 0;
                 if (!addedTextIndent) {
                     addedTextIndent = true;
-                    ti = styleToUse->textIndent().calcMinValue(cw);
+                    ti = miminumValueForLength(styleToUse->textIndent(), cw);
                     childMin += ti;
                     childMax += ti;
                 }
@@ -5612,7 +5612,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths()
                 LayoutUnit ti = 0;
                 if (!addedTextIndent) {
                     addedTextIndent = true;
-                    ti = styleToUse->textIndent().calcMinValue(cw);
+                    ti = miminumValueForLength(styleToUse->textIndent(), cw);
                     childMin+=ti; beginMin += ti;
                     childMax+=ti; beginMax += ti;
                 }
index a6335c0e05ced65f6bef59081b3c826b3dbc9a07..ab2a449d21941f8d4201e588fd8837192ee8f409 100644 (file)
@@ -623,8 +623,8 @@ int RenderBox::reflectionOffset() const
     if (!style()->boxReflect())
         return 0;
     if (style()->boxReflect()->direction() == ReflectionLeft || style()->boxReflect()->direction() == ReflectionRight)
-        return style()->boxReflect()->offset().calcValue(borderBoxRect().width());
-    return style()->boxReflect()->offset().calcValue(borderBoxRect().height());
+        return valueForLength(style()->boxReflect()->offset(), borderBoxRect().width());
+    return valueForLength(style()->boxReflect()->offset(), borderBoxRect().height());
 }
 
 LayoutRect RenderBox::reflectedRect(const LayoutRect& r) const
@@ -1294,7 +1294,7 @@ LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderRegion* region
     LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size());
 
     if (!style()->clipLeft().isAuto()) {
-        LayoutUnit c = style()->clipLeft().calcValue(borderBoxRect.width());
+        LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width());
         clipRect.move(c, 0);
         clipRect.contract(c, 0);
     }
@@ -1303,16 +1303,16 @@ LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderRegion* region
     // from the left and top edges. Therefore it's better to avoid constraining to smaller widths and heights.
 
     if (!style()->clipRight().isAuto())
-        clipRect.contract(width() - style()->clipRight().calcValue(width()), 0);
+        clipRect.contract(width() - valueForLength(style()->clipRight(), width()), 0);
 
     if (!style()->clipTop().isAuto()) {
-        LayoutUnit c = style()->clipTop().calcValue(borderBoxRect.height());
+        LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height());
         clipRect.move(0, c);
         clipRect.contract(0, c);
     }
 
     if (!style()->clipBottom().isAuto())
-        clipRect.contract(0, height() - style()->clipBottom().calcValue(height()));
+        clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height()));
 
     return clipRect;
 }
@@ -1779,10 +1779,10 @@ void RenderBox::computeLogicalWidthInRegion(RenderRegion* region, LayoutUnit off
     
     if (isInline() && !isInlineBlockOrInlineTable()) {
         // just calculate margins
-        setMarginStart(styleToUse->marginStart().calcMinValue(containerLogicalWidth));
-        setMarginEnd(styleToUse->marginEnd().calcMinValue(containerLogicalWidth));
+        setMarginStart(miminumValueForLength(styleToUse->marginStart(), containerLogicalWidth));
+        setMarginEnd(miminumValueForLength(styleToUse->marginEnd(), containerLogicalWidth));
         if (treatAsReplaced)
-            setLogicalWidth(max<LayoutUnit>(logicalWidthLength.calcFloatValue(0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
+            setLogicalWidth(max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
         return;
     }
 
@@ -1818,8 +1818,8 @@ void RenderBox::computeLogicalWidthInRegion(RenderRegion* region, LayoutUnit off
 
     // Margin calculations.
     if (logicalWidthLength.isAuto() || hasPerpendicularContainingBlock) {
-        setMarginStart(styleToUse->marginStart().calcMinValue(containerLogicalWidth));
-        setMarginEnd(styleToUse->marginEnd().calcMinValue(containerLogicalWidth));
+        setMarginStart(miminumValueForLength(styleToUse->marginStart(), containerLogicalWidth));
+        setMarginEnd(miminumValueForLength(styleToUse->marginEnd(), containerLogicalWidth));
     } else
         computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth());
 
@@ -1842,8 +1842,8 @@ LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(LogicalWidthType widthTyp
         logicalWidth = styleToUse->logicalMaxWidth();
 
     if (logicalWidth.isIntrinsicOrAuto()) {
-        LayoutUnit marginStart = styleToUse->marginStart().calcMinValue(availableLogicalWidth);
-        LayoutUnit marginEnd = styleToUse->marginEnd().calcMinValue(availableLogicalWidth);
+        LayoutUnit marginStart = miminumValueForLength(styleToUse->marginStart(), availableLogicalWidth);
+        LayoutUnit marginEnd = miminumValueForLength(styleToUse->marginEnd(), availableLogicalWidth);
         logicalWidthResult = availableLogicalWidth - marginStart - marginEnd;
 
         if (shrinkToAvoidFloats() && cb->containsFloats())
@@ -1854,7 +1854,7 @@ LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(LogicalWidthType widthTyp
             logicalWidthResult = min(logicalWidthResult, maxPreferredLogicalWidth());
         }
     } else // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead.
-        logicalWidthResult = computeBorderBoxLogicalWidth(logicalWidth.calcValue(availableLogicalWidth)); 
+        logicalWidthResult = computeBorderBoxLogicalWidth(valueForLength(logicalWidth, availableLogicalWidth)); 
 
     return logicalWidthResult;
 }
@@ -1925,8 +1925,8 @@ void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo
 
     if (isFloating() || isInline()) {
         // Inline blocks/tables and floats don't have their margins increased.
-        containingBlock->setMarginStartForChild(this, marginStartLength.calcMinValue(containerWidth));
-        containingBlock->setMarginEndForChild(this, marginEndLength.calcMinValue(containerWidth));
+        containingBlock->setMarginStartForChild(this, miminumValueForLength(marginStartLength, containerWidth));
+        containingBlock->setMarginEndForChild(this, miminumValueForLength(marginEndLength, containerWidth));
         return;
     }
 
@@ -1940,7 +1940,7 @@ void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo
     
     // Case Two: The object is being pushed to the start of the containing block's available logical width.
     if (marginEndLength.isAuto() && childWidth < containerWidth) {
-        containingBlock->setMarginStartForChild(this, marginStartLength.calcValue(containerWidth));
+        containingBlock->setMarginStartForChild(this, valueForLength(marginStartLength, containerWidth));
         containingBlock->setMarginEndForChild(this, containerWidth - childWidth - containingBlock->marginStartForChild(this));
         return;
     } 
@@ -1949,15 +1949,15 @@ void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo
     bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT)
         || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
     if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) {
-        containingBlock->setMarginEndForChild(this, marginEndLength.calcValue(containerWidth));
+        containingBlock->setMarginEndForChild(this, valueForLength(marginEndLength, containerWidth));
         containingBlock->setMarginStartForChild(this, containerWidth - childWidth - containingBlock->marginEndForChild(this));
         return;
     } 
     
     // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3).  In that case
     // auto margins will just turn into 0.
-    containingBlock->setMarginStartForChild(this, marginStartLength.calcMinValue(containerWidth));
-    containingBlock->setMarginEndForChild(this, marginEndLength.calcMinValue(containerWidth));
+    containingBlock->setMarginStartForChild(this, miminumValueForLength(marginStartLength, containerWidth));
+    containingBlock->setMarginEndForChild(this, miminumValueForLength(marginEndLength, containerWidth));
 }
 
 RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags cacheFlag) const
@@ -2245,7 +2245,7 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height)
         result = cb->computeContentBoxLogicalHeight(cb->availableLogicalHeight());
 
     if (result != -1) {
-        result = height.calcValue(result);
+        result = valueForLength(height, result);
         if (includeBorderPadding) {
             // It is necessary to use the border-box to match WinIE's broken
             // box model.  This is essential for sizing inside
@@ -2280,7 +2280,7 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) cons
             // https://bugs.webkit.org/show_bug.cgi?id=46496
             const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
             if (cw > 0)
-                return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw));
+                return computeContentBoxLogicalWidth(miminumValueForLength(logicalWidth, cw));
         }
         // fall through
         default:
@@ -2322,7 +2322,7 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co
                 block->computeLogicalHeight();
                 LayoutUnit newHeight = block->computeContentBoxLogicalHeight(block->contentHeight());
                 block->setHeight(oldHeight);
-                return computeContentBoxLogicalHeight(logicalHeight.calcValue(newHeight));
+                return computeContentBoxLogicalHeight(valueForLength(logicalHeight, newHeight));
             }
             
             // FIXME: availableLogicalHeight() is wrong if the replaced element's block-flow is perpendicular to the
@@ -2343,13 +2343,13 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co
                         // Don't let table cells squeeze percent-height replaced elements
                         // <http://bugs.webkit.org/show_bug.cgi?id=15359>
                         availableHeight = max(availableHeight, intrinsicLogicalHeight());
-                        return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
+                        return valueForLength(logicalHeight, availableHeight - borderAndPaddingLogicalHeight());
                     }
                     cb = cb->containingBlock();
                     toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderBox*>(this));
                 }
             }
-            return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));
+            return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight));
         }
         default:
             return intrinsicLogicalHeight();
@@ -2384,7 +2384,7 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h) const
             availableHeight = containingBlockLogicalHeightForPositioned(containingBlock());
         else
             availableHeight = containingBlock()->availableLogicalHeight();
-        return computeContentBoxLogicalHeight(h.calcValue(availableHeight));
+        return computeContentBoxLogicalHeight(valueForLength(h, availableHeight));
     }
 
     // FIXME: We can't just check top/bottom here.
@@ -2416,8 +2416,8 @@ void RenderBox::computeBlockDirectionMargins(RenderBlock* containingBlock)
     LayoutUnit cw = containingBlockLogicalWidthForContent();
 
     RenderStyle* containingBlockStyle = containingBlock->style();
-    containingBlock->setMarginBeforeForChild(this, style()->marginBeforeUsing(containingBlockStyle).calcMinValue(cw));
-    containingBlock->setMarginAfterForChild(this, style()->marginAfterUsing(containingBlockStyle).calcMinValue(cw));
+    containingBlock->setMarginBeforeForChild(this, miminumValueForLength(style()->marginBeforeUsing(containingBlockStyle), cw));
+    containingBlock->setMarginAfterForChild(this, miminumValueForLength(style()->marginAfterUsing(containingBlockStyle), cw));
 }
 
 LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, RenderRegion* region,
@@ -2757,10 +2757,10 @@ void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
         // NOTE:  It is not necessary to solve for 'right' in the over constrained
         // case because the value is not used for any further calculations.
 
-        logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
-        logicalWidthValue = computeContentBoxLogicalWidth(logicalWidth.calcValue(containerLogicalWidth));
+        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
+        logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
 
-        const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + logicalRight.calcValue(containerLogicalWidth) + bordersPlusPadding);
+        const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth) + bordersPlusPadding);
 
         // Margins are now the only unknown
         if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
@@ -2781,16 +2781,16 @@ void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
             }
         } else if (marginLogicalLeft.isAuto()) {
             // Solve for left margin
-            marginLogicalRightValue = marginLogicalRight.calcValue(containerLogicalWidth);
+            marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth);
             marginLogicalLeftValue = availableSpace - marginLogicalRightValue;
         } else if (marginLogicalRight.isAuto()) {
             // Solve for right margin
-            marginLogicalLeftValue = marginLogicalLeft.calcValue(containerLogicalWidth);
+            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth);
             marginLogicalRightValue = availableSpace - marginLogicalLeftValue;
         } else {
             // Over-constrained, solve for left if direction is RTL
-            marginLogicalLeftValue = marginLogicalLeft.calcValue(containerLogicalWidth);
-            marginLogicalRightValue = marginLogicalRight.calcValue(containerLogicalWidth);
+            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth);
+            marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth);
 
             // Use the containing block's direction rather than the parent block's
             // per CSS 2.1 reference test abspos-non-replaced-width-margin-000.
@@ -2840,8 +2840,8 @@ void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
         // because the value is not used for any further calculations.
 
         // Calculate margins, 'auto' margins are ignored.
-        marginLogicalLeftValue = marginLogicalLeft.calcMinValue(containerLogicalWidth);
-        marginLogicalRightValue = marginLogicalRight.calcMinValue(containerLogicalWidth);
+        marginLogicalLeftValue = miminumValueForLength(marginLogicalLeft, containerLogicalWidth);
+        marginLogicalRightValue = miminumValueForLength(marginLogicalRight, containerLogicalWidth);
 
         const LayoutUnit availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding);
 
@@ -2849,7 +2849,7 @@ void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
         // Use rule/case that applies.
         if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
             // RULE 1: (use shrink-to-fit for width, and solve of left)
-            LayoutUnit logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
+            LayoutUnit logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
 
             // FIXME: would it be better to have shrink-to-fit in one step?
             LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
@@ -2859,7 +2859,7 @@ void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
             logicalLeftValue = availableSpace - (logicalWidthValue + logicalRightValue);
         } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAuto) {
             // RULE 3: (use shrink-to-fit for width, and no need solve of right)
-            logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
+            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
 
             // FIXME: would it be better to have shrink-to-fit in one step?
             LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
@@ -2868,16 +2868,16 @@ void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
             logicalWidthValue = min(max(preferredMinWidth, availableWidth), preferredWidth);
         } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) {
             // RULE 4: (solve for left)
-            logicalWidthValue = computeContentBoxLogicalWidth(logicalWidth.calcValue(containerLogicalWidth));
-            logicalLeftValue = availableSpace - (logicalWidthValue + logicalRight.calcValue(containerLogicalWidth));
+            logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
+            logicalLeftValue = availableSpace - (logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth));
         } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
             // RULE 5: (solve for width)
-            logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
-            logicalWidthValue = availableSpace - (logicalLeftValue + logicalRight.calcValue(containerLogicalWidth));
+            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
+            logicalWidthValue = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth));
         } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAuto) {
             // RULE 6: (no need solve for right)
-            logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
-            logicalWidthValue = computeContentBoxLogicalWidth(logicalWidth.calcValue(containerLogicalWidth));
+            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
+            logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
         }
     }
 
@@ -3092,10 +3092,10 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength,
         // NOTE:  It is not necessary to solve for 'bottom' in the over constrained
         // case because the value is not used for any further calculations.
 
-        logicalHeightValue = computeContentBoxLogicalHeight(logicalHeightLength.calcValue(containerLogicalHeight));
-        logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
+        logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
+        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
 
-        const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight) + bordersPlusPadding);
+        const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight) + bordersPlusPadding);
 
         // Margins are now the only unknown
         if (marginBefore.isAuto() && marginAfter.isAuto()) {
@@ -3105,16 +3105,16 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength,
             marginAfterValue = availableSpace - marginBeforeValue; // account for odd valued differences
         } else if (marginBefore.isAuto()) {
             // Solve for top margin
-            marginAfterValue = marginAfter.calcValue(containerLogicalHeight);
+            marginAfterValue = valueForLength(marginAfter, containerLogicalHeight);
             marginBeforeValue = availableSpace - marginAfterValue;
         } else if (marginAfter.isAuto()) {
             // Solve for bottom margin
-            marginBeforeValue = marginBefore.calcValue(containerLogicalHeight);
+            marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight);
             marginAfterValue = availableSpace - marginBeforeValue;
         } else {
             // Over-constrained, (no need solve for bottom)
-            marginBeforeValue = marginBefore.calcValue(containerLogicalHeight);
-            marginAfterValue = marginAfter.calcValue(containerLogicalHeight);
+            marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight);
+            marginAfterValue = valueForLength(marginAfter, containerLogicalHeight);
         }
     } else {
         /*--------------------------------------------------------------------*\
@@ -3143,8 +3143,8 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength,
         // because the value is not used for any further calculations.
 
         // Calculate margins, 'auto' margins are ignored.
-        marginBeforeValue = marginBefore.calcMinValue(containerLogicalHeight);
-        marginAfterValue = marginAfter.calcMinValue(containerLogicalHeight);
+        marginBeforeValue = miminumValueForLength(marginBefore, containerLogicalHeight);
+        marginAfterValue = miminumValueForLength(marginAfter, containerLogicalHeight);
 
         const LayoutUnit availableSpace = containerLogicalHeight - (marginBeforeValue + marginAfterValue + bordersPlusPadding);
 
@@ -3152,23 +3152,23 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength,
         if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) {
             // RULE 1: (height is content based, solve of top)
             logicalHeightValue = contentLogicalHeight;
-            logicalTopValue = availableSpace - (logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight));
+            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight));
         } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) {
             // RULE 3: (height is content based, no need solve of bottom)
-            logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
+            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
             logicalHeightValue = contentLogicalHeight;
         } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) {
             // RULE 4: (solve of top)
-            logicalHeightValue = computeContentBoxLogicalHeight(logicalHeightLength.calcValue(containerLogicalHeight));
-            logicalTopValue = availableSpace - (logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight));
+            logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
+            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight));
         } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) {
             // RULE 5: (solve of height)
-            logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
-            logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + logicalBottom.calcValue(containerLogicalHeight)));
+            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
+            logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight)));
         } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) {
             // RULE 6: (no need solve of bottom)
-            logicalHeightValue = computeContentBoxLogicalHeight(logicalHeightLength.calcValue(containerLogicalHeight));
-            logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
+            logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
+            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
         }
     }
 
@@ -3249,8 +3249,8 @@ void RenderBox::computePositionedLogicalWidthReplaced()
         // 'left' and 'right' cannot be 'auto' due to step 3
         ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto()));
 
-        logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
-        logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
+        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
+        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
 
         LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRightValue);
         if (difference > 0) {
@@ -3273,39 +3273,39 @@ void RenderBox::computePositionedLogicalWidthReplaced()
      *    that value.
     \*-----------------------------------------------------------------------*/
     } else if (logicalLeft.isAuto()) {
-        marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);
-        marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);
-        logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
+        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
+        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
+        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
 
         // Solve for 'left'
         logicalLeftValue = availableSpace - (logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias);
     } else if (logicalRight.isAuto()) {
-        marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);
-        marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);
-        logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
+        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
+        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
+        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
 
         // Solve for 'right'
         logicalRightValue = availableSpace - (logicalLeftValue + marginLogicalLeftAlias + marginLogicalRightAlias);
     } else if (marginLogicalLeft.isAuto()) {
-        marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);
-        logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
-        logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
+        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
+        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
+        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
 
         // Solve for 'margin-left'
         marginLogicalLeftAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalRightAlias);
     } else if (marginLogicalRight.isAuto()) {
-        marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);
-        logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
-        logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
+        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
+        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
+        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
 
         // Solve for 'margin-right'
         marginLogicalRightAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalLeftAlias);
     } else {
         // Nothing is 'auto', just calculate the values.
-        marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);
-        marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);
-        logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
-        logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
+        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
+        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
+        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
+        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
         // If the containing block is right-to-left, then push the left position as far to the right as possible
         if (containerDirection == RTL) {
             int totalLogicalWidth = logicalWidth() + logicalLeftValue + logicalRightValue +  marginLogicalLeftAlias + marginLogicalRightAlias;
@@ -3411,8 +3411,8 @@ void RenderBox::computePositionedLogicalHeightReplaced()
         // 'top' and 'bottom' cannot be 'auto' due to step 2 and 3 combined.
         ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto()));
 
-        logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
-        logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
+        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
+        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
 
         LayoutUnit difference = availableSpace - (logicalTopValue + logicalBottomValue);
         // NOTE: This may result in negative values.
@@ -3424,39 +3424,39 @@ void RenderBox::computePositionedLogicalHeightReplaced()
      *    for that value.
     \*-----------------------------------------------------------------------*/
     } else if (logicalTop.isAuto()) {
-        marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);
-        marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);
-        logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
+        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
+        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
+        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
 
         // Solve for 'top'
         logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAlias + marginAfterAlias);
     } else if (logicalBottom.isAuto()) {
-        marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);
-        marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);
-        logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
+        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
+        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
+        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
 
         // Solve for 'bottom'
         // NOTE: It is not necessary to solve for 'bottom' because we don't ever
         // use the value.
     } else if (marginBefore.isAuto()) {
-        marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);
-        logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
-        logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
+        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
+        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
+        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
 
         // Solve for 'margin-top'
         marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginAfterAlias);
     } else if (marginAfter.isAuto()) {
-        marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);
-        logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
-        logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
+        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
+        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
+        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
 
         // Solve for 'margin-bottom'
         marginAfterAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginBeforeAlias);
     } else {
         // Nothing is 'auto', just calculate the values.
-        marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);
-        marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);
-        logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
+        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
+        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
+        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
         // NOTE: It is not necessary to solve for 'bottom' because we don't ever
         // use the value.
      }
index 9acb8f1c4340890773969e356a31cfa33840a177..619069dce9c4b29e8d3055ee6a7a73e41b268cb1 100644 (file)
@@ -437,12 +437,12 @@ LayoutUnit RenderBoxModelObject::relativePositionOffsetX() const
     if (!style()->left().isAuto()) {
         RenderBlock* cb = containingBlock();
         if (!style()->right().isAuto() && !cb->style()->isLeftToRightDirection())
-            return -style()->right().calcValue(cb->availableWidth());
-        return offset + style()->left().calcValue(cb->availableWidth());
+            return -valueForLength(style()->right(), cb->availableWidth());
+        return offset + valueForLength(style()->left(), cb->availableWidth());
     }
     if (!style()->right().isAuto()) {
         RenderBlock* cb = containingBlock();
-        return offset + -style()->right().calcValue(cb->availableWidth());
+        return offset + -valueForLength(style()->right(), cb->availableWidth());
     }
     return offset;
 }
@@ -462,13 +462,13 @@ LayoutUnit RenderBoxModelObject::relativePositionOffsetY() const
         && (!containingBlock->style()->height().isAuto()
             || !style()->top().isPercent()
             || containingBlock->stretchesToViewport()))
-        return offset + style()->top().calcValue(containingBlock->availableHeight());
+        return offset + valueForLength(style()->top(), containingBlock->availableHeight());
 
     if (!style()->bottom().isAuto()
         && (!containingBlock->style()->height().isAuto()
             || !style()->bottom().isPercent()
             || containingBlock->stretchesToViewport()))
-        return offset + -style()->bottom().calcValue(containingBlock->availableHeight());
+        return offset + -valueForLength(style()->bottom(), containingBlock->availableHeight());
 
     return offset;
 }
@@ -556,7 +556,7 @@ LayoutUnit RenderBoxModelObject::paddingTop(PaddingOptions) const
     Length padding = style()->paddingTop();
     if (padding.isPercent())
         w = containingBlock()->availableLogicalWidth();
-    return padding.calcMinValue(w);
+    return miminumValueForLength(padding, w);
 }
 
 LayoutUnit RenderBoxModelObject::paddingBottom(PaddingOptions) const
@@ -565,7 +565,7 @@ LayoutUnit RenderBoxModelObject::paddingBottom(PaddingOptions) const
     Length padding = style()->paddingBottom();
     if (padding.isPercent())
         w = containingBlock()->availableLogicalWidth();
-    return padding.calcMinValue(w);
+    return miminumValueForLength(padding, w);
 }
 
 LayoutUnit RenderBoxModelObject::paddingLeft(PaddingOptions) const
@@ -574,7 +574,7 @@ LayoutUnit RenderBoxModelObject::paddingLeft(PaddingOptions) const
     Length padding = style()->paddingLeft();
     if (padding.isPercent())
         w = containingBlock()->availableLogicalWidth();
-    return padding.calcMinValue(w);
+    return miminumValueForLength(padding, w);
 }
 
 LayoutUnit RenderBoxModelObject::paddingRight(PaddingOptions) const
@@ -583,7 +583,7 @@ LayoutUnit RenderBoxModelObject::paddingRight(PaddingOptions) const
     Length padding = style()->paddingRight();
     if (padding.isPercent())
         w = containingBlock()->availableLogicalWidth();
-    return padding.calcMinValue(w);
+    return miminumValueForLength(padding, w);
 }
 
 LayoutUnit RenderBoxModelObject::paddingBefore(PaddingOptions) const
@@ -592,7 +592,7 @@ LayoutUnit RenderBoxModelObject::paddingBefore(PaddingOptions) const
     Length padding = style()->paddingBefore();
     if (padding.isPercent())
         w = containingBlock()->availableLogicalWidth();
-    return padding.calcMinValue(w);
+    return miminumValueForLength(padding, w);
 }
 
 LayoutUnit RenderBoxModelObject::paddingAfter(PaddingOptions) const
@@ -601,7 +601,7 @@ LayoutUnit RenderBoxModelObject::paddingAfter(PaddingOptions) const
     Length padding = style()->paddingAfter();
     if (padding.isPercent())
         w = containingBlock()->availableLogicalWidth();
-    return padding.calcMinValue(w);
+    return miminumValueForLength(padding, w);
 }
 
 LayoutUnit RenderBoxModelObject::paddingStart(PaddingOptions) const
@@ -610,7 +610,7 @@ LayoutUnit RenderBoxModelObject::paddingStart(PaddingOptions) const
     Length padding = style()->paddingStart();
     if (padding.isPercent())
         w = containingBlock()->availableLogicalWidth();
-    return padding.calcMinValue(w);
+    return miminumValueForLength(padding, w);
 }
 
 LayoutUnit RenderBoxModelObject::paddingEnd(PaddingOptions) const
@@ -619,7 +619,7 @@ LayoutUnit RenderBoxModelObject::paddingEnd(PaddingOptions) const
     Length padding = style()->paddingEnd();
     if (padding.isPercent())
         w = containingBlock()->availableLogicalWidth();
-    return padding.calcMinValue(w);
+    return miminumValueForLength(padding, w);
 }
 
 RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& borderRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
@@ -998,12 +998,12 @@ IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer,
             if (layerWidth.isFixed())
                 w = layerWidth.value();
             else if (layerWidth.isPercent())
-                w = layerWidth.calcValue(positioningAreaSize.width());
+                w = valueForLength(layerWidth, positioningAreaSize.width());
             
             if (layerHeight.isFixed())
                 h = layerHeight.value();
             else if (layerHeight.isPercent())
-                h = layerHeight.calcValue(positioningAreaSize.height());
+                h = valueForLength(layerHeight, positioningAreaSize.height());
             
             // If one of the values is auto we have to use the appropriate
             // scale to maintain our aspect ratio.
@@ -1139,13 +1139,13 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
     EFillRepeat backgroundRepeatX = fillLayer->repeatX();
     EFillRepeat backgroundRepeatY = fillLayer->repeatY();
 
-    LayoutUnit xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true);
+    LayoutUnit xPosition = miminumValueForLength(fillLayer->xPosition(), positioningAreaSize.width() - geometry.tileSize().width(), true);
     if (backgroundRepeatX == RepeatFill)
         geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - (xPosition + left) % geometry.tileSize().width() : 0);
     else
         geometry.setNoRepeatX(xPosition + left);
 
-    LayoutUnit yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true);
+    LayoutUnit yPosition = miminumValueForLength(fillLayer->yPosition(), positioningAreaSize.height() - geometry.tileSize().height(), true);
     if (backgroundRepeatY == RepeatFill)
         geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - (yPosition + top) % geometry.tileSize().height() : 0);
     else 
@@ -1164,7 +1164,7 @@ static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSi
         return borderSlice.value() * borderSide;
     if (borderSlice.isAuto())
         return imageSide;
-    return borderSlice.calcValue(boxExtent);
+    return valueForLength(borderSlice, boxExtent);
 }
 
 bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const LayoutRect& rect, const RenderStyle* style,
@@ -1202,10 +1202,10 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
     int imageWidth = imageSize.width() / style->effectiveZoom();
     int imageHeight = imageSize.height() / style->effectiveZoom();
 
-    int topSlice = min<int>(imageHeight, ninePieceImage.imageSlices().top().calcValue(imageHeight));
-    int rightSlice = min<int>(imageWidth, ninePieceImage.imageSlices().right().calcValue(imageWidth));
-    int bottomSlice = min<int>(imageHeight, ninePieceImage.imageSlices().bottom().calcValue(imageHeight));
-    int leftSlice = min<int>(imageWidth, ninePieceImage.imageSlices().left().calcValue(imageWidth));
+    int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight));
+    int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth));
+    int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight));
+    int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth));
 
     ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
     ENinePieceImageRule vRule = ninePieceImage.verticalRule();
index 78644d4fed30b225b599abaa2cc6c7d97b538bff..663f0496a6d6456e07b94536f5a721d5542d3556 100644 (file)
@@ -573,7 +573,7 @@ LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox*
         LayoutUnit mainAxisExtent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->maxPreferredLogicalWidth();
         return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child);
     }
-    return mainAxisLength.calcMinValue(mainAxisContentExtent());
+    return miminumValueForLength(mainAxisLength, mainAxisContentExtent());
 }
 
 LayoutUnit RenderFlexibleBox::computeAvailableFreeSpace(LayoutUnit preferredMainAxisExtent)
@@ -680,11 +680,11 @@ void RenderFlexibleBox::computeMainAxisPreferredSizes(bool relayoutChildren, Fle
         // of 0 and because if we're not auto sizing, we don't do a layout that
         // computes the start/end margins.
         if (isHorizontalFlow()) {
-            child->setMarginLeft(child->style()->marginLeft().calcMinValue(flexboxAvailableContentExtent));
-            child->setMarginRight(child->style()->marginRight().calcMinValue(flexboxAvailableContentExtent));
+            child->setMarginLeft(miminumValueForLength(child->style()->marginLeft(), flexboxAvailableContentExtent));
+            child->setMarginRight(miminumValueForLength(child->style()->marginRight(), flexboxAvailableContentExtent));
         } else {
-            child->setMarginTop(child->style()->marginTop().calcMinValue(flexboxAvailableContentExtent));
-            child->setMarginBottom(child->style()->marginBottom().calcMinValue(flexboxAvailableContentExtent));
+            child->setMarginTop(miminumValueForLength(child->style()->marginTop(), flexboxAvailableContentExtent));
+            child->setMarginBottom(miminumValueForLength(child->style()->marginBottom(), flexboxAvailableContentExtent));
         }
     }
 }
@@ -758,8 +758,8 @@ bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithm(const OrderedFlexItemLis
                 childPreferredSize += lroundf(availableFreeSpace * positiveFlexForChild(child) / totalPositiveFlexibility);
 
                 Length childLogicalMaxWidth = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight();
-                if (childLogicalMaxWidth.isSpecified() && childPreferredSize > childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent)) {
-                    childPreferredSize = childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent);
+                if (childLogicalMaxWidth.isSpecified() && childPreferredSize > valueForLength(childLogicalMaxWidth, flexboxAvailableContentExtent)) {
+                    childPreferredSize = valueForLength(childLogicalMaxWidth, flexboxAvailableContentExtent);
                     availableFreeSpace -= childPreferredSize - preferredMainAxisContentExtentForChild(child);
                     totalPositiveFlexibility -= positiveFlexForChild(child);
 
@@ -770,8 +770,8 @@ bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithm(const OrderedFlexItemLis
                 childPreferredSize += lroundf(availableFreeSpace * negativeFlexForChild(child) / totalNegativeFlexibility);
 
                 Length childLogicalMinWidth = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight();
-                if (childLogicalMinWidth.isSpecified() && childPreferredSize < childLogicalMinWidth.calcValue(flexboxAvailableContentExtent)) {
-                    childPreferredSize = childLogicalMinWidth.calcValue(flexboxAvailableContentExtent);
+                if (childLogicalMinWidth.isSpecified() && childPreferredSize < valueForLength(childLogicalMinWidth, flexboxAvailableContentExtent)) {
+                    childPreferredSize = valueForLength(childLogicalMinWidth, flexboxAvailableContentExtent);
                     availableFreeSpace += preferredMainAxisContentExtentForChild(child) - childPreferredSize;
                     totalNegativeFlexibility -= negativeFlexForChild(child);
 
index bcce93ef8211c6c140ae869a0f3a976ab45b9b9e..d3ba418d3c8cbd31b2d27355f219400e8e272a0e 100644 (file)
@@ -223,7 +223,7 @@ void RenderFrameSet::layOutAxis(GridAxis& axis, const Length* grid, int availabl
         // Count the total percentage of all of the percentage columns/rows -> totalPercent
         // Count the number of columns/rows which are percentages -> countPercent
         if (grid[i].isPercent()) {
-            gridLayout[i] = max(grid[i].calcValue(availableLen), 0);
+            gridLayout[i] = max(valueForLength(grid[i], availableLen), 0);
             totalPercent += gridLayout[i];
             countPercent++;
         }
index 6648abd080c460f230089d71d4efdfd12dc4ab90..b6c4ca8e6846d0a0d34fe335da7d7f5f17aa59ca 100644 (file)
@@ -701,7 +701,7 @@ static LayoutUnit computeMargin(const RenderInline* renderer, const Length& marg
     if (margin.isFixed())
         return margin.value();
     if (margin.isPercent())
-        return margin.calcMinValue(max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
+        return miminumValueForLength(margin, max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
     return 0;
 }
 
index 53c085d5216af07e6009b672d9f3386703f3d635..b567776899a526f8980abcfdff411157b83803d5 100644 (file)
@@ -820,8 +820,8 @@ TransformationMatrix RenderLayer::perspectiveTransform() const
     const float boxWidth = borderBox.width();
     const float boxHeight = borderBox.height();
 
-    float perspectiveOriginX = style->perspectiveOriginX().calcFloatValue(boxWidth);
-    float perspectiveOriginY = style->perspectiveOriginY().calcFloatValue(boxHeight);
+    float perspectiveOriginX = floatValueForLength(style->perspectiveOriginX(), boxWidth);
+    float perspectiveOriginY = floatValueForLength(style->perspectiveOriginY(), boxHeight);
 
     // A perspective origin of 0,0 makes the vanishing point in the center of the element.
     // We want it to be in the top-left, so subtract half the height and width.
@@ -844,8 +844,8 @@ FloatPoint RenderLayer::perspectiveOrigin() const
     const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect();
     RenderStyle* style = renderer()->style();
 
-    return FloatPoint(style->perspectiveOriginX().calcFloatValue(borderBox.width()),
-                      style->perspectiveOriginY().calcFloatValue(borderBox.height()));
+    return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox.width()),
+                      floatValueForLength(style->perspectiveOriginY(), borderBox.height()));
 }
 
 RenderLayer* RenderLayer::stackingContext() const
index f35b3965da7efedfb2a19b744d91c1d9f0a7e7f9..44a096717353b3a55dd42c41bbfc8ddc70b3e362 100644 (file)
@@ -1005,8 +1005,8 @@ FloatPoint3D RenderLayerBacking::computeTransformOrigin(const IntRect& borderBox
     RenderStyle* style = renderer()->style();
 
     FloatPoint3D origin;
-    origin.setX(style->transformOriginX().calcFloatValue(borderBox.width()));
-    origin.setY(style->transformOriginY().calcFloatValue(borderBox.height()));
+    origin.setX(floatValueForLength(style->transformOriginX(), borderBox.width()));
+    origin.setY(floatValueForLength(style->transformOriginY(), borderBox.height()));
     origin.setZ(style->transformOriginZ());
 
     return origin;
@@ -1020,8 +1020,8 @@ FloatPoint RenderLayerBacking::computePerspectiveOrigin(const IntRect& borderBox
     float boxHeight = borderBox.height();
 
     FloatPoint origin;
-    origin.setX(style->perspectiveOriginX().calcFloatValue(boxWidth));
-    origin.setY(style->perspectiveOriginY().calcFloatValue(boxHeight));
+    origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth));
+    origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight));
 
     return origin;
 }
index fe5dbaa2216b1ca0551e82482d077bbd37aaab45..4d4dee859858385656b5fc9874891f84a8a80cd2 100644 (file)
@@ -289,7 +289,7 @@ void RenderMarquee::timerFired(Timer<RenderMarquee>*)
         }
         bool positive = range > 0;
         int clientSize = (isHorizontal() ? m_layer->renderBox()->clientWidth() : m_layer->renderBox()->clientHeight());
-        int increment = abs(m_layer->renderer()->style()->marqueeIncrement().calcValue(clientSize));
+        int increment = abs(valueForLength(m_layer->renderer()->style()->marqueeIncrement(), clientSize));
         int currentPos = (isHorizontal() ? m_layer->scrollXOffset() : m_layer->scrollYOffset());
         newPos =  currentPos + (addIncrement ? increment : -increment);
         if (positive)
index a47aebbae4401ce4bc57632e0d4fee4918f6f8f5..70659382d4ca2bbcdd35d969a7ffb3ab9bcf7bdc 100644 (file)
@@ -161,7 +161,7 @@ void RenderMenuList::updateOptionsWidth()
             // Add in the option's text indent.  We can't calculate percentage values for now.
             float optionWidth = 0;
             if (RenderStyle* optionStyle = element->renderStyle())
-                optionWidth += optionStyle->textIndent().calcMinValue(0);
+                optionWidth += miminumValueForLength(optionStyle->textIndent(), 0);
             if (!text.isEmpty())
                 optionWidth += style()->font().width(text);
             maxOptionWidth = max(maxOptionWidth, optionWidth);
index db3311284924ac2627c687bb4e5f9a63ea730f73..56b95be07418f5f53c37edccfab6c4145b779ec0 100755 (executable)
@@ -1445,7 +1445,7 @@ bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta
 
         int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
         LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : zeroLayoutUnit;
-        LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderRight, max<LayoutUnit>(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max<LayoutUnit>(ow, shadowRight);
+        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);
         LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
             newOutlineBox.y(),
             width + borderWidth,
@@ -1464,7 +1464,7 @@ bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta
 
         int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
         LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : zeroLayoutUnit;
-        LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderBottom, max<LayoutUnit>(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max<LayoutUnit>(ow, shadowBottom);
+        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);
         LayoutRect bottomRect(newOutlineBox.x(),
             min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight,
             max(newOutlineBox.width(), oldOutlineBox.width()),
index 39bacfa7f4564f3c37e4efe74eb791e07401f9c8..bfb7b6a99ef6aa6c4b9d358404d5b3410355b1d8 100644 (file)
@@ -335,8 +335,8 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) con
                     logicalWidth = containingBlock()->availableLogicalWidth();
 
                 // This solves above equation for 'width' (== logicalWidth).
-                LayoutUnit marginStart = style()->marginStart().calcMinValue(logicalWidth);
-                LayoutUnit marginEnd = style()->marginEnd().calcMinValue(logicalWidth);
+                LayoutUnit marginStart = miminumValueForLength(style()->marginStart(), logicalWidth);
+                LayoutUnit marginEnd = miminumValueForLength(style()->marginEnd(), logicalWidth);
                 logicalWidth = max(0, logicalWidth - (marginStart + marginEnd + (width() - clientWidth())));
                 if (isPercentageIntrinsicSize)
                     // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
index cbae68c02a02b2b88df93b7a101cbdf9912cadec..72d329c90c71e07ce0dcf2e46693d8e6ce2fdb4f 100644 (file)
@@ -83,7 +83,7 @@ static int calcScrollbarThicknessUsing(const Length& l, int containingLength)
 {
     if (l.isIntrinsicOrAuto())
         return ScrollbarTheme::theme()->scrollbarThickness();
-    return l.calcMinValue(containingLength);
+    return miminumValueForLength(l, containingLength);
 }
 
 void RenderScrollbarPart::computeScrollbarWidth()
@@ -97,8 +97,8 @@ void RenderScrollbarPart::computeScrollbarWidth()
     setWidth(max(minWidth, min(maxWidth, w)));
     
     // Buttons and track pieces can all have margins along the axis of the scrollbar. 
-    m_marginLeft = style()->marginLeft().calcMinValue(visibleSize);
-    m_marginRight = style()->marginRight().calcMinValue(visibleSize);
+    m_marginLeft = miminumValueForLength(style()->marginLeft(), visibleSize);
+    m_marginRight = miminumValueForLength(style()->marginRight(), visibleSize);
 }
 
 void RenderScrollbarPart::computeScrollbarHeight()
@@ -112,8 +112,8 @@ void RenderScrollbarPart::computeScrollbarHeight()
     setHeight(max(minHeight, min(maxHeight, h)));
 
     // Buttons and track pieces can all have margins along the axis of the scrollbar. 
-    m_marginTop = style()->marginTop().calcMinValue(visibleSize);
-    m_marginBottom = style()->marginBottom().calcMinValue(visibleSize);
+    m_marginTop = miminumValueForLength(style()->marginTop(), visibleSize);
+    m_marginBottom = miminumValueForLength(style()->marginBottom(), visibleSize);
 }
 
 void RenderScrollbarPart::computePreferredLogicalWidths()
index 2c8cae1dd36e5d0a48c506588d73bd06d36a343a..a5305fa288c01d853476ae46650749ec91579544 100644 (file)
@@ -232,8 +232,8 @@ void RenderTable::computeLogicalWidth()
         setLogicalWidth(convertStyleLogicalWidthToComputedWidth(styleLogicalWidth, containerWidthInInlineDirection));
     else {
         // Subtract out any fixed margins from our available width for auto width tables.
-        LayoutUnit marginStart = style()->marginStart().calcMinValue(availableLogicalWidth);
-        LayoutUnit marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth);
+        LayoutUnit marginStart = miminumValueForLength(style()->marginStart(), availableLogicalWidth);
+        LayoutUnit marginEnd = miminumValueForLength(style()->marginEnd(), availableLogicalWidth);
         LayoutUnit marginTotal = marginStart + marginEnd;
         
         // Subtract out our margins to get the available content width.
@@ -261,8 +261,8 @@ void RenderTable::computeLogicalWidth()
     if (!hasPerpendicularContainingBlock)
         computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth());
     else {
-        setMarginStart(style()->marginStart().calcMinValue(availableLogicalWidth));
-        setMarginEnd(style()->marginEnd().calcMinValue(availableLogicalWidth));
+        setMarginStart(miminumValueForLength(style()->marginStart(), availableLogicalWidth));
+        setMarginEnd(miminumValueForLength(style()->marginEnd(), availableLogicalWidth));
     }
 }
 
@@ -276,7 +276,7 @@ LayoutUnit RenderTable::convertStyleLogicalWidthToComputedWidth(const Length& st
         recalcBordersInRowDirection();
         borders = borderStart() + borderEnd() + (collapseBorders() ? 0 : paddingStart() + paddingEnd());
     }
-    return styleLogicalWidth.calcMinValue(availableWidth) + borders;
+    return miminumValueForLength(styleLogicalWidth, availableWidth) + borders;
 }
 
 void RenderTable::layoutCaption(RenderTableCaption* caption)
index 4243848d9867f6255e2ca378ccccfb5e7cb9627b..b8d344aab40e2f3ab6e196597ece5f5adc874519 100644 (file)
@@ -95,7 +95,7 @@ LayoutUnit RenderTableCell::logicalHeightForRowSizing() const
 {
     LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
 
-    LayoutUnit styleLogicalHeight = style()->logicalHeight().calcValue(0);
+    LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0);
     if (document()->inQuirksMode() || style()->boxSizing() == BORDER_BOX) {
         // Explicit heights use the border box in quirks mode.
         // Don't adjust height.
index 08a8c9b7dfcab85474eb8d2c6ea214f9e2b111cb..8d7dc652f576b3485f93d00fd3c9433fb31eddd5 100644 (file)
@@ -338,7 +338,7 @@ int RenderTableSection::calcRowLogicalHeight()
         LayoutUnit baselineDescent = 0;
 
         // Our base size is the biggest logical height from our cells' styles (excluding row spanning cells).
-        m_rowPos[r + 1] = max(m_rowPos[r] + m_grid[r].logicalHeight.calcMinValue(0), 0);
+        m_rowPos[r + 1] = max(m_rowPos[r] + miminumValueForLength(m_grid[r].logicalHeight, 0), 0);
 
         Row& row = m_grid[r].row;
         unsigned totalCols = row.size();
index e2c6a8a69c9bddc954617a85650bdd5af907346b..e9f3cc410152b3354c1ca8d6df9087d915324975 100644 (file)
@@ -97,8 +97,8 @@ public:
     virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
     virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
 
-    virtual LayoutUnit marginLeft() const { return style()->marginLeft().calcMinValue(0); }
-    virtual LayoutUnit marginRight() const { return style()->marginRight().calcMinValue(0); }
+    virtual LayoutUnit marginLeft() const { return miminumValueForLength(style()->marginLeft(), 0); }
+    virtual LayoutUnit marginRight() const { return miminumValueForLength(style()->marginRight(), 0); }
 
     virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
 
index c5656006504ed4112dddb20a85d3154db8c31568..705fb04b3df98441235a3bed99bbe9b56a4e71e8 100644 (file)
@@ -844,7 +844,7 @@ LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio
         } else if (verticalAlign == BASELINE_MIDDLE)
             verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection);
         else if (verticalAlign == LENGTH)
-            verticalPosition -= renderer->style()->verticalAlignLength().calcValue(renderer->lineHeight(firstLine, lineDirection));
+            verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), renderer->lineHeight(firstLine, lineDirection));
     }
 
     // Store the cached value.
index d86b51695601b6b526673cf9933304e9817128e9..114d636ae7a45e57117b3b6102e1414d2be11d0d 100644 (file)
@@ -802,14 +802,14 @@ void RenderStyle::applyTransform(TransformationMatrix& transform, const LayoutSi
     bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
 
     if (applyTransformOrigin)
-        transform.translate3d(transformOriginX().calcFloatValue(borderBoxSize.width()), transformOriginY().calcFloatValue(borderBoxSize.height()), transformOriginZ());
+        transform.translate3d(floatValueForLength(transformOriginX(), borderBoxSize.width()), floatValueForLength(transformOriginY(), borderBoxSize.height()), transformOriginZ());
 
     unsigned size = transformOperations.size();
     for (unsigned i = 0; i < size; ++i)
         transformOperations[i]->apply(transform, borderBoxSize);
 
     if (applyTransformOrigin)
-        transform.translate3d(-transformOriginX().calcFloatValue(borderBoxSize.width()), -transformOriginY().calcFloatValue(borderBoxSize.height()), -transformOriginZ()); 
+        transform.translate3d(-floatValueForLength(transformOriginX(), borderBoxSize.width()), -floatValueForLength(transformOriginY(), borderBoxSize.height()), -transformOriginZ()); 
 }
 
 void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRect& boundingBox, ApplyTransformOrigin applyOrigin) const
@@ -821,8 +821,8 @@ void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRec
     float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0;
     
     if (applyTransformOrigin) {
-        transform.translate3d(transformOriginX().calcFloatValue(boundingBox.width()) + offsetX,
-                              transformOriginY().calcFloatValue(boundingBox.height()) + offsetY,
+        transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
+                              floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY,
                               transformOriginZ());
     }
     
@@ -831,8 +831,8 @@ void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRec
         transformOperations[i]->apply(transform, boundingBox.size());
     
     if (applyTransformOrigin) {
-        transform.translate3d(-transformOriginX().calcFloatValue(boundingBox.width()) - offsetX,
-                              -transformOriginY().calcFloatValue(boundingBox.height()) - offsetY,
+        transform.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX,
+                              -floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY,
                               -transformOriginZ());
     }
 }
@@ -877,14 +877,14 @@ void RenderStyle::setBoxShadow(PassOwnPtr<ShadowData> shadowData, bool add)
 static RoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize size)
 {
     return RoundedRect::Radii(
-        IntSize(border.topLeft().width().calcValue(size.width()), 
-                border.topLeft().height().calcValue(size.height())),
-        IntSize(border.topRight().width().calcValue(size.width()),
-                border.topRight().height().calcValue(size.height())),
-        IntSize(border.bottomLeft().width().calcValue(size.width()), 
-                border.bottomLeft().height().calcValue(size.height())),
-        IntSize(border.bottomRight().width().calcValue(size.width()), 
-                border.bottomRight().height().calcValue(size.height())));
+        IntSize(valueForLength(border.topLeft().width(), size.width()), 
+                valueForLength(border.topLeft().height(), size.height())),
+        IntSize(valueForLength(border.topRight().width(), size.width()),
+                valueForLength(border.topRight().height(), size.height())),
+        IntSize(valueForLength(border.bottomLeft().width(), size.width()), 
+                valueForLength(border.bottomLeft().height(), size.height())),
+        IntSize(valueForLength(border.bottomRight().width(), size.width()), 
+                valueForLength(border.bottomRight().height(), size.height())));
 }
 
 static float calcConstraintScaleFor(const IntRect& rect, const RoundedRect::Radii& radii)
index dd899e5c190944f3c0c3f40cb8ec6371c5ccac53..335d4d7b411a1407cbbb111842a735d7552f5287 100644 (file)
@@ -39,6 +39,7 @@
 #include "GraphicsTypes.h"
 #include "Length.h"
 #include "LengthBox.h"
+#include "LengthFunctions.h"
 #include "LengthSize.h"
 #include "LineClampValue.h"
 #include "NinePieceImage.h"
@@ -630,7 +631,7 @@ public:
             return fontMetrics().lineSpacing();
 
         if (lh.isPercent())
-            return lh.calcMinValue(fontSize());
+            return miminumValueForLength(lh, fontSize());
 
         return lh.value();
     }
index b99701d81807c367c607ab42b1e32db1797daefc..971df423b72c54a2a0059ae050e5e0f61f528f8a 100644 (file)
@@ -87,9 +87,9 @@ void RenderSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, d
     //   resolving both values to user units.
     if (intrinsicWidthAttribute.isFixed() || intrinsicHeightAttribute.isFixed()) {
         if (intrinsicWidthAttribute.isFixed())
-            intrinsicSize.setWidth(intrinsicWidthAttribute.calcFloatValue(0));
+            intrinsicSize.setWidth(floatValueForLength(intrinsicWidthAttribute, 0));
         if (intrinsicHeightAttribute.isFixed())
-            intrinsicSize.setHeight(intrinsicHeightAttribute.calcFloatValue(0));
+            intrinsicSize.setHeight(floatValueForLength(intrinsicHeightAttribute, 0));
         if (!intrinsicSize.isEmpty())
             intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height());
         return;
@@ -153,7 +153,7 @@ bool RenderSVGRoot::isEmbeddedThroughFrameContainingSVGDocument() const
 
 static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize)
 {
-    return static_cast<LayoutUnit>(length.calcValue(maxSize) * (length.isFixed() ? scale : 1));
+    return static_cast<LayoutUnit>(valueForLength(length, maxSize) * (length.isFixed() ? scale : 1));
 }
 
 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const
index d381603ae1b32e530441b795dd46192180069250..98826224702ec1f97d2f43786889e10c8a711910 100644 (file)
@@ -541,7 +541,7 @@ FloatRect SVGSVGElement::currentViewBoxRect() const
 
     // If no viewBox is specified but non-relative width/height values, then we
     // should always synthesize a viewBox if we're embedded through a SVGImage.    
-    return FloatRect(FloatPoint(), FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0)));
+    return FloatRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)));
 }
 
 FloatSize SVGSVGElement::currentViewportSize() const
@@ -549,7 +549,7 @@ FloatSize SVGSVGElement::currentViewportSize() const
     Length intrinsicWidth = this->intrinsicWidth();
     Length intrinsicHeight = this->intrinsicHeight();
     if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
-        return FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0));
+        return FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
 
     if (!renderer())
         return FloatSize();
index 585780feaad89b6cf9c2137e8b0f9ad3ef51efe9..6b75f27491ed730f4d3e5c7bb2150104b0f23ac0 100644 (file)
@@ -293,7 +293,7 @@ void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrin
 
     intrinsicRatio = rootElement->viewBox().size();
     if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
-        intrinsicRatio = FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0));
+        intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
 }
 
 NativeImagePtr SVGImage::nativeImageForCurrentFrame()
index 8bd1587ded4e47e1801ed35196fe02916791811b..4b4f052e5a85928a830e016647c58126dfeb929a 100644 (file)
@@ -1,3 +1,16 @@
+2012-03-17  Joe Thomas  <joethomas@motorola.com>
+
+        move calc*Value functions out from Length (and platform)
+        https://bugs.webkit.org/show_bug.cgi?id=80897
+
+        Moving the Length calc*Value functions out from Length structure and also from /WebCore/platform/ folder.
+        This helps to avoid the layering violation while length calculation. Otherwise layer violation can be avoided only by adding a virtual interface(bug 27160).
+
+        Reviewed by Antti Koivisto.
+
+        * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
+        (WebKit::WebPopupMenu::setUpPlatformData):
+
 2012-03-17  Dan Bernstein  <mitz@apple.com>
 
         <rdar://problem/10263562> Crash in WebCore::Range::startPosition() when dismissing the Press and Hold panel by clicking in the menu bar
index 7427f118abf4e29fe541a5cb0d57214d7875331f..595a9c45fdec189cace4b320b518aa9396b9b872 100644 (file)
@@ -29,6 +29,7 @@
 #include "PlatformPopupMenuData.h"
 #include <WebCore/Font.h>
 #include <WebCore/GraphicsContext.h>
+#include <WebCore/LengthFunctions.h>
 #include <WebCore/TextRun.h>
 #include <WebCore/PopupMenuClient.h>
 #include <WebCore/PopupMenuStyle.h>
@@ -135,7 +136,7 @@ void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, Pl
         if (itemStyle.isVisible()) {
             int textX = std::max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft);
             if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR)
-                textX += itemStyle.textIndent().calcMinValue(itemRect.width());
+                textX += miminumValueForLength(itemStyle.textIndent(), itemRect.width());
             int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2;
 
             notSelectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY));