Changeset 111126 in webkit


Ignore:
Timestamp:
Mar 17, 2012 12:54:09 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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).

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):

Location:
trunk/Source
Files:
1 added
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r111120 r111126  
     12012-03-17  Joe Thomas  <joethomas@motorola.com>
     2
     3        move calc*Value functions out from Length (and platform)
     4        https://bugs.webkit.org/show_bug.cgi?id=80897
     5
     6        Moving the Length calc*Value functions out from Length structure and also from /WebCore/platform/ folder.
     7        This helps to avoid the layering violation while length calculation. Otherwise layer violation can be avoided only by adding a virtual interface(bug 27160).
     8
     9        Reviewed by Antti Koivisto.
     10
     11        * GNUmakefile.list.am: Build system changes for adding new files.
     12        * Target.pri: Ditto.
     13        * WebCore.gypi: Ditto.
     14        * WebCore.vcproj/WebCore.vcproj: Ditto.
     15        * WebCore.xcodeproj/project.pbxproj: Ditto.
     16        * accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
     17        (getAttributeSetForAccessibilityObject):
     18        * css/CSSComputedStyleDeclaration.cpp:
     19        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     20        * css/LengthFunctions.h: Added. Moved calc*Value functions of Length.
     21        (WebCore):
     22        (WebCore::calculateMinimumValue):
     23        (WebCore::calculateValue):
     24        (WebCore::calculateFloatValue):
     25        * dom/Document.cpp:
     26        (WebCore::Document::pageSizeAndMarginsInPixels):
     27        * html/HTMLAreaElement.cpp:
     28        (WebCore::HTMLAreaElement::getRegion):
     29        * platform/CalculationValue.h:
     30        (WebCore::CalcExpressionLength::evaluate):
     31        * platform/Length.h: Removed the calc*Value functions from Length structure.
     32        (Length):
     33        (WebCore::Length::getFloatValue):
     34        (WebCore::Length::getIntValue):
     35        * platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
     36        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
     37        (PlatformCALayer::setFilters):
     38        * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
     39        (WebCore::CCRenderSurfaceFilters::apply):
     40        * platform/graphics/filters/FilterOperations.cpp:
     41        (WebCore::FilterOperations::getOutsets):
     42        * platform/graphics/transforms/PerspectiveTransformOperation.cpp:
     43        (WebCore::PerspectiveTransformOperation::blend):
     44        * platform/graphics/transforms/PerspectiveTransformOperation.h:
     45        (WebCore::PerspectiveTransformOperation::isIdentity):
     46        (WebCore::PerspectiveTransformOperation::apply):
     47        * platform/graphics/transforms/TranslateTransformOperation.h:
     48        (WebCore::TranslateTransformOperation::x):
     49        (WebCore::TranslateTransformOperation::y):
     50        (WebCore::TranslateTransformOperation::z):
     51        (WebCore::TranslateTransformOperation::isIdentity):
     52        * platform/win/PopupMenuWin.cpp:
     53        (WebCore::PopupMenuWin::paint):
     54        * rendering/AutoTableLayout.cpp:
     55        (WebCore::AutoTableLayout::layout):
     56        * rendering/FilterEffectRenderer.cpp:
     57        (WebCore::FilterEffectRenderer::build):
     58        * rendering/FixedTableLayout.cpp:
     59        (WebCore::FixedTableLayout::layout):
     60        * rendering/RenderBlock.cpp:
     61        (WebCore::RenderBlock::textIndentOffset):
     62        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
     63        * rendering/RenderBox.cpp:
     64        (WebCore::RenderBox::reflectionOffset):
     65        (WebCore::RenderBox::clipRect):
     66        (WebCore::RenderBox::computeLogicalWidthInRegion):
     67        (WebCore::RenderBox::computeLogicalWidthInRegionUsing):
     68        (WebCore::RenderBox::computeInlineDirectionMargins):
     69        (WebCore::RenderBox::computePercentageLogicalHeight):
     70        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
     71        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
     72        (WebCore::RenderBox::availableLogicalHeightUsing):
     73        (WebCore::RenderBox::computeBlockDirectionMargins):
     74        (WebCore::RenderBox::computePositionedLogicalWidthUsing):
     75        (WebCore::RenderBox::computePositionedLogicalHeightUsing):
     76        (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
     77        (WebCore::RenderBox::computePositionedLogicalHeightReplaced):
     78        * rendering/RenderBoxModelObject.cpp:
     79        (WebCore::RenderBoxModelObject::relativePositionOffsetX):
     80        (WebCore::RenderBoxModelObject::relativePositionOffsetY):
     81        (WebCore::RenderBoxModelObject::paddingTop):
     82        (WebCore::RenderBoxModelObject::paddingBottom):
     83        (WebCore::RenderBoxModelObject::paddingLeft):
     84        (WebCore::RenderBoxModelObject::paddingRight):
     85        (WebCore::RenderBoxModelObject::paddingBefore):
     86        (WebCore::RenderBoxModelObject::paddingAfter):
     87        (WebCore::RenderBoxModelObject::paddingStart):
     88        (WebCore::RenderBoxModelObject::paddingEnd):
     89        (WebCore::RenderBoxModelObject::calculateFillTileSize):
     90        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
     91        (WebCore::computeBorderImageSide):
     92        (WebCore::RenderBoxModelObject::paintNinePieceImage):
     93        * rendering/RenderFlexibleBox.cpp:
     94        (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
     95        (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
     96        (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithm):
     97        * rendering/RenderFrameSet.cpp:
     98        (WebCore::RenderFrameSet::layOutAxis):
     99        * rendering/RenderInline.cpp:
     100        (WebCore::computeMargin):
     101        * rendering/RenderLayer.cpp:
     102        (WebCore::RenderLayer::perspectiveTransform):
     103        (WebCore::RenderLayer::perspectiveOrigin):
     104        * rendering/RenderLayerBacking.cpp:
     105        (WebCore::RenderLayerBacking::computeTransformOrigin):
     106        (WebCore::RenderLayerBacking::computePerspectiveOrigin):
     107        * rendering/RenderMarquee.cpp:
     108        (WebCore::RenderMarquee::timerFired):
     109        * rendering/RenderMenuList.cpp:
     110        (WebCore::RenderMenuList::updateOptionsWidth):
     111        * rendering/RenderObject.cpp:
     112        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
     113        * rendering/RenderReplaced.cpp:
     114        (WebCore::RenderReplaced::computeReplacedLogicalWidth):
     115        * rendering/RenderScrollbarPart.cpp:
     116        (WebCore::calcScrollbarThicknessUsing):
     117        (WebCore::RenderScrollbarPart::computeScrollbarWidth):
     118        (WebCore::RenderScrollbarPart::computeScrollbarHeight):
     119        * rendering/RenderTable.cpp:
     120        (WebCore::RenderTable::computeLogicalWidth):
     121        (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
     122        * rendering/RenderTableCell.cpp:
     123        (WebCore::RenderTableCell::logicalHeightForRowSizing):
     124        * rendering/RenderTableSection.cpp:
     125        (WebCore::RenderTableSection::calcRowLogicalHeight):
     126        * rendering/RenderText.h:
     127        (WebCore::RenderText::marginLeft):
     128        (WebCore::RenderText::marginRight):
     129        * rendering/RootInlineBox.cpp:
     130        (WebCore::RootInlineBox::verticalPositionForBox):
     131        * rendering/style/RenderStyle.cpp:
     132        (WebCore::RenderStyle::applyTransform):
     133        (WebCore::calcRadiiFor):
     134        * rendering/style/RenderStyle.h:
     135        * rendering/svg/RenderSVGRoot.cpp:
     136        (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation):
     137        (WebCore::resolveLengthAttributeForSVG):
     138        * svg/SVGSVGElement.cpp:
     139        (WebCore::SVGSVGElement::currentViewBoxRect):
     140        (WebCore::SVGSVGElement::currentViewportSize):
     141        * svg/graphics/SVGImage.cpp:
     142        (WebCore::SVGImage::computeIntrinsicDimensions):
     143
    11442012-03-17  Nikolas Zimmermann  <nzimmermann@rim.com>
    2145
  • trunk/Source/WebCore/GNUmakefile.list.am

    r111075 r111126  
    16461646        Source/WebCore/css/FontValue.cpp \
    16471647        Source/WebCore/css/FontValue.h \
     1648        Source/WebCore/css/LengthFunctions.h \
    16481649        Source/WebCore/css/MediaFeatureNames.cpp \
    16491650        Source/WebCore/css/MediaFeatureNames.h \
  • trunk/Source/WebCore/Target.pri

    r111075 r111126  
    16101610    css/FontFeatureValue.h \
    16111611    css/FontValue.h \
     1612    css/LengthFunctions.h \
    16121613    css/MediaFeatureNames.h \
    16131614    css/MediaList.h \
  • trunk/Source/WebCore/WebCore.gypi

    r111112 r111126  
    9090            'css/CSSValueList.h',
    9191            'css/CSSWrapShapes.h',
     92            'css/LengthFunctions.h',
    9293            'css/Pair.h',
    9394            'css/WebKitCSSFilterValue.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r111075 r111126  
    3647536475                        </File>
    3647636476                        <File
     36477                                RelativePath="..\css\LengthFunctions.h"
     36478                                >
     36479                        </File>
     36480                        <File
    3647736481                                RelativePath="..\css\MediaAllInOne.cpp"
    3647836482                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r111107 r111126  
    59595959                E4D687770ED7AE3D006EA978 /* PurgeableBufferMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */; };
    59605960                E4D687790ED7AE4F006EA978 /* PurgeableBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */; };
     5961                E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
    59615962                ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */; settings = {ATTRIBUTES = (Private, ); }; };
    59625963                ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; };
     
    1307213073                E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PurgeableBufferMac.cpp; sourceTree = "<group>"; };
    1307313074                E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgeableBuffer.h; sourceTree = "<group>"; };
     13075                E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthFunctions.h; sourceTree = "<group>"; };
    1307413076                ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarker.h; sourceTree = "<group>"; };
    1307513077                ED501DC50B249F2900AE18D9 /* EditorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = EditorMac.mm; path = mac/EditorMac.mm; sourceTree = "<group>"; };
     
    2047220474                                CDBD93BA1333BD4B002570E3 /* fullscreenQuickTime.css */,
    2047320475                                93CA4C9909DF93FA00DF8677 /* html.css */,
     20476                                E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */,
    2047420477                                93CA4C9A09DF93FA00DF8677 /* make-css-file-arrays.pl */,
    2047520478                                93CA4C9B09DF93FA00DF8677 /* makeprop.pl */,
     
    2347423477                                BCE65BEB0EACDF16007E4533 /* Length.h in Headers */,
    2347523478                                BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */,
     23479                                E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */,
    2347623480                                BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */,
    2347723481                                8CADF2A9135C7B36009EF43F /* LevelDBComparator.h in Headers */,
  • trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp

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

    r110588 r111126  
    17751775                // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
    17761776                // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
    1777                 value = marginRight.calcMinValue(toRenderBox(renderer)->containingBlockLogicalWidthForContent());
     1777                value = miminumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent());
    17781778            else
    17791779                value = toRenderBox(renderer)->marginRight();
     
    21872187            if (renderer) {
    21882188                LayoutRect box = sizingBox(renderer);
    2189                 list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get(), cssValuePool));
    2190                 list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get(), cssValuePool));
     2189                list->append(zoomAdjustedPixelValue(miminumValueForLength(style->perspectiveOriginX(), box.width()), style.get(), cssValuePool));
     2190                list->append(zoomAdjustedPixelValue(miminumValueForLength(style->perspectiveOriginY(), box.height()), style.get(), cssValuePool));
    21912191            }
    21922192            else {
     
    22332233            if (renderer) {
    22342234                IntRect box = sizingBox(renderer);
    2235                 list->append(zoomAdjustedPixelValue(style->transformOriginX().calcMinValue(box.width()), style.get(), cssValuePool));
    2236                 list->append(zoomAdjustedPixelValue(style->transformOriginY().calcMinValue(box.height()), style.get(), cssValuePool));
     2235                list->append(zoomAdjustedPixelValue(miminumValueForLength(style->transformOriginX(), box.width()), style.get(), cssValuePool));
     2236                list->append(zoomAdjustedPixelValue(miminumValueForLength(style->transformOriginY(), box.height()), style.get(), cssValuePool));
    22372237                if (style->transformOriginZ() != 0)
    22382238                    list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), cssValuePool));
  • trunk/Source/WebCore/dom/Document.cpp

    r111048 r111126  
    18031803        ASSERT(size.width().isFixed());
    18041804        ASSERT(size.height().isFixed());
    1805         width = size.width().calcValue(0);
    1806         height = size.height().calcValue(0);
     1805        width = valueForLength(size.width(), 0);
     1806        height = valueForLength(size.height(), 0);
    18071807        break;
    18081808    }
     
    18141814    // The percentage is calculated with respect to the width even for margin top and bottom.
    18151815    // http://www.w3.org/TR/CSS2/box.html#margin-properties
    1816     marginTop = style->marginTop().isAuto() ? marginTop : style->marginTop().calcValue(width);
    1817     marginRight = style->marginRight().isAuto() ? marginRight : style->marginRight().calcValue(width);
    1818     marginBottom = style->marginBottom().isAuto() ? marginBottom : style->marginBottom().calcValue(width);
    1819     marginLeft = style->marginLeft().isAuto() ? marginLeft : style->marginLeft().calcValue(width);
     1816    marginTop = style->marginTop().isAuto() ? marginTop : valueForLength(style->marginTop(), width);
     1817    marginRight = style->marginRight().isAuto() ? marginRight : valueForLength(style->marginRight(), width);
     1818    marginBottom = style->marginBottom().isAuto() ? marginBottom : valueForLength(style->marginBottom(), width);
     1819    marginLeft = style->marginLeft().isAuto() ? marginLeft : valueForLength(style->marginLeft(), width);
    18201820}
    18211821
  • trunk/Source/WebCore/html/HTMLAreaElement.cpp

    r109785 r111126  
    148148            if (m_coordsLen >= 6) {
    149149                int numPoints = m_coordsLen / 2;
    150                 path.moveTo(FloatPoint(m_coords[0].calcMinValue(width), m_coords[1].calcMinValue(height)));
     150                path.moveTo(FloatPoint(miminumValueForLength(m_coords[0], width), miminumValueForLength(m_coords[1], height)));
    151151                for (int i = 1; i < numPoints; ++i)
    152                     path.addLineTo(FloatPoint(m_coords[i * 2].calcMinValue(width), m_coords[i * 2 + 1].calcMinValue(height)));
     152                    path.addLineTo(FloatPoint(miminumValueForLength(m_coords[i * 2], width), miminumValueForLength(m_coords[i * 2 + 1], height)));
    153153                path.closeSubpath();
    154154            }
     
    157157            if (m_coordsLen >= 3) {
    158158                Length radius = m_coords[2];
    159                 int r = min(radius.calcMinValue(width), radius.calcMinValue(height));
    160                 path.addEllipse(FloatRect(m_coords[0].calcMinValue(width) - r, m_coords[1].calcMinValue(height) - r, 2 * r, 2 * r));
     159                int r = min(miminumValueForLength(radius, width), miminumValueForLength(radius, height));
     160                path.addEllipse(FloatRect(miminumValueForLength(m_coords[0], width) - r, miminumValueForLength(m_coords[1], height) - r, 2 * r, 2 * r));
    161161            }
    162162            break;
    163163        case Rect:
    164164            if (m_coordsLen >= 4) {
    165                 int x0 = m_coords[0].calcMinValue(width);
    166                 int y0 = m_coords[1].calcMinValue(height);
    167                 int x1 = m_coords[2].calcMinValue(width);
    168                 int y1 = m_coords[3].calcMinValue(height);
     165                int x0 = miminumValueForLength(m_coords[0], width);
     166                int y0 = miminumValueForLength(m_coords[1], height);
     167                int x1 = miminumValueForLength(m_coords[2], width);
     168                int y1 = miminumValueForLength(m_coords[3], height);
    169169                path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
    170170            }
  • trunk/Source/WebCore/platform/CalculationValue.h

    r110148 r111126  
    3333
    3434#include "Length.h"
     35#include "LengthFunctions.h"
    3536#include <wtf/OwnPtr.h>
    3637#include <wtf/PassOwnPtr.h>
     
    102103    virtual float evaluate(float maxValue) const
    103104    {
    104         return m_length.calcFloatValue(maxValue);
     105        return floatValueForLength(m_length, maxValue);
    105106    }
    106107   
  • trunk/Source/WebCore/platform/Length.h

    r110532 r111126  
    160160    }
    161161
    162     int calcValue(int maxValue, bool roundPercentages = false) const
    163     {
    164         switch (type()) {
    165             case Fixed:
    166             case Percent:
    167             case Calculated:
    168                 return calcMinValue(maxValue, roundPercentages);
    169             case Auto:
    170                 return maxValue;
    171             case Relative:
    172             case Intrinsic:
    173             case MinIntrinsic:
    174             case Undefined:
    175                 ASSERT_NOT_REACHED();
    176                 return 0;
    177         }
    178         ASSERT_NOT_REACHED();
    179         return 0;
    180     }
    181 
    182     int calcMinValue(int maxValue, bool roundPercentages = false) const
    183     {
    184         switch (type()) {
    185             case Fixed:
    186                 return value();
    187             case Percent:
    188                 if (roundPercentages)
    189                     return static_cast<int>(round(maxValue * percent() / 100.0f));
    190                 // Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.
    191                 return static_cast<int>(static_cast<float>(maxValue * percent() / 100.0f));
    192             case Calculated:
    193                 return nonNanCalculatedValue(maxValue);
    194             case Auto:
    195                 return 0;
    196             case Relative:
    197             case Intrinsic:
    198             case MinIntrinsic:
    199             case Undefined:
    200                 ASSERT_NOT_REACHED();
    201                 return 0;
    202         }
    203         ASSERT_NOT_REACHED();
    204         return 0;
    205     }
    206 
    207     // FIXME: when subpixel layout is supported this copy of calcFloatValue() can be removed. See bug 71143.
    208     float calcFloatValue(int maxValue) const
    209     {
    210         switch (type()) {
    211             case Fixed:
    212                 return getFloatValue();
    213             case Percent:
    214                 return static_cast<float>(maxValue * percent() / 100.0f);
    215             case Auto:
    216                 return static_cast<float>(maxValue);
    217             case Calculated:
    218                 return nonNanCalculatedValue(maxValue);               
    219             case Relative:
    220             case Intrinsic:
    221             case MinIntrinsic:
    222             case Undefined:
    223                 ASSERT_NOT_REACHED();
    224                 return 0;
    225         }
    226         ASSERT_NOT_REACHED();
    227         return 0;
    228     }
    229 
    230     float calcFloatValue(float maxValue) const
    231     {
    232         switch (type()) {
    233         case Fixed:
    234             return getFloatValue();
    235         case Percent:
    236             return static_cast<float>(maxValue * percent() / 100.0f);
    237         case Auto:
    238             return static_cast<float>(maxValue);
    239         case Calculated:
    240             return nonNanCalculatedValue(maxValue);
    241         case Relative:
    242         case Intrinsic:
    243         case MinIntrinsic:
    244         case Undefined:
    245             ASSERT_NOT_REACHED();
    246             return 0;
    247         }
    248         ASSERT_NOT_REACHED();
    249         return 0;
    250     }
    251 
    252162    bool isUndefined() const { return type() == Undefined; }
    253163
     
    313223    }
    314224
     225    float getFloatValue() const
     226    {
     227        ASSERT(!isUndefined());
     228        return m_isFloat ? m_floatValue : m_intValue;
     229    }
     230    float nonNanCalculatedValue(int maxValue) const;
     231
    315232private:
    316233    int getIntValue() const
     
    319236        return m_isFloat ? static_cast<int>(m_floatValue) : m_intValue;
    320237    }
    321 
    322     float getFloatValue() const
    323     {
    324         ASSERT(!isUndefined());
    325         return m_isFloat ? m_floatValue : m_intValue;
    326     }
    327 
    328238    void initFromLength(const Length &length)
    329239    {
     
    340250            incrementCalculatedRef();
    341251    }
    342    
    343     float nonNanCalculatedValue(int maxValue) const;
     252
    344253    int calculationHandle() const
    345254    {
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm

    r107422 r111126  
    3131
    3232#import "FloatConversion.h"
     33#import "LengthFunctions.h"
    3334#import "PlatformString.h"
    3435#import "TimingFunction.h"
     
    503504        if (!operation->isDefault()) {
    504505            const BlurFilterOperation* op = static_cast<const BlurFilterOperation*>(operation);
    505             amount = op->stdDeviation().calcFloatValue(0);
     506            amount = floatValueForLength(op->stdDeviation(), 0);
    506507        }
    507508       
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm

    r109788 r111126  
    3535#import "GraphicsContext.h"
    3636#import "GraphicsLayerCA.h"
     37#import "LengthFunctions.h"
    3738#import "WebLayer.h"
    3839#import "WebTiledLayer.h"
     
    824825            CIFilter* caFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
    825826            [caFilter setDefaults];
    826             [caFilter setValue:[NSNumber numberWithFloat:op->stdDeviation().calcFloatValue(0)] forKey:@"inputRadius"];
     827            [caFilter setValue:[NSNumber numberWithFloat:floatValueForLength(op->stdDeviation(), 0)] forKey:@"inputRadius"];
    827828            [caFilter setName:filterName];
    828829            [array.get() addObject:caFilter];
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp

    r111047 r111126  
    3131
    3232#include "GraphicsContext3D.h"
     33#include "LengthFunctions.h"
    3334#include "SkBlurImageFilter.h"
    3435#include "SkCanvas.h"
     
    270271        case FilterOperation::BLUR: {
    271272            const BlurFilterOperation* op = static_cast<const BlurFilterOperation*>(filterOperation);
    272             float stdX = op->stdDeviation().calcFloatValue(0);
    273             float stdY = op->stdDeviation().calcFloatValue(1);
     273            float stdX = floatValueForLength(op->stdDeviation(), 0);
     274            float stdY = floatValueForLength(op->stdDeviation(), 1);
    274275            SkAutoTUnref<SkImageFilter> filter(new SkBlurImageFilter(stdX, stdY));
    275276            SkPaint paint;
  • trunk/Source/WebCore/platform/graphics/filters/FilterOperations.cpp

    r108013 r111126  
    2929#include "FEGaussianBlur.h"
    3030#include "IntSize.h"
     31#include "LengthFunctions.h"
    3132
    3233#if ENABLE(CSS_FILTERS)
     
    108109        case FilterOperation::BLUR: {
    109110            BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
    110             float stdDeviation = blurOperation->stdDeviation().calcFloatValue(0);
     111            float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0);
    111112            IntSize outset = outsetSizeForBlur(stdDeviation);
    112113            top += outset.height();
  • trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp

    r102740 r111126  
    4040   
    4141    if (blendToIdentity) {
    42         double p = m_p.calcFloatValue(1);
     42        double p = floatValueForLength(m_p, 1);
    4343        p = WebCore::blend(p, 1.0, progress); // FIXME: this seems wrong. https://bugs.webkit.org/show_bug.cgi?id=52700
    4444        return PerspectiveTransformOperation::create(Length(clampToPositiveInteger(p), Fixed));
     
    5151    TransformationMatrix fromT;
    5252    TransformationMatrix toT;
    53     fromT.applyPerspective(fromP.calcFloatValue(1));
    54     toT.applyPerspective(toP.calcFloatValue(1));
     53    fromT.applyPerspective(floatValueForLength(fromP, 1));
     54    toT.applyPerspective(floatValueForLength(toP, 1));
    5555    toT.blend(fromT, progress);
    5656    TransformationMatrix::DecomposedType decomp;
  • trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h

    r95901 r111126  
    2828
    2929#include "Length.h"
     30#include "LengthFunctions.h"
    3031#include "TransformOperation.h"
    3132
     
    4243   
    4344private:
    44     virtual bool isIdentity() const { return m_p.calcFloatValue(1) == 0; }
     45    virtual bool isIdentity() const { return !floatValueForLength(m_p, 1); }
    4546    virtual OperationType getOperationType() const { return PERSPECTIVE; }
    4647    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == PERSPECTIVE; }
     
    5657    virtual bool apply(TransformationMatrix& transform, const FloatSize&) const
    5758    {
    58         transform.applyPerspective(m_p.calcFloatValue(1));
     59        transform.applyPerspective(floatValueForLength(m_p, 1));
    5960        return false;
    6061    }
  • trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h

    r95901 r111126  
    2727
    2828#include "Length.h"
     29#include "LengthFunctions.h"
    2930#include "TransformOperation.h"
    3031
     
    4344    }
    4445
    45     double x(const FloatSize& borderBoxSize) const { return m_x.calcFloatValue(borderBoxSize.width()); }
    46     double y(const FloatSize& borderBoxSize) const { return m_y.calcFloatValue(borderBoxSize.height()); }
    47     double z(const FloatSize&) const { return m_z.calcFloatValue(1); }
     46    double x(const FloatSize& borderBoxSize) const { return floatValueForLength(m_x, borderBoxSize.width()); }
     47    double y(const FloatSize& borderBoxSize) const { return floatValueForLength(m_y, borderBoxSize.height()); }
     48    double z(const FloatSize&) const { return floatValueForLength(m_z, 1); }
    4849
    4950    Length x() const { return m_x; }
     
    5253
    5354private:
    54     virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0 && m_z.calcFloatValue(1) == 0; }
     55    virtual bool isIdentity() const { return !floatValueForLength(m_x, 1) && !floatValueForLength(m_y, 1) && !floatValueForLength(m_z, 1); }
    5556
    5657    virtual OperationType getOperationType() const { return m_type; }
  • trunk/Source/WebCore/platform/win/PopupMenuWin.cpp

    r107574 r111126  
    3434#include "HWndDC.h"
    3535#include "HostWindow.h"
     36#include "LengthFunctions.h"
    3637#include "Page.h"
    3738#include "PlatformMouseEvent.h"
     
    655656            int textX = max(0, client()->clientPaddingLeft() - client()->clientInsetLeft());
    656657            if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR)
    657                 textX += itemStyle.textIndent().calcMinValue(itemRect.width());
     658                textX += miminumValueForLength(itemStyle.textIndent(), itemRect.width());
    658659            int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2;
    659660            context.drawBidiText(itemFont, textRun, IntPoint(textX, textY));
  • trunk/Source/WebCore/rendering/AutoTableLayout.cpp

    r106479 r111126  
    552552            Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
    553553            if (logicalWidth.isPercent()) {
    554                 int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, logicalWidth.calcMinValue(tableLogicalWidth));
     554                int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, miminumValueForLength(logicalWidth, tableLogicalWidth));
    555555                available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth;
    556556                m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
  • trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp

    r109016 r111126  
    238238        case FilterOperation::BLUR: {
    239239            BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
    240             float stdDeviation = blurOperation->stdDeviation().calcFloatValue(0);
     240            float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0);
    241241            effect = FEGaussianBlur::create(this, stdDeviation, stdDeviation);
    242242            break;
  • trunk/Source/WebCore/rendering/FixedTableLayout.cpp

    r111118 r111126  
    245245            totalFixedWidth += calcWidth[i];
    246246        } else if (m_width[i].isPercent()) {
    247             calcWidth[i] = m_width[i].calcValue(tableLogicalWidth);
     247            calcWidth[i] = valueForLength(m_width[i], tableLogicalWidth);
    248248            totalPercentWidth += calcWidth[i];
    249249            totalPercent += m_width[i].percent();
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r111048 r111126  
    39023902    if (style()->textIndent().isPercent())
    39033903        cw = containingBlock()->availableLogicalWidth();
    3904     return style()->textIndent().calcMinValue(cw);
     3904    return miminumValueForLength(style()->textIndent(), cw);
    39053905}
    39063906
     
    55425542                if (!addedTextIndent) {
    55435543                    addedTextIndent = true;
    5544                     ti = styleToUse->textIndent().calcMinValue(cw);
     5544                    ti = miminumValueForLength(styleToUse->textIndent(), cw);
    55455545                    childMin += ti;
    55465546                    childMax += ti;
     
    56135613                if (!addedTextIndent) {
    56145614                    addedTextIndent = true;
    5615                     ti = styleToUse->textIndent().calcMinValue(cw);
     5615                    ti = miminumValueForLength(styleToUse->textIndent(), cw);
    56165616                    childMin+=ti; beginMin += ti;
    56175617                    childMax+=ti; beginMax += ti;
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r111064 r111126  
    624624        return 0;
    625625    if (style()->boxReflect()->direction() == ReflectionLeft || style()->boxReflect()->direction() == ReflectionRight)
    626         return style()->boxReflect()->offset().calcValue(borderBoxRect().width());
    627     return style()->boxReflect()->offset().calcValue(borderBoxRect().height());
     626        return valueForLength(style()->boxReflect()->offset(), borderBoxRect().width());
     627    return valueForLength(style()->boxReflect()->offset(), borderBoxRect().height());
    628628}
    629629
     
    12951295
    12961296    if (!style()->clipLeft().isAuto()) {
    1297         LayoutUnit c = style()->clipLeft().calcValue(borderBoxRect.width());
     1297        LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width());
    12981298        clipRect.move(c, 0);
    12991299        clipRect.contract(c, 0);
     
    13041304
    13051305    if (!style()->clipRight().isAuto())
    1306         clipRect.contract(width() - style()->clipRight().calcValue(width()), 0);
     1306        clipRect.contract(width() - valueForLength(style()->clipRight(), width()), 0);
    13071307
    13081308    if (!style()->clipTop().isAuto()) {
    1309         LayoutUnit c = style()->clipTop().calcValue(borderBoxRect.height());
     1309        LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height());
    13101310        clipRect.move(0, c);
    13111311        clipRect.contract(0, c);
     
    13131313
    13141314    if (!style()->clipBottom().isAuto())
    1315         clipRect.contract(0, height() - style()->clipBottom().calcValue(height()));
     1315        clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height()));
    13161316
    13171317    return clipRect;
     
    17801780    if (isInline() && !isInlineBlockOrInlineTable()) {
    17811781        // just calculate margins
    1782         setMarginStart(styleToUse->marginStart().calcMinValue(containerLogicalWidth));
    1783         setMarginEnd(styleToUse->marginEnd().calcMinValue(containerLogicalWidth));
     1782        setMarginStart(miminumValueForLength(styleToUse->marginStart(), containerLogicalWidth));
     1783        setMarginEnd(miminumValueForLength(styleToUse->marginEnd(), containerLogicalWidth));
    17841784        if (treatAsReplaced)
    1785             setLogicalWidth(max<LayoutUnit>(logicalWidthLength.calcFloatValue(0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
     1785            setLogicalWidth(max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
    17861786        return;
    17871787    }
     
    18191819    // Margin calculations.
    18201820    if (logicalWidthLength.isAuto() || hasPerpendicularContainingBlock) {
    1821         setMarginStart(styleToUse->marginStart().calcMinValue(containerLogicalWidth));
    1822         setMarginEnd(styleToUse->marginEnd().calcMinValue(containerLogicalWidth));
     1821        setMarginStart(miminumValueForLength(styleToUse->marginStart(), containerLogicalWidth));
     1822        setMarginEnd(miminumValueForLength(styleToUse->marginEnd(), containerLogicalWidth));
    18231823    } else
    18241824        computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth());
     
    18431843
    18441844    if (logicalWidth.isIntrinsicOrAuto()) {
    1845         LayoutUnit marginStart = styleToUse->marginStart().calcMinValue(availableLogicalWidth);
    1846         LayoutUnit marginEnd = styleToUse->marginEnd().calcMinValue(availableLogicalWidth);
     1845        LayoutUnit marginStart = miminumValueForLength(styleToUse->marginStart(), availableLogicalWidth);
     1846        LayoutUnit marginEnd = miminumValueForLength(styleToUse->marginEnd(), availableLogicalWidth);
    18471847        logicalWidthResult = availableLogicalWidth - marginStart - marginEnd;
    18481848
     
    18551855        }
    18561856    } else // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead.
    1857         logicalWidthResult = computeBorderBoxLogicalWidth(logicalWidth.calcValue(availableLogicalWidth));
     1857        logicalWidthResult = computeBorderBoxLogicalWidth(valueForLength(logicalWidth, availableLogicalWidth));
    18581858
    18591859    return logicalWidthResult;
     
    19261926    if (isFloating() || isInline()) {
    19271927        // Inline blocks/tables and floats don't have their margins increased.
    1928         containingBlock->setMarginStartForChild(this, marginStartLength.calcMinValue(containerWidth));
    1929         containingBlock->setMarginEndForChild(this, marginEndLength.calcMinValue(containerWidth));
     1928        containingBlock->setMarginStartForChild(this, miminumValueForLength(marginStartLength, containerWidth));
     1929        containingBlock->setMarginEndForChild(this, miminumValueForLength(marginEndLength, containerWidth));
    19301930        return;
    19311931    }
     
    19411941    // Case Two: The object is being pushed to the start of the containing block's available logical width.
    19421942    if (marginEndLength.isAuto() && childWidth < containerWidth) {
    1943         containingBlock->setMarginStartForChild(this, marginStartLength.calcValue(containerWidth));
     1943        containingBlock->setMarginStartForChild(this, valueForLength(marginStartLength, containerWidth));
    19441944        containingBlock->setMarginEndForChild(this, containerWidth - childWidth - containingBlock->marginStartForChild(this));
    19451945        return;
     
    19501950        || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
    19511951    if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) {
    1952         containingBlock->setMarginEndForChild(this, marginEndLength.calcValue(containerWidth));
     1952        containingBlock->setMarginEndForChild(this, valueForLength(marginEndLength, containerWidth));
    19531953        containingBlock->setMarginStartForChild(this, containerWidth - childWidth - containingBlock->marginEndForChild(this));
    19541954        return;
     
    19571957    // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3).  In that case
    19581958    // auto margins will just turn into 0.
    1959     containingBlock->setMarginStartForChild(this, marginStartLength.calcMinValue(containerWidth));
    1960     containingBlock->setMarginEndForChild(this, marginEndLength.calcMinValue(containerWidth));
     1959    containingBlock->setMarginStartForChild(this, miminumValueForLength(marginStartLength, containerWidth));
     1960    containingBlock->setMarginEndForChild(this, miminumValueForLength(marginEndLength, containerWidth));
    19611961}
    19621962
     
    22462246
    22472247    if (result != -1) {
    2248         result = height.calcValue(result);
     2248        result = valueForLength(height, result);
    22492249        if (includeBorderPadding) {
    22502250            // It is necessary to use the border-box to match WinIE's broken
     
    22812281            const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
    22822282            if (cw > 0)
    2283                 return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw));
     2283                return computeContentBoxLogicalWidth(miminumValueForLength(logicalWidth, cw));
    22842284        }
    22852285        // fall through
     
    23232323                LayoutUnit newHeight = block->computeContentBoxLogicalHeight(block->contentHeight());
    23242324                block->setHeight(oldHeight);
    2325                 return computeContentBoxLogicalHeight(logicalHeight.calcValue(newHeight));
     2325                return computeContentBoxLogicalHeight(valueForLength(logicalHeight, newHeight));
    23262326            }
    23272327           
     
    23442344                        // <http://bugs.webkit.org/show_bug.cgi?id=15359>
    23452345                        availableHeight = max(availableHeight, intrinsicLogicalHeight());
    2346                         return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
     2346                        return valueForLength(logicalHeight, availableHeight - borderAndPaddingLogicalHeight());
    23472347                    }
    23482348                    cb = cb->containingBlock();
     
    23502350                }
    23512351            }
    2352             return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));
     2352            return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight));
    23532353        }
    23542354        default:
     
    23852385        else
    23862386            availableHeight = containingBlock()->availableLogicalHeight();
    2387         return computeContentBoxLogicalHeight(h.calcValue(availableHeight));
     2387        return computeContentBoxLogicalHeight(valueForLength(h, availableHeight));
    23882388    }
    23892389
     
    24172417
    24182418    RenderStyle* containingBlockStyle = containingBlock->style();
    2419     containingBlock->setMarginBeforeForChild(this, style()->marginBeforeUsing(containingBlockStyle).calcMinValue(cw));
    2420     containingBlock->setMarginAfterForChild(this, style()->marginAfterUsing(containingBlockStyle).calcMinValue(cw));
     2419    containingBlock->setMarginBeforeForChild(this, miminumValueForLength(style()->marginBeforeUsing(containingBlockStyle), cw));
     2420    containingBlock->setMarginAfterForChild(this, miminumValueForLength(style()->marginAfterUsing(containingBlockStyle), cw));
    24212421}
    24222422
     
    27582758        // case because the value is not used for any further calculations.
    27592759
    2760         logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
    2761         logicalWidthValue = computeContentBoxLogicalWidth(logicalWidth.calcValue(containerLogicalWidth));
    2762 
    2763         const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + logicalRight.calcValue(containerLogicalWidth) + bordersPlusPadding);
     2760        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     2761        logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
     2762
     2763        const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth) + bordersPlusPadding);
    27642764
    27652765        // Margins are now the only unknown
     
    27822782        } else if (marginLogicalLeft.isAuto()) {
    27832783            // Solve for left margin
    2784             marginLogicalRightValue = marginLogicalRight.calcValue(containerLogicalWidth);
     2784            marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth);
    27852785            marginLogicalLeftValue = availableSpace - marginLogicalRightValue;
    27862786        } else if (marginLogicalRight.isAuto()) {
    27872787            // Solve for right margin
    2788             marginLogicalLeftValue = marginLogicalLeft.calcValue(containerLogicalWidth);
     2788            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth);
    27892789            marginLogicalRightValue = availableSpace - marginLogicalLeftValue;
    27902790        } else {
    27912791            // Over-constrained, solve for left if direction is RTL
    2792             marginLogicalLeftValue = marginLogicalLeft.calcValue(containerLogicalWidth);
    2793             marginLogicalRightValue = marginLogicalRight.calcValue(containerLogicalWidth);
     2792            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth);
     2793            marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth);
    27942794
    27952795            // Use the containing block's direction rather than the parent block's
     
    28412841
    28422842        // Calculate margins, 'auto' margins are ignored.
    2843         marginLogicalLeftValue = marginLogicalLeft.calcMinValue(containerLogicalWidth);
    2844         marginLogicalRightValue = marginLogicalRight.calcMinValue(containerLogicalWidth);
     2843        marginLogicalLeftValue = miminumValueForLength(marginLogicalLeft, containerLogicalWidth);
     2844        marginLogicalRightValue = miminumValueForLength(marginLogicalRight, containerLogicalWidth);
    28452845
    28462846        const LayoutUnit availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding);
     
    28502850        if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
    28512851            // RULE 1: (use shrink-to-fit for width, and solve of left)
    2852             LayoutUnit logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
     2852            LayoutUnit logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
    28532853
    28542854            // FIXME: would it be better to have shrink-to-fit in one step?
     
    28602860        } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAuto) {
    28612861            // RULE 3: (use shrink-to-fit for width, and no need solve of right)
    2862             logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
     2862            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    28632863
    28642864            // FIXME: would it be better to have shrink-to-fit in one step?
     
    28692869        } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) {
    28702870            // RULE 4: (solve for left)
    2871             logicalWidthValue = computeContentBoxLogicalWidth(logicalWidth.calcValue(containerLogicalWidth));
    2872             logicalLeftValue = availableSpace - (logicalWidthValue + logicalRight.calcValue(containerLogicalWidth));
     2871            logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
     2872            logicalLeftValue = availableSpace - (logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth));
    28732873        } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
    28742874            // RULE 5: (solve for width)
    2875             logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
    2876             logicalWidthValue = availableSpace - (logicalLeftValue + logicalRight.calcValue(containerLogicalWidth));
     2875            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     2876            logicalWidthValue = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth));
    28772877        } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAuto) {
    28782878            // RULE 6: (no need solve for right)
    2879             logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
    2880             logicalWidthValue = computeContentBoxLogicalWidth(logicalWidth.calcValue(containerLogicalWidth));
     2879            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     2880            logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth));
    28812881        }
    28822882    }
     
    30933093        // case because the value is not used for any further calculations.
    30943094
    3095         logicalHeightValue = computeContentBoxLogicalHeight(logicalHeightLength.calcValue(containerLogicalHeight));
    3096         logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
    3097 
    3098         const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight) + bordersPlusPadding);
     3095        logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
     3096        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3097
     3098        const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight) + bordersPlusPadding);
    30993099
    31003100        // Margins are now the only unknown
     
    31063106        } else if (marginBefore.isAuto()) {
    31073107            // Solve for top margin
    3108             marginAfterValue = marginAfter.calcValue(containerLogicalHeight);
     3108            marginAfterValue = valueForLength(marginAfter, containerLogicalHeight);
    31093109            marginBeforeValue = availableSpace - marginAfterValue;
    31103110        } else if (marginAfter.isAuto()) {
    31113111            // Solve for bottom margin
    3112             marginBeforeValue = marginBefore.calcValue(containerLogicalHeight);
     3112            marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight);
    31133113            marginAfterValue = availableSpace - marginBeforeValue;
    31143114        } else {
    31153115            // Over-constrained, (no need solve for bottom)
    3116             marginBeforeValue = marginBefore.calcValue(containerLogicalHeight);
    3117             marginAfterValue = marginAfter.calcValue(containerLogicalHeight);
     3116            marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight);
     3117            marginAfterValue = valueForLength(marginAfter, containerLogicalHeight);
    31183118        }
    31193119    } else {
     
    31443144
    31453145        // Calculate margins, 'auto' margins are ignored.
    3146         marginBeforeValue = marginBefore.calcMinValue(containerLogicalHeight);
    3147         marginAfterValue = marginAfter.calcMinValue(containerLogicalHeight);
     3146        marginBeforeValue = miminumValueForLength(marginBefore, containerLogicalHeight);
     3147        marginAfterValue = miminumValueForLength(marginAfter, containerLogicalHeight);
    31483148
    31493149        const LayoutUnit availableSpace = containerLogicalHeight - (marginBeforeValue + marginAfterValue + bordersPlusPadding);
     
    31533153            // RULE 1: (height is content based, solve of top)
    31543154            logicalHeightValue = contentLogicalHeight;
    3155             logicalTopValue = availableSpace - (logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight));
     3155            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight));
    31563156        } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) {
    31573157            // RULE 3: (height is content based, no need solve of bottom)
    3158             logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
     3158            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    31593159            logicalHeightValue = contentLogicalHeight;
    31603160        } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) {
    31613161            // RULE 4: (solve of top)
    3162             logicalHeightValue = computeContentBoxLogicalHeight(logicalHeightLength.calcValue(containerLogicalHeight));
    3163             logicalTopValue = availableSpace - (logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight));
     3162            logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
     3163            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight));
    31643164        } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) {
    31653165            // RULE 5: (solve of height)
    3166             logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
    3167             logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + logicalBottom.calcValue(containerLogicalHeight)));
     3166            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3167            logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight)));
    31683168        } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) {
    31693169            // RULE 6: (no need solve of bottom)
    3170             logicalHeightValue = computeContentBoxLogicalHeight(logicalHeightLength.calcValue(containerLogicalHeight));
    3171             logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
     3170            logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight));
     3171            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    31723172        }
    31733173    }
     
    32503250        ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto()));
    32513251
    3252         logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
    3253         logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
     3252        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     3253        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
    32543254
    32553255        LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRightValue);
     
    32743274    \*-----------------------------------------------------------------------*/
    32753275    } else if (logicalLeft.isAuto()) {
    3276         marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);
    3277         marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);
    3278         logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
     3276        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
     3277        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
     3278        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
    32793279
    32803280        // Solve for 'left'
    32813281        logicalLeftValue = availableSpace - (logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias);
    32823282    } else if (logicalRight.isAuto()) {
    3283         marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);
    3284         marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);
    3285         logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
     3283        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
     3284        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
     3285        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    32863286
    32873287        // Solve for 'right'
    32883288        logicalRightValue = availableSpace - (logicalLeftValue + marginLogicalLeftAlias + marginLogicalRightAlias);
    32893289    } else if (marginLogicalLeft.isAuto()) {
    3290         marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);
    3291         logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
    3292         logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
     3290        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
     3291        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     3292        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
    32933293
    32943294        // Solve for 'margin-left'
    32953295        marginLogicalLeftAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalRightAlias);
    32963296    } else if (marginLogicalRight.isAuto()) {
    3297         marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);
    3298         logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
    3299         logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
     3297        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
     3298        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
     3299        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
    33003300
    33013301        // Solve for 'margin-right'
     
    33033303    } else {
    33043304        // Nothing is 'auto', just calculate the values.
    3305         marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);
    3306         marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);
    3307         logicalRightValue = logicalRight.calcValue(containerLogicalWidth);
    3308         logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);
     3305        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth);
     3306        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth);
     3307        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
     3308        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
    33093309        // If the containing block is right-to-left, then push the left position as far to the right as possible
    33103310        if (containerDirection == RTL) {
     
    34123412        ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto()));
    34133413
    3414         logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
    3415         logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
     3414        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3415        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
    34163416
    34173417        LayoutUnit difference = availableSpace - (logicalTopValue + logicalBottomValue);
     
    34253425    \*-----------------------------------------------------------------------*/
    34263426    } else if (logicalTop.isAuto()) {
    3427         marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);
    3428         marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);
    3429         logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
     3427        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
     3428        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
     3429        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
    34303430
    34313431        // Solve for 'top'
    34323432        logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAlias + marginAfterAlias);
    34333433    } else if (logicalBottom.isAuto()) {
    3434         marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);
    3435         marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);
    3436         logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
     3434        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
     3435        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
     3436        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    34373437
    34383438        // Solve for 'bottom'
     
    34403440        // use the value.
    34413441    } else if (marginBefore.isAuto()) {
    3442         marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);
    3443         logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
    3444         logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
     3442        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
     3443        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3444        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
    34453445
    34463446        // Solve for 'margin-top'
    34473447        marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginAfterAlias);
    34483448    } else if (marginAfter.isAuto()) {
    3449         marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);
    3450         logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
    3451         logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);
     3449        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
     3450        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
     3451        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
    34523452
    34533453        // Solve for 'margin-bottom'
     
    34553455    } else {
    34563456        // Nothing is 'auto', just calculate the values.
    3457         marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);
    3458         marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);
    3459         logicalTopValue = logicalTop.calcValue(containerLogicalHeight);
     3457        marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight);
     3458        marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight);
     3459        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
    34603460        // NOTE: It is not necessary to solve for 'bottom' because we don't ever
    34613461        // use the value.
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r111066 r111126  
    438438        RenderBlock* cb = containingBlock();
    439439        if (!style()->right().isAuto() && !cb->style()->isLeftToRightDirection())
    440             return -style()->right().calcValue(cb->availableWidth());
    441         return offset + style()->left().calcValue(cb->availableWidth());
     440            return -valueForLength(style()->right(), cb->availableWidth());
     441        return offset + valueForLength(style()->left(), cb->availableWidth());
    442442    }
    443443    if (!style()->right().isAuto()) {
    444444        RenderBlock* cb = containingBlock();
    445         return offset + -style()->right().calcValue(cb->availableWidth());
     445        return offset + -valueForLength(style()->right(), cb->availableWidth());
    446446    }
    447447    return offset;
     
    463463            || !style()->top().isPercent()
    464464            || containingBlock->stretchesToViewport()))
    465         return offset + style()->top().calcValue(containingBlock->availableHeight());
     465        return offset + valueForLength(style()->top(), containingBlock->availableHeight());
    466466
    467467    if (!style()->bottom().isAuto()
     
    469469            || !style()->bottom().isPercent()
    470470            || containingBlock->stretchesToViewport()))
    471         return offset + -style()->bottom().calcValue(containingBlock->availableHeight());
     471        return offset + -valueForLength(style()->bottom(), containingBlock->availableHeight());
    472472
    473473    return offset;
     
    557557    if (padding.isPercent())
    558558        w = containingBlock()->availableLogicalWidth();
    559     return padding.calcMinValue(w);
     559    return miminumValueForLength(padding, w);
    560560}
    561561
     
    566566    if (padding.isPercent())
    567567        w = containingBlock()->availableLogicalWidth();
    568     return padding.calcMinValue(w);
     568    return miminumValueForLength(padding, w);
    569569}
    570570
     
    575575    if (padding.isPercent())
    576576        w = containingBlock()->availableLogicalWidth();
    577     return padding.calcMinValue(w);
     577    return miminumValueForLength(padding, w);
    578578}
    579579
     
    584584    if (padding.isPercent())
    585585        w = containingBlock()->availableLogicalWidth();
    586     return padding.calcMinValue(w);
     586    return miminumValueForLength(padding, w);
    587587}
    588588
     
    593593    if (padding.isPercent())
    594594        w = containingBlock()->availableLogicalWidth();
    595     return padding.calcMinValue(w);
     595    return miminumValueForLength(padding, w);
    596596}
    597597
     
    602602    if (padding.isPercent())
    603603        w = containingBlock()->availableLogicalWidth();
    604     return padding.calcMinValue(w);
     604    return miminumValueForLength(padding, w);
    605605}
    606606
     
    611611    if (padding.isPercent())
    612612        w = containingBlock()->availableLogicalWidth();
    613     return padding.calcMinValue(w);
     613    return miminumValueForLength(padding, w);
    614614}
    615615
     
    620620    if (padding.isPercent())
    621621        w = containingBlock()->availableLogicalWidth();
    622     return padding.calcMinValue(w);
     622    return miminumValueForLength(padding, w);
    623623}
    624624
     
    999999                w = layerWidth.value();
    10001000            else if (layerWidth.isPercent())
    1001                 w = layerWidth.calcValue(positioningAreaSize.width());
     1001                w = valueForLength(layerWidth, positioningAreaSize.width());
    10021002           
    10031003            if (layerHeight.isFixed())
    10041004                h = layerHeight.value();
    10051005            else if (layerHeight.isPercent())
    1006                 h = layerHeight.calcValue(positioningAreaSize.height());
     1006                h = valueForLength(layerHeight, positioningAreaSize.height());
    10071007           
    10081008            // If one of the values is auto we have to use the appropriate
     
    11401140    EFillRepeat backgroundRepeatY = fillLayer->repeatY();
    11411141
    1142     LayoutUnit xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true);
     1142    LayoutUnit xPosition = miminumValueForLength(fillLayer->xPosition(), positioningAreaSize.width() - geometry.tileSize().width(), true);
    11431143    if (backgroundRepeatX == RepeatFill)
    11441144        geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - (xPosition + left) % geometry.tileSize().width() : 0);
     
    11461146        geometry.setNoRepeatX(xPosition + left);
    11471147
    1148     LayoutUnit yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true);
     1148    LayoutUnit yPosition = miminumValueForLength(fillLayer->yPosition(), positioningAreaSize.height() - geometry.tileSize().height(), true);
    11491149    if (backgroundRepeatY == RepeatFill)
    11501150        geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - (yPosition + top) % geometry.tileSize().height() : 0);
     
    11651165    if (borderSlice.isAuto())
    11661166        return imageSide;
    1167     return borderSlice.calcValue(boxExtent);
     1167    return valueForLength(borderSlice, boxExtent);
    11681168}
    11691169
     
    12031203    int imageHeight = imageSize.height() / style->effectiveZoom();
    12041204
    1205     int topSlice = min<int>(imageHeight, ninePieceImage.imageSlices().top().calcValue(imageHeight));
    1206     int rightSlice = min<int>(imageWidth, ninePieceImage.imageSlices().right().calcValue(imageWidth));
    1207     int bottomSlice = min<int>(imageHeight, ninePieceImage.imageSlices().bottom().calcValue(imageHeight));
    1208     int leftSlice = min<int>(imageWidth, ninePieceImage.imageSlices().left().calcValue(imageWidth));
     1205    int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight));
     1206    int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth));
     1207    int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight));
     1208    int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth));
    12091209
    12101210    ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r111103 r111126  
    574574        return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child);
    575575    }
    576     return mainAxisLength.calcMinValue(mainAxisContentExtent());
     576    return miminumValueForLength(mainAxisLength, mainAxisContentExtent());
    577577}
    578578
     
    681681        // computes the start/end margins.
    682682        if (isHorizontalFlow()) {
    683             child->setMarginLeft(child->style()->marginLeft().calcMinValue(flexboxAvailableContentExtent));
    684             child->setMarginRight(child->style()->marginRight().calcMinValue(flexboxAvailableContentExtent));
     683            child->setMarginLeft(miminumValueForLength(child->style()->marginLeft(), flexboxAvailableContentExtent));
     684            child->setMarginRight(miminumValueForLength(child->style()->marginRight(), flexboxAvailableContentExtent));
    685685        } else {
    686             child->setMarginTop(child->style()->marginTop().calcMinValue(flexboxAvailableContentExtent));
    687             child->setMarginBottom(child->style()->marginBottom().calcMinValue(flexboxAvailableContentExtent));
     686            child->setMarginTop(miminumValueForLength(child->style()->marginTop(), flexboxAvailableContentExtent));
     687            child->setMarginBottom(miminumValueForLength(child->style()->marginBottom(), flexboxAvailableContentExtent));
    688688        }
    689689    }
     
    759759
    760760                Length childLogicalMaxWidth = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight();
    761                 if (childLogicalMaxWidth.isSpecified() && childPreferredSize > childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent)) {
    762                     childPreferredSize = childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent);
     761                if (childLogicalMaxWidth.isSpecified() && childPreferredSize > valueForLength(childLogicalMaxWidth, flexboxAvailableContentExtent)) {
     762                    childPreferredSize = valueForLength(childLogicalMaxWidth, flexboxAvailableContentExtent);
    763763                    availableFreeSpace -= childPreferredSize - preferredMainAxisContentExtentForChild(child);
    764764                    totalPositiveFlexibility -= positiveFlexForChild(child);
     
    771771
    772772                Length childLogicalMinWidth = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight();
    773                 if (childLogicalMinWidth.isSpecified() && childPreferredSize < childLogicalMinWidth.calcValue(flexboxAvailableContentExtent)) {
    774                     childPreferredSize = childLogicalMinWidth.calcValue(flexboxAvailableContentExtent);
     773                if (childLogicalMinWidth.isSpecified() && childPreferredSize < valueForLength(childLogicalMinWidth, flexboxAvailableContentExtent)) {
     774                    childPreferredSize = valueForLength(childLogicalMinWidth, flexboxAvailableContentExtent);
    775775                    availableFreeSpace += preferredMainAxisContentExtentForChild(child) - childPreferredSize;
    776776                    totalNegativeFlexibility -= negativeFlexForChild(child);
  • trunk/Source/WebCore/rendering/RenderFrameSet.cpp

    r107889 r111126  
    224224        // Count the number of columns/rows which are percentages -> countPercent
    225225        if (grid[i].isPercent()) {
    226             gridLayout[i] = max(grid[i].calcValue(availableLen), 0);
     226            gridLayout[i] = max(valueForLength(grid[i], availableLen), 0);
    227227            totalPercent += gridLayout[i];
    228228            countPercent++;
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r110643 r111126  
    702702        return margin.value();
    703703    if (margin.isPercent())
    704         return margin.calcMinValue(max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
     704        return miminumValueForLength(margin, max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
    705705    return 0;
    706706}
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r110629 r111126  
    821821    const float boxHeight = borderBox.height();
    822822
    823     float perspectiveOriginX = style->perspectiveOriginX().calcFloatValue(boxWidth);
    824     float perspectiveOriginY = style->perspectiveOriginY().calcFloatValue(boxHeight);
     823    float perspectiveOriginX = floatValueForLength(style->perspectiveOriginX(), boxWidth);
     824    float perspectiveOriginY = floatValueForLength(style->perspectiveOriginY(), boxHeight);
    825825
    826826    // A perspective origin of 0,0 makes the vanishing point in the center of the element.
     
    845845    RenderStyle* style = renderer()->style();
    846846
    847     return FloatPoint(style->perspectiveOriginX().calcFloatValue(borderBox.width()),
    848                       style->perspectiveOriginY().calcFloatValue(borderBox.height()));
     847    return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox.width()),
     848                      floatValueForLength(style->perspectiveOriginY(), borderBox.height()));
    849849}
    850850
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r110646 r111126  
    10061006
    10071007    FloatPoint3D origin;
    1008     origin.setX(style->transformOriginX().calcFloatValue(borderBox.width()));
    1009     origin.setY(style->transformOriginY().calcFloatValue(borderBox.height()));
     1008    origin.setX(floatValueForLength(style->transformOriginX(), borderBox.width()));
     1009    origin.setY(floatValueForLength(style->transformOriginY(), borderBox.height()));
    10101010    origin.setZ(style->transformOriginZ());
    10111011
     
    10211021
    10221022    FloatPoint origin;
    1023     origin.setX(style->perspectiveOriginX().calcFloatValue(boxWidth));
    1024     origin.setY(style->perspectiveOriginY().calcFloatValue(boxHeight));
     1023    origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth));
     1024    origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight));
    10251025
    10261026    return origin;
  • trunk/Source/WebCore/rendering/RenderMarquee.cpp

    r107880 r111126  
    290290        bool positive = range > 0;
    291291        int clientSize = (isHorizontal() ? m_layer->renderBox()->clientWidth() : m_layer->renderBox()->clientHeight());
    292         int increment = abs(m_layer->renderer()->style()->marqueeIncrement().calcValue(clientSize));
     292        int increment = abs(valueForLength(m_layer->renderer()->style()->marqueeIncrement(), clientSize));
    293293        int currentPos = (isHorizontal() ? m_layer->scrollXOffset() : m_layer->scrollYOffset());
    294294        newPos =  currentPos + (addIncrement ? increment : -increment);
  • trunk/Source/WebCore/rendering/RenderMenuList.cpp

    r110405 r111126  
    162162            float optionWidth = 0;
    163163            if (RenderStyle* optionStyle = element->renderStyle())
    164                 optionWidth += optionStyle->textIndent().calcMinValue(0);
     164                optionWidth += miminumValueForLength(optionStyle->textIndent(), 0);
    165165            if (!text.isEmpty())
    166166                optionWidth += style()->font().width(text);
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r111082 r111126  
    14461446        int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
    14471447        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : zeroLayoutUnit;
    1448         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);
     1448        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);
    14491449        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
    14501450            newOutlineBox.y(),
     
    14651465        int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
    14661466        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : zeroLayoutUnit;
    1467         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);
     1467        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);
    14681468        LayoutRect bottomRect(newOutlineBox.x(),
    14691469            min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight,
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r110323 r111126  
    336336
    337337                // This solves above equation for 'width' (== logicalWidth).
    338                 LayoutUnit marginStart = style()->marginStart().calcMinValue(logicalWidth);
    339                 LayoutUnit marginEnd = style()->marginEnd().calcMinValue(logicalWidth);
     338                LayoutUnit marginStart = miminumValueForLength(style()->marginStart(), logicalWidth);
     339                LayoutUnit marginEnd = miminumValueForLength(style()->marginEnd(), logicalWidth);
    340340                logicalWidth = max(0, logicalWidth - (marginStart + marginEnd + (width() - clientWidth())));
    341341                if (isPercentageIntrinsicSize)
  • trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp

    r109785 r111126  
    8484    if (l.isIntrinsicOrAuto())
    8585        return ScrollbarTheme::theme()->scrollbarThickness();
    86     return l.calcMinValue(containingLength);
     86    return miminumValueForLength(l, containingLength);
    8787}
    8888
     
    9898   
    9999    // Buttons and track pieces can all have margins along the axis of the scrollbar.
    100     m_marginLeft = style()->marginLeft().calcMinValue(visibleSize);
    101     m_marginRight = style()->marginRight().calcMinValue(visibleSize);
     100    m_marginLeft = miminumValueForLength(style()->marginLeft(), visibleSize);
     101    m_marginRight = miminumValueForLength(style()->marginRight(), visibleSize);
    102102}
    103103
     
    113113
    114114    // Buttons and track pieces can all have margins along the axis of the scrollbar.
    115     m_marginTop = style()->marginTop().calcMinValue(visibleSize);
    116     m_marginBottom = style()->marginBottom().calcMinValue(visibleSize);
     115    m_marginTop = miminumValueForLength(style()->marginTop(), visibleSize);
     116    m_marginBottom = miminumValueForLength(style()->marginBottom(), visibleSize);
    117117}
    118118
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r109785 r111126  
    233233    else {
    234234        // Subtract out any fixed margins from our available width for auto width tables.
    235         LayoutUnit marginStart = style()->marginStart().calcMinValue(availableLogicalWidth);
    236         LayoutUnit marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth);
     235        LayoutUnit marginStart = miminumValueForLength(style()->marginStart(), availableLogicalWidth);
     236        LayoutUnit marginEnd = miminumValueForLength(style()->marginEnd(), availableLogicalWidth);
    237237        LayoutUnit marginTotal = marginStart + marginEnd;
    238238       
     
    262262        computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth());
    263263    else {
    264         setMarginStart(style()->marginStart().calcMinValue(availableLogicalWidth));
    265         setMarginEnd(style()->marginEnd().calcMinValue(availableLogicalWidth));
     264        setMarginStart(miminumValueForLength(style()->marginStart(), availableLogicalWidth));
     265        setMarginEnd(miminumValueForLength(style()->marginEnd(), availableLogicalWidth));
    266266    }
    267267}
     
    277277        borders = borderStart() + borderEnd() + (collapseBorders() ? 0 : paddingStart() + paddingEnd());
    278278    }
    279     return styleLogicalWidth.calcMinValue(availableWidth) + borders;
     279    return miminumValueForLength(styleLogicalWidth, availableWidth) + borders;
    280280}
    281281
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

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

    r110336 r111126  
    339339
    340340        // Our base size is the biggest logical height from our cells' styles (excluding row spanning cells).
    341         m_rowPos[r + 1] = max(m_rowPos[r] + m_grid[r].logicalHeight.calcMinValue(0), 0);
     341        m_rowPos[r + 1] = max(m_rowPos[r] + miminumValueForLength(m_grid[r].logicalHeight, 0), 0);
    342342
    343343        Row& row = m_grid[r].row;
  • trunk/Source/WebCore/rendering/RenderText.h

    r110224 r111126  
    9898    virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
    9999
    100     virtual LayoutUnit marginLeft() const { return style()->marginLeft().calcMinValue(0); }
    101     virtual LayoutUnit marginRight() const { return style()->marginRight().calcMinValue(0); }
     100    virtual LayoutUnit marginLeft() const { return miminumValueForLength(style()->marginLeft(), 0); }
     101    virtual LayoutUnit marginRight() const { return miminumValueForLength(style()->marginRight(), 0); }
    102102
    103103    virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

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

    r111076 r111126  
    803803
    804804    if (applyTransformOrigin)
    805         transform.translate3d(transformOriginX().calcFloatValue(borderBoxSize.width()), transformOriginY().calcFloatValue(borderBoxSize.height()), transformOriginZ());
     805        transform.translate3d(floatValueForLength(transformOriginX(), borderBoxSize.width()), floatValueForLength(transformOriginY(), borderBoxSize.height()), transformOriginZ());
    806806
    807807    unsigned size = transformOperations.size();
     
    810810
    811811    if (applyTransformOrigin)
    812         transform.translate3d(-transformOriginX().calcFloatValue(borderBoxSize.width()), -transformOriginY().calcFloatValue(borderBoxSize.height()), -transformOriginZ());
     812        transform.translate3d(-floatValueForLength(transformOriginX(), borderBoxSize.width()), -floatValueForLength(transformOriginY(), borderBoxSize.height()), -transformOriginZ());
    813813}
    814814
     
    822822   
    823823    if (applyTransformOrigin) {
    824         transform.translate3d(transformOriginX().calcFloatValue(boundingBox.width()) + offsetX,
    825                               transformOriginY().calcFloatValue(boundingBox.height()) + offsetY,
     824        transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
     825                              floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY,
    826826                              transformOriginZ());
    827827    }
     
    832832   
    833833    if (applyTransformOrigin) {
    834         transform.translate3d(-transformOriginX().calcFloatValue(boundingBox.width()) - offsetX,
    835                               -transformOriginY().calcFloatValue(boundingBox.height()) - offsetY,
     834        transform.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX,
     835                              -floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY,
    836836                              -transformOriginZ());
    837837    }
     
    878878{
    879879    return RoundedRect::Radii(
    880         IntSize(border.topLeft().width().calcValue(size.width()),
    881                 border.topLeft().height().calcValue(size.height())),
    882         IntSize(border.topRight().width().calcValue(size.width()),
    883                 border.topRight().height().calcValue(size.height())),
    884         IntSize(border.bottomLeft().width().calcValue(size.width()),
    885                 border.bottomLeft().height().calcValue(size.height())),
    886         IntSize(border.bottomRight().width().calcValue(size.width()),
    887                 border.bottomRight().height().calcValue(size.height())));
     880        IntSize(valueForLength(border.topLeft().width(), size.width()),
     881                valueForLength(border.topLeft().height(), size.height())),
     882        IntSize(valueForLength(border.topRight().width(), size.width()),
     883                valueForLength(border.topRight().height(), size.height())),
     884        IntSize(valueForLength(border.bottomLeft().width(), size.width()),
     885                valueForLength(border.bottomLeft().height(), size.height())),
     886        IntSize(valueForLength(border.bottomRight().width(), size.width()),
     887                valueForLength(border.bottomRight().height(), size.height())));
    888888}
    889889
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r111076 r111126  
    4040#include "Length.h"
    4141#include "LengthBox.h"
     42#include "LengthFunctions.h"
    4243#include "LengthSize.h"
    4344#include "LineClampValue.h"
     
    631632
    632633        if (lh.isPercent())
    633             return lh.calcMinValue(fontSize());
     634            return miminumValueForLength(lh, fontSize());
    634635
    635636        return lh.value();
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r110285 r111126  
    8888    if (intrinsicWidthAttribute.isFixed() || intrinsicHeightAttribute.isFixed()) {
    8989        if (intrinsicWidthAttribute.isFixed())
    90             intrinsicSize.setWidth(intrinsicWidthAttribute.calcFloatValue(0));
     90            intrinsicSize.setWidth(floatValueForLength(intrinsicWidthAttribute, 0));
    9191        if (intrinsicHeightAttribute.isFixed())
    92             intrinsicSize.setHeight(intrinsicHeightAttribute.calcFloatValue(0));
     92            intrinsicSize.setHeight(floatValueForLength(intrinsicHeightAttribute, 0));
    9393        if (!intrinsicSize.isEmpty())
    9494            intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height());
     
    154154static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize)
    155155{
    156     return static_cast<LayoutUnit>(length.calcValue(maxSize) * (length.isFixed() ? scale : 1));
     156    return static_cast<LayoutUnit>(valueForLength(length, maxSize) * (length.isFixed() ? scale : 1));
    157157}
    158158
  • trunk/Source/WebCore/svg/SVGSVGElement.cpp

    r108441 r111126  
    542542    // If no viewBox is specified but non-relative width/height values, then we
    543543    // should always synthesize a viewBox if we're embedded through a SVGImage.   
    544     return FloatRect(FloatPoint(), FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0)));
     544    return FloatRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)));
    545545}
    546546
     
    550550    Length intrinsicHeight = this->intrinsicHeight();
    551551    if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
    552         return FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0));
     552        return FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
    553553
    554554    if (!renderer())
  • trunk/Source/WebCore/svg/graphics/SVGImage.cpp

    r110581 r111126  
    294294    intrinsicRatio = rootElement->viewBox().size();
    295295    if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
    296         intrinsicRatio = FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0));
     296        intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
    297297}
    298298
  • trunk/Source/WebKit2/ChangeLog

    r111125 r111126  
     12012-03-17  Joe Thomas  <joethomas@motorola.com>
     2
     3        move calc*Value functions out from Length (and platform)
     4        https://bugs.webkit.org/show_bug.cgi?id=80897
     5
     6        Moving the Length calc*Value functions out from Length structure and also from /WebCore/platform/ folder.
     7        This helps to avoid the layering violation while length calculation. Otherwise layer violation can be avoided only by adding a virtual interface(bug 27160).
     8
     9        Reviewed by Antti Koivisto.
     10
     11        * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
     12        (WebKit::WebPopupMenu::setUpPlatformData):
     13
    1142012-03-17  Dan Bernstein  <mitz@apple.com>
    215
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp

    r95901 r111126  
    3030#include <WebCore/Font.h>
    3131#include <WebCore/GraphicsContext.h>
     32#include <WebCore/LengthFunctions.h>
    3233#include <WebCore/TextRun.h>
    3334#include <WebCore/PopupMenuClient.h>
     
    136137            int textX = std::max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft);
    137138            if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR)
    138                 textX += itemStyle.textIndent().calcMinValue(itemRect.width());
     139                textX += miminumValueForLength(itemStyle.textIndent(), itemRect.width());
    139140            int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2;
    140141
Note: See TracChangeset for help on using the changeset viewer.