Rename Length::isPercent() and Length::isPercentNotCalculated().
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 May 2015 21:43:26 +0000 (21:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 May 2015 21:43:26 +0000 (21:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144791

Patch by Sungmann Cho <sungmann.cho@navercorp.com> on 2015-05-10
Reviewed by Darin Adler.

1. Rename these methods as below for consistency and clarity.

Length::isPercentNotCalculated() => Length::isPercent()
Length::isPercent() => Length::isPercentOrCalculated()

2. Simplify the condition check of length type in SVGLengthContext::valueForLength().

"length.isPercent() && !length.isCalculated()" => "length.isPercent()"

No new tests, no behavior change.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForImageSliceSide):
(WebCore::valueForReflection):
(WebCore::percentageOrZoomAdjustedValue):
(WebCore::lineHeightFromStyle):
(WebCore::ComputedStyleExtractor::propertyValue):
* html/HTMLPlugInImageElement.cpp:
(WebCore::is100Percent):
* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::computeTransformedExtentViaTransformList):
* platform/Length.h:
(WebCore::Length::percent):
(WebCore::Length::isPercent):
(WebCore::Length::isPercentOrCalculated):
(WebCore::Length::isSpecified):
(WebCore::Length::isPercentNotCalculated): Deleted.
* platform/graphics/transforms/TranslateTransformOperation.h:
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):
(WebCore::AutoTableLayout::fullRecalc):
(WebCore::shouldScaleColumns):
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
(WebCore::AutoTableLayout::layout):
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::calcWidthArray):
(WebCore::FixedTableLayout::applyPreferredLogicalWidthQuirks):
(WebCore::FixedTableLayout::layout):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::isSelfCollapsingBlock):
(WebCore::RenderBlock::textIndentOffset):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::needsPreferredWidthsRecalculation):
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
(WebCore::RenderBox::computePercentageLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth):
(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::availableLogicalHeightUsing):
(WebCore::logicalWidthIsResolvable):
(WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
(WebCore::RenderBox::hasUnsplittableScrollingOverflow):
(WebCore::RenderBox::layoutOverflowRectForPropagation):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight):
(WebCore::RenderBoxModelObject::relativePositionOffset):
(WebCore::RenderBoxModelObject::computedCSSPadding):
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
(WebCore::RenderBoxModelObject::calculateFillTileSize):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
(WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
* rendering/RenderElement.cpp:
(WebCore::mustRepaintFillLayers):
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::layOutAxis):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::repaintOrMarkForLayout):
* rendering/RenderInline.cpp:
(WebCore::computeMargin):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::computeIntrinsicLogicalWidths):
* rendering/RenderMenuList.cpp:
(RenderMenuList::computeIntrinsicLogicalWidths):
* rendering/RenderObject.cpp:
(WebCore::objectIsRelayoutBoundary):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computePreferredLogicalWidths):
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::computeIntrinsicLogicalWidths):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::computeIntrinsicLogicalWidths):
* rendering/RenderView.cpp:
(WebCore::RenderView::layout):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::verticalPositionForBox):
* rendering/style/GridLength.h:
(WebCore::GridLength::isPercentage):
* rendering/style/GridTrackSize.h:
(WebCore::GridTrackSize::isPercentage):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::computedLineHeight):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::hasRelativeDimensions):
* svg/SVGLengthContext.cpp:
(WebCore::SVGLengthContext::valueForLength):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::hasRelativeWidth):
(WebCore::SVGImage::hasRelativeHeight):

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

33 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/platform/Length.h
Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
Source/WebCore/rendering/AutoTableLayout.cpp
Source/WebCore/rendering/FixedTableLayout.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderFileUploadControl.cpp
Source/WebCore/rendering/RenderFrameSet.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderSlider.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/style/GridLength.h
Source/WebCore/rendering/style/GridTrackSize.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/svg/SVGLengthContext.cpp
Source/WebCore/svg/graphics/SVGImage.cpp

index 680d6c0..9321bfc 100644 (file)
@@ -1,5 +1,120 @@
 2015-05-10  Sungmann Cho  <sungmann.cho@navercorp.com>
 
+        Rename Length::isPercent() and Length::isPercentNotCalculated().
+        https://bugs.webkit.org/show_bug.cgi?id=144791
+
+        Reviewed by Darin Adler.
+
+        1. Rename these methods as below for consistency and clarity.
+
+        Length::isPercentNotCalculated() => Length::isPercent()
+        Length::isPercent() => Length::isPercentOrCalculated()
+
+        2. Simplify the condition check of length type in SVGLengthContext::valueForLength().
+
+        "length.isPercent() && !length.isCalculated()" => "length.isPercent()"
+
+        No new tests, no behavior change.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::valueForImageSliceSide):
+        (WebCore::valueForReflection):
+        (WebCore::percentageOrZoomAdjustedValue):
+        (WebCore::lineHeightFromStyle):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::is100Percent):
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::computeTransformedExtentViaTransformList):
+        * platform/Length.h:
+        (WebCore::Length::percent):
+        (WebCore::Length::isPercent):
+        (WebCore::Length::isPercentOrCalculated):
+        (WebCore::Length::isSpecified):
+        (WebCore::Length::isPercentNotCalculated): Deleted.
+        * platform/graphics/transforms/TranslateTransformOperation.h:
+        * rendering/AutoTableLayout.cpp:
+        (WebCore::AutoTableLayout::recalcColumn):
+        (WebCore::AutoTableLayout::fullRecalc):
+        (WebCore::shouldScaleColumns):
+        (WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
+        (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
+        (WebCore::AutoTableLayout::layout):
+        * rendering/FixedTableLayout.cpp:
+        (WebCore::FixedTableLayout::calcWidthArray):
+        (WebCore::FixedTableLayout::applyPreferredLogicalWidthQuirks):
+        (WebCore::FixedTableLayout::layout):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::isSelfCollapsingBlock):
+        (WebCore::RenderBlock::textIndentOffset):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::needsPreferredWidthsRecalculation):
+        (WebCore::RenderBox::computeLogicalHeight):
+        (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth):
+        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+        (WebCore::RenderBox::availableLogicalHeightUsing):
+        (WebCore::logicalWidthIsResolvable):
+        (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
+        (WebCore::RenderBox::hasUnsplittableScrollingOverflow):
+        (WebCore::RenderBox::layoutOverflowRectForPropagation):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight):
+        (WebCore::RenderBoxModelObject::relativePositionOffset):
+        (WebCore::RenderBoxModelObject::computedCSSPadding):
+        (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
+        (WebCore::RenderBoxModelObject::calculateFillTileSize):
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+        (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
+        * rendering/RenderElement.cpp:
+        (WebCore::mustRepaintFillLayers):
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths):
+        * rendering/RenderFrameSet.cpp:
+        (WebCore::RenderFrameSet::layOutAxis):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::repaintOrMarkForLayout):
+        * rendering/RenderInline.cpp:
+        (WebCore::computeMargin):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::computeIntrinsicLogicalWidths):
+        * rendering/RenderMenuList.cpp:
+        (RenderMenuList::computeIntrinsicLogicalWidths):
+        * rendering/RenderObject.cpp:
+        (WebCore::objectIsRelayoutBoundary):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::computePreferredLogicalWidths):
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::computeIntrinsicLogicalWidths):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::layoutRows):
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::computeIntrinsicLogicalWidths):
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::layout):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::verticalPositionForBox):
+        * rendering/style/GridLength.h:
+        (WebCore::GridLength::isPercentage):
+        * rendering/style/GridTrackSize.h:
+        (WebCore::GridTrackSize::isPercentage):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::computedLineHeight):
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::hasRelativeDimensions):
+        * svg/SVGLengthContext.cpp:
+        (WebCore::SVGLengthContext::valueForLength):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::hasRelativeWidth):
+        (WebCore::SVGImage::hasRelativeHeight):
+
+2015-05-10  Sungmann Cho  <sungmann.cho@navercorp.com>
+
         Remove unnecessary semicolons.
         https://bugs.webkit.org/show_bug.cgi?id=144844
 
index d89ac42..e7b38a4 100644 (file)
@@ -483,7 +483,7 @@ static Ref<CSSPrimitiveValue> valueForImageSliceSide(const Length& length)
 {
     // These values can be percentages, numbers, or while an animation of mixed types is in progress,
     // a calculation that combines a percentage and a number.
-    if (length.isPercentNotCalculated())
+    if (length.isPercent())
         return cssValuePool().createValue(length.percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
     if (length.isFixed())
         return cssValuePool().createValue(length.value(), CSSPrimitiveValue::CSS_NUMBER);
@@ -646,7 +646,7 @@ static Ref<CSSValue> valueForReflection(const StyleReflection* reflection, const
         return cssValuePool().createIdentifierValue(CSSValueNone);
 
     RefPtr<CSSPrimitiveValue> offset;
-    if (reflection->offset().isPercent())
+    if (reflection->offset().isPercentOrCalculated())
         offset = cssValuePool().createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
     else
         offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
@@ -736,7 +736,7 @@ PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::currentColorOrValidColor(R
 
 static Ref<CSSPrimitiveValue> percentageOrZoomAdjustedValue(Length length, const RenderStyle* style)
 {
-    if (length.isPercentNotCalculated())
+    if (length.isPercent())
         return cssValuePool().createValue(length.percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
     
     return zoomAdjustedPixelValue(valueForLength(length, 0), style);
@@ -1559,7 +1559,7 @@ static Ref<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style)
     Length length = style->lineHeight();
     if (length.isNegative()) // If true, line-height not set; use the font's line spacing.
         return zoomAdjustedPixelValue(style->fontMetrics().floatLineSpacing(), style);
-    if (length.isPercentNotCalculated()) {
+    if (length.isPercent()) {
         // This is imperfect, because it doesn't include the zoom factor and the real computation
         // for how high to be in pixels does include things like minimum font size and the zoom factor.
         // On the other hand, since font-size doesn't include the zoom factor, we really can't do
@@ -2429,7 +2429,7 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
             if (marginRight.isFixed() || !is<RenderBox>(renderer))
                 return zoomAdjustedPixelValueForLength(marginRight, style.get());
             float value;
-            if (marginRight.isPercent()) {
+            if (marginRight.isPercentOrCalculated()) {
                 // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
                 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
                 // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
index 1190513..22a6771 100644 (file)
@@ -571,7 +571,7 @@ void HTMLPlugInImageElement::checkSizeChangeForSnapshotting()
 
 static inline bool is100Percent(Length length)
 {
-    return length.isPercentNotCalculated() && length.percent() == 100;
+    return length.isPercent() && length.percent() == 100;
 }
     
 static inline bool isSmallerThanTinySizingThreshold(const RenderEmbeddedObject& renderer)
index 520c771..f79e7c5 100644 (file)
@@ -778,8 +778,8 @@ bool AnimationBase::computeTransformedExtentViaTransformList(const FloatRect& re
     
     bool applyTransformOrigin = containsRotation(style.transform().operations()) || style.transform().affectedByTransformOrigin();
     if (applyTransformOrigin) {
-        float offsetX = style.transformOriginX().isPercentNotCalculated() ? rendererBox.x() : 0;
-        float offsetY = style.transformOriginY().isPercentNotCalculated() ? rendererBox.y() : 0;
+        float offsetX = style.transformOriginX().isPercent() ? rendererBox.x() : 0;
+        float offsetY = style.transformOriginY().isPercent() ? rendererBox.y() : 0;
 
         transformOrigin.setX(floatValueForLength(style.transformOriginX(), rendererBox.width()) + offsetX);
         transformOrigin.setY(floatValueForLength(style.transformOriginY(), rendererBox.height()) + offsetY);
index 3a946cb..9c8d08a 100644 (file)
@@ -84,7 +84,7 @@ public:
     bool isFixed() const;
     bool isMaxContent() const;
     bool isMinContent() const;
-    bool isPercentNotCalculated() const; // FIXME: Rename to isPercent.
+    bool isPercent() const;
     bool isRelative() const;
     bool isUndefined() const;
 
@@ -98,7 +98,7 @@ public:
     bool isPositive() const;
     bool isNegative() const;
 
-    bool isPercent() const; // Returns true for both Percent and Calculated. FIXME: Find a better name for this.
+    bool isPercentOrCalculated() const; // Returns true for both Percent and Calculated.
 
     bool isIntrinsic() const;
     bool isIntrinsicOrAuto() const;
@@ -260,7 +260,7 @@ inline int Length::intValue() const
 
 inline float Length::percent() const
 {
-    ASSERT(isPercentNotCalculated());
+    ASSERT(isPercent());
     return value();
 }
 
@@ -333,7 +333,7 @@ inline bool Length::isNegative() const
     return m_isFloat ? (m_floatValue < 0) : (m_intValue < 0);
 }
 
-inline bool Length::isPercentNotCalculated() const
+inline bool Length::isPercent() const
 {
     return type() == Percent;
 }
@@ -348,9 +348,9 @@ inline bool Length::isUndefined() const
     return type() == Undefined;
 }
 
-inline bool Length::isPercent() const
+inline bool Length::isPercentOrCalculated() const
 {
-    return isPercentNotCalculated() || isCalculated();
+    return isPercent() || isCalculated();
 }
 
 inline bool Length::isPositive() const
@@ -392,7 +392,7 @@ inline bool Length::isIntrinsicOrAuto() const
 
 inline bool Length::isSpecified() const
 {
-    return isFixed() || isPercent();
+    return isFixed() || isPercentOrCalculated();
 }
 
 inline bool Length::isSpecifiedOrIntrinsic() const
index 3290fa4..0e529f9 100644 (file)
@@ -67,7 +67,7 @@ private:
     virtual bool apply(TransformationMatrix& transform, const FloatSize& borderBoxSize) const override
     {
         transform.translate3d(x(borderBoxSize), y(borderBoxSize), z(borderBoxSize));
-        return m_x.isPercentNotCalculated() || m_y.isPercentNotCalculated();
+        return m_x.isPercent() || m_y.isPercent();
     }
 
     virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
index 4d88362..1aeaded 100644 (file)
@@ -92,7 +92,7 @@ void AutoTableLayout::recalcColumn(unsigned effCol)
                     switch (cellLogicalWidth.type()) {
                     case Fixed:
                         // ignore width=0
-                        if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.isPercent()) {
+                        if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.isPercentOrCalculated()) {
                             int logicalWidth = cell->adjustBorderBoxLogicalWidthForBoxSizing(cellLogicalWidth.value());
                             if (columnLayout.logicalWidth.isFixed()) {
                                 // Nav/IE weirdness
@@ -109,7 +109,7 @@ void AutoTableLayout::recalcColumn(unsigned effCol)
                         break;
                     case Percent:
                         m_hasPercent = true;
-                        if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercentNotCalculated() || cellLogicalWidth.percent() > columnLayout.logicalWidth.percent()))
+                        if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.percent() > columnLayout.logicalWidth.percent()))
                             columnLayout.logicalWidth = cellLogicalWidth;
                         break;
                     case Relative:
@@ -159,7 +159,7 @@ void AutoTableLayout::fullRecalc()
             Length colLogicalWidth = column->style().logicalWidth();
             if (colLogicalWidth.isAuto())
                 colLogicalWidth = groupLogicalWidth;
-            if ((colLogicalWidth.isFixed() || colLogicalWidth.isPercent()) && colLogicalWidth.isZero())
+            if ((colLogicalWidth.isFixed() || colLogicalWidth.isPercentOrCalculated()) && colLogicalWidth.isZero())
                 colLogicalWidth = Length();
             unsigned effCol = m_table->colToEffCol(currentColumn);
             unsigned span = column->span();
@@ -188,7 +188,7 @@ static bool shouldScaleColumns(RenderTable* table)
     bool scale = true;
     while (table) {
         Length tableWidth = table->style().width();
-        if ((tableWidth.isAuto() || tableWidth.isPercent()) && !table->isOutOfFlowPositioned()) {
+        if ((tableWidth.isAuto() || tableWidth.isPercentOrCalculated()) && !table->isOutOfFlowPositioned()) {
             RenderBlock* containingBlock = table->containingBlock();
             while (containingBlock && !is<RenderView>(*containingBlock) && !is<RenderTableCell>(*containingBlock)
                 && containingBlock->style().width().isAuto() && !containingBlock->isOutOfFlowPositioned())
@@ -196,7 +196,7 @@ static bool shouldScaleColumns(RenderTable* table)
 
             table = nullptr;
             if (is<RenderTableCell>(containingBlock)
-                && (containingBlock->style().width().isAuto() || containingBlock->style().width().isPercent())) {
+                && (containingBlock->style().width().isAuto() || containingBlock->style().width().isPercentOrCalculated())) {
                 RenderTableCell& cell = downcast<RenderTableCell>(*containingBlock);
                 if (cell.colSpan() > 1 || cell.table()->style().width().isAuto())
                     scale = false;
@@ -230,7 +230,7 @@ void AutoTableLayout::computeIntrinsicLogicalWidths(LayoutUnit& minWidth, Layout
         minWidth += m_layoutStruct[i].effectiveMinLogicalWidth;
         maxWidth += m_layoutStruct[i].effectiveMaxLogicalWidth;
         if (scaleColumns) {
-            if (m_layoutStruct[i].effectiveLogicalWidth.isPercentNotCalculated()) {
+            if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) {
                 float percent = std::min(m_layoutStruct[i].effectiveLogicalWidth.percent(), remainingPercent);
                 float logicalWidth = static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) * 100 / std::max(percent, epsilon);
                 maxPercent = std::max(logicalWidth,  maxPercent);
@@ -323,7 +323,7 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
                 //   <tr><td>1</td><td colspan=2>2-3</tr>
                 //   <tr><td>1</td><td colspan=2 width=100%>2-3</td></tr>
                 // </table>
-                if (!columnLayout.effectiveLogicalWidth.isPercentNotCalculated()) {
+                if (!columnLayout.effectiveLogicalWidth.isPercent()) {
                     columnLayout.effectiveLogicalWidth = Length();
                     allColsArePercent = false;
                 } else
@@ -341,7 +341,7 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
         }
 
         // adjust table max width if needed
-        if (cellLogicalWidth.isPercentNotCalculated()) {
+        if (cellLogicalWidth.isPercent()) {
             if (totalPercent > cellLogicalWidth.percent() || allColsArePercent) {
                 // can't satify this condition, treat as variable
                 cellLogicalWidth = Length();
@@ -352,12 +352,12 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
                 float percentMissing = cellLogicalWidth.percent() - totalPercent;
                 int totalWidth = 0;
                 for (unsigned pos = effCol; pos < lastCol; ++pos) {
-                    if (!m_layoutStruct[pos].effectiveLogicalWidth.isPercent())
+                    if (!m_layoutStruct[pos].effectiveLogicalWidth.isPercentOrCalculated())
                         totalWidth += m_layoutStruct[pos].effectiveMaxLogicalWidth;
                 }
 
                 for (unsigned pos = effCol; pos < lastCol && totalWidth > 0; ++pos) {
-                    if (!m_layoutStruct[pos].effectiveLogicalWidth.isPercent()) {
+                    if (!m_layoutStruct[pos].effectiveLogicalWidth.isPercentOrCalculated()) {
                         float percent = percentMissing * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / totalWidth;
                         totalWidth -= m_layoutStruct[pos].effectiveMaxLogicalWidth;
                         percentMissing -= percent;
@@ -384,9 +384,9 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
                 int allocatedMinLogicalWidth = 0;
                 int allocatedMaxLogicalWidth = 0;
                 for (unsigned pos = effCol; pos < lastCol; ++pos) {
-                    ASSERT(m_layoutStruct[pos].logicalWidth.isPercentNotCalculated() || m_layoutStruct[pos].effectiveLogicalWidth.isPercentNotCalculated());
+                    ASSERT(m_layoutStruct[pos].logicalWidth.isPercent() || m_layoutStruct[pos].effectiveLogicalWidth.isPercent());
                     // |allColsArePercent| means that either the logicalWidth *or* the effectiveLogicalWidth are percents, handle both of them here.
-                    float percent = m_layoutStruct[pos].logicalWidth.isPercentNotCalculated() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLogicalWidth.percent();
+                    float percent = m_layoutStruct[pos].logicalWidth.isPercent() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLogicalWidth.percent();
                     int columnMinLogicalWidth = static_cast<int>(percent * cellMinLogicalWidth / totalPercent);
                     int columnMaxLogicalWidth = static_cast<int>(percent * cellMaxLogicalWidth / totalPercent);
                     m_layoutStruct[pos].effectiveMinLogicalWidth = std::max(m_layoutStruct[pos].effectiveMinLogicalWidth, columnMinLogicalWidth);
@@ -426,7 +426,7 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
                 }
             }
         }
-        if (!cellLogicalWidth.isPercent()) {
+        if (!cellLogicalWidth.isPercentOrCalculated()) {
             if (cellMaxLogicalWidth > spanMaxLogicalWidth) {
                 for (unsigned pos = effCol; spanMaxLogicalWidth >= 0 && pos < lastCol; ++pos) {
                     int colMaxLogicalWidth = std::max(m_layoutStruct[pos].effectiveMaxLogicalWidth, static_cast<int>(spanMaxLogicalWidth ? cellMaxLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / spanMaxLogicalWidth : cellMaxLogicalWidth));
@@ -541,7 +541,7 @@ void AutoTableLayout::layout()
     if (available > 0 && havePercent) {
         for (size_t i = 0; i < nEffCols; ++i) {
             Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
-            if (logicalWidth.isPercent()) {
+            if (logicalWidth.isPercentOrCalculated()) {
                 int cellLogicalWidth = std::max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, minimumValueForLength(logicalWidth, tableLogicalWidth));
                 available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth;
                 m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
@@ -552,7 +552,7 @@ void AutoTableLayout::layout()
             int excess = tableLogicalWidth * (totalPercent - 100) / 100;
             for (unsigned i = nEffCols; i; ) {
                 --i;
-                if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) {
+                if (m_layoutStruct[i].effectiveLogicalWidth.isPercentOrCalculated()) {
                     int cellLogicalWidth = m_layoutStruct[i].computedLogicalWidth;
                     int reduction = std::min(cellLogicalWidth,  excess);
                     // the lines below might look inconsistent, but that's the way it's handled in mozilla
@@ -620,7 +620,7 @@ void AutoTableLayout::layout()
     if (available > 0 && m_hasPercent && totalPercent < 100) {
         for (size_t i = 0; i < nEffCols; ++i) {
             Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
-            if (logicalWidth.isPercentNotCalculated()) {
+            if (logicalWidth.isPercent()) {
                 int cellLogicalWidth = available * logicalWidth.percent() / totalPercent;
                 available -= cellLogicalWidth;
                 totalPercent -= logicalWidth.percent();
@@ -733,14 +733,14 @@ void AutoTableLayout::layout()
             for (unsigned i = nEffCols; i; ) {
                 --i;
                 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
-                if (logicalWidth.isPercent())
+                if (logicalWidth.isPercentOrCalculated())
                     logicalWidthBeyondMin += m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
             }
             
             for (unsigned i = nEffCols; i && logicalWidthBeyondMin > 0; ) {
                 --i;
                 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
-                if (logicalWidth.isPercent()) {
+                if (logicalWidth.isPercentOrCalculated()) {
                     int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
                     int reduce = available * minMaxDiff / logicalWidthBeyondMin;
                     m_layoutStruct[i].computedLogicalWidth += reduce;
index f08d29a..4b54a3e 100644 (file)
@@ -117,7 +117,7 @@ int FixedTableLayout::calcWidthArray()
                 }
                 spanInCurrentEffectiveColumn = m_table->spanOfEffCol(currentEffectiveColumn);
             }
-            if ((colStyleLogicalWidth.isFixed() || colStyleLogicalWidth.isPercent()) && colStyleLogicalWidth.isPositive()) {
+            if ((colStyleLogicalWidth.isFixed() || colStyleLogicalWidth.isPercentOrCalculated()) && colStyleLogicalWidth.isPositive()) {
                 m_width[currentEffectiveColumn] = colStyleLogicalWidth;
                 m_width[currentEffectiveColumn] *= spanInCurrentEffectiveColumn;
                 usedWidth += effectiveColWidth * spanInCurrentEffectiveColumn;
@@ -192,7 +192,7 @@ void FixedTableLayout::applyPreferredLogicalWidthQuirks(LayoutUnit& minWidth, La
     // In this example, the two inner tables should be as large as the outer table. 
     // We can achieve this effect by making the maxwidth of fixed tables with percentage
     // widths be infinite.
-    if (m_table->style().logicalWidth().isPercent() && maxWidth < tableMaxWidth)
+    if (m_table->style().logicalWidth().isPercentOrCalculated() && maxWidth < tableMaxWidth)
         maxWidth = tableMaxWidth;
 }
 
@@ -225,7 +225,7 @@ void FixedTableLayout::layout()
         if (m_width[i].isFixed()) {
             calcWidth[i] = m_width[i].value();
             totalFixedWidth += calcWidth[i];
-        } else if (m_width[i].isPercentNotCalculated()) {
+        } else if (m_width[i].isPercent()) {
             calcWidth[i] = valueForLength(m_width[i], tableLogicalWidth);
             totalPercentWidth += calcWidth[i];
             totalPercent += m_width[i].percent();
@@ -254,7 +254,7 @@ void FixedTableLayout::layout()
             if (totalPercent) {
                 totalPercentWidth = 0;
                 for (unsigned i = 0; i < nEffCols; i++) {
-                    if (m_width[i].isPercentNotCalculated()) {
+                    if (m_width[i].isPercent()) {
                         calcWidth[i] = m_width[i].percent() * (tableLogicalWidth - totalFixedWidth) / totalPercent;
                         totalPercentWidth += calcWidth[i];
                     }
index d2dda4d..18f9469 100644 (file)
@@ -811,7 +811,7 @@ bool RenderBlock::isSelfCollapsingBlock() const
 
     Length logicalHeightLength = style().logicalHeight();
     bool hasAutoHeight = logicalHeightLength.isAuto();
-    if (logicalHeightLength.isPercent() && !document().inQuirksMode()) {
+    if (logicalHeightLength.isPercentOrCalculated() && !document().inQuirksMode()) {
         hasAutoHeight = true;
         for (RenderBlock* cb = containingBlock(); !cb->isRenderView(); cb = cb->containingBlock()) {
             if (cb->style().logicalHeight().isFixed() || cb->isTableCell())
@@ -821,7 +821,7 @@ bool RenderBlock::isSelfCollapsingBlock() const
 
     // If the height is 0 or auto, then whether or not we are a self-collapsing block depends
     // on whether we have content that is all self-collapsing or not.
-    if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercent()) && logicalHeightLength.isZero())) {
+    if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercentOrCalculated()) && logicalHeightLength.isZero())) {
         // If the block has inline children, see if we generated any line boxes.  If we have any
         // line boxes, then we can't be self-collapsing, since we have content.
         if (childrenInline())
@@ -2256,7 +2256,7 @@ void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox& parent)
 LayoutUnit RenderBlock::textIndentOffset() const
 {
     LayoutUnit cw = 0;
-    if (style().textIndent().isPercent())
+    if (style().textIndent().isPercentOrCalculated())
         cw = containingBlock()->availableLogicalWidth();
     return minimumValueForLength(style().textIndent(), cw);
 }
index c42e494..815c43b 100644 (file)
@@ -978,7 +978,7 @@ bool RenderBox::hasHorizontalScrollbarWithAutoBehavior() const
 
 bool RenderBox::needsPreferredWidthsRecalculation() const
 {
-    return style().paddingStart().isPercent() || style().paddingEnd().isPercent();
+    return style().paddingStart().isPercentOrCalculated() || style().paddingEnd().isPercentOrCalculated();
 }
 
 IntSize RenderBox::scrolledContentOffset() const
@@ -2782,8 +2782,8 @@ void RenderBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logica
     // is specified. When we're printing, we also need this quirk if the body or root has a percentage 
     // height since we don't set a height in RenderView when we're printing. So without this quirk, the 
     // height has nothing to be a percentage of, and it ends up being 0. That is bad.
-    bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercent()
-        && (isRoot() || (isBody() && document().documentElement()->renderer()->style().logicalHeight().isPercent())) && !isInline();
+    bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercentOrCalculated()
+        && (isRoot() || (isBody() && document().documentElement()->renderer()->style().logicalHeight().isPercentOrCalculated())) && !isInline();
     if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
         LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
         LayoutUnit visibleHeight = view().pageOrViewLogicalHeight();
@@ -2816,7 +2816,7 @@ LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length&
 {
     if (height.isFixed())
         return height.value();
-    if (height.isPercent())
+    if (height.isPercentOrCalculated())
         return computePercentageLogicalHeight(height);
     return -1;
 }
@@ -2891,7 +2891,7 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const
     } else if (cbstyle.logicalHeight().isFixed()) {
         LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle.logicalHeight().value());
         availableHeight = std::max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight()));
-    } else if (cbstyle.logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) {
+    } else if (cbstyle.logicalHeight().isPercentOrCalculated() && !isOutOfFlowPositionedWithSpecifiedHeight) {
         // We need to recur and compute the percentage height for our containing block.
         LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle.logicalHeight());
         if (heightWithScrollbar != -1) {
@@ -2936,8 +2936,8 @@ LayoutUnit RenderBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC
 
 LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred shouldComputePreferred) const
 {
-    LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMinWidth().isPercent()) || style().logicalMinWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style().logicalMinWidth());
-    LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMaxWidth().isPercent()) || style().logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style().logicalMaxWidth());
+    LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMinWidth().isPercentOrCalculated()) || style().logicalMinWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style().logicalMinWidth());
+    LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMaxWidth().isPercentOrCalculated()) || style().logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style().logicalMaxWidth());
     return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth));
 }
 
@@ -2965,7 +2965,7 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) cons
             // https://bugs.webkit.org/show_bug.cgi?id=91071
             if (logicalWidth.isIntrinsic())
                 return computeIntrinsicLogicalWidthUsing(logicalWidth, cw, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth();
-            if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercent())))
+            if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercentOrCalculated())))
                 return adjustContentBoxLogicalWidthForBoxSizing(minimumValueForLength(logicalWidth, cw));
         }
         FALLTHROUGH;
@@ -3032,7 +3032,7 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co
                 // table cells using percentage heights.
                 // FIXME: This needs to be made block-flow-aware.  If the cell and image are perpendicular block-flows, this isn't right.
                 // https://bugs.webkit.org/show_bug.cgi?id=46997
-                while (cb && !cb->isRenderView() && (cb->style().logicalHeight().isAuto() || cb->style().logicalHeight().isPercent())) {
+                while (cb && !cb->isRenderView() && (cb->style().logicalHeight().isAuto() || cb->style().logicalHeight().isPercentOrCalculated())) {
                     if (cb->isTableCell()) {
                         // Don't let table cells squeeze percent-height replaced elements
                         // <http://bugs.webkit.org/show_bug.cgi?id=15359>
@@ -3060,13 +3060,13 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogi
     // We need to stop here, since we don't want to increase the height of the table
     // artificially.  We're going to rely on this cell getting expanded to some new
     // height, and then when we lay out again we'll use the calculation below.
-    if (isTableCell() && (h.isAuto() || h.isPercent())) {
+    if (isTableCell() && (h.isAuto() || h.isPercentOrCalculated())) {
         if (hasOverrideLogicalContentHeight())
             return overrideLogicalContentHeight();
         return logicalHeight() - borderAndPaddingLogicalHeight();
     }
 
-    if (h.isPercent() && isOutOfFlowPositioned() && !isRenderFlowThread()) {
+    if (h.isPercentOrCalculated() && isOutOfFlowPositioned() && !isRenderFlowThread()) {
         // FIXME: This is wrong if the containingBlock has a perpendicular writing mode.
         LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(containingBlock());
         return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight));
@@ -4498,7 +4498,7 @@ static bool logicalWidthIsResolvable(const RenderBox& renderBox)
     if (box->hasOverrideContainingBlockLogicalWidth())
         return box->overrideContainingBlockContentLogicalWidth() != -1;
 #endif
-    if (box->style().logicalWidth().isPercent())
+    if (box->style().logicalWidth().isPercentOrCalculated())
         return logicalWidthIsResolvable(*box->containingBlock());
 
     return false;
@@ -4550,7 +4550,7 @@ bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock*
     // height.
     if (cb->style().logicalHeight().isFixed())
         return true;
-    if (cb->style().logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight)
+    if (cb->style().logicalHeight().isPercentOrCalculated() && !isOutOfFlowPositionedWithSpecifiedHeight)
         return percentageLogicalHeightIsResolvableFromBlock(cb->containingBlock(), cb->isOutOfFlowPositioned());
     if (cb->isRenderView() || inQuirksMode || isOutOfFlowPositionedWithSpecifiedHeight)
         return true;
@@ -4595,8 +4595,8 @@ bool RenderBox::hasUnsplittableScrollingOverflow() const
     // conditions, but it should work out to be good enough for common cases. Paginating overflow
     // with scrollbars present is not the end of the world and is what we used to do in the old model anyway.
     return !style().logicalHeight().isIntrinsicOrAuto()
-        || (!style().logicalMaxHeight().isIntrinsicOrAuto() && !style().logicalMaxHeight().isUndefined() && (!style().logicalMaxHeight().isPercent() || percentageLogicalHeightIsResolvable(this)))
-        || (!style().logicalMinHeight().isIntrinsicOrAuto() && style().logicalMinHeight().isPositive() && (!style().logicalMinHeight().isPercent() || percentageLogicalHeightIsResolvable(this)));
+        || (!style().logicalMaxHeight().isIntrinsicOrAuto() && !style().logicalMaxHeight().isUndefined() && (!style().logicalMaxHeight().isPercentOrCalculated() || percentageLogicalHeightIsResolvable(this)))
+        || (!style().logicalMinHeight().isIntrinsicOrAuto() && style().logicalMinHeight().isPositive() && (!style().logicalMinHeight().isPercentOrCalculated() || percentageLogicalHeightIsResolvable(this)));
 }
 
 bool RenderBox::isUnsplittableForPagination() const
@@ -4869,23 +4869,23 @@ void RenderBox::applyTopLeftLocationOffsetWithFlipping(LayoutPoint& point) const
 
 bool RenderBox::hasRelativeDimensions() const
 {
-    return style().height().isPercent() || style().width().isPercent()
-            || style().maxHeight().isPercent() || style().maxWidth().isPercent()
-            || style().minHeight().isPercent() || style().minWidth().isPercent();
+    return style().height().isPercentOrCalculated() || style().width().isPercentOrCalculated()
+        || style().maxHeight().isPercentOrCalculated() || style().maxWidth().isPercentOrCalculated()
+        || style().minHeight().isPercentOrCalculated() || style().minWidth().isPercentOrCalculated();
 }
 
 bool RenderBox::hasRelativeLogicalHeight() const
 {
-    return style().logicalHeight().isPercent()
-            || style().logicalMinHeight().isPercent()
-            || style().logicalMaxHeight().isPercent();
+    return style().logicalHeight().isPercentOrCalculated()
+        || style().logicalMinHeight().isPercentOrCalculated()
+        || style().logicalMaxHeight().isPercentOrCalculated();
 }
 
 bool RenderBox::hasRelativeLogicalWidth() const
 {
-    return style().logicalWidth().isPercent()
-        || style().logicalMinWidth().isPercent()
-        || style().logicalMaxWidth().isPercent();
+    return style().logicalWidth().isPercentOrCalculated()
+        || style().logicalMinWidth().isPercentOrCalculated()
+        || style().logicalMaxWidth().isPercentOrCalculated();
 }
 
 static void markBoxForRelayoutAfterSplit(RenderBox& box)
index db982f8..a33bced 100644 (file)
@@ -244,7 +244,7 @@ bool RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const
     // For percentage heights: The percentage is calculated with respect to the height of the generated box's
     // containing block. If the height of the containing block is not specified explicitly (i.e., it depends
     // on content height), and this element is not absolutely positioned, the value computes to 'auto'.
-    if (!logicalHeightLength.isPercent() || isOutOfFlowPositioned() || document().inQuirksMode())
+    if (!logicalHeightLength.isPercentOrCalculated() || isOutOfFlowPositioned() || document().inQuirksMode())
         return false;
 
     // Anonymous block boxes are ignored when resolving percentage values that would refer to it:
@@ -299,13 +299,13 @@ LayoutSize RenderBoxModelObject::relativePositionOffset() const
     // calculate the percent offset based on this height.
     // See <https://bugs.webkit.org/show_bug.cgi?id=26396>.
     if (!style().top().isAuto()
-        && (!style().top().isPercent()
+        && (!style().top().isPercentOrCalculated()
             || !containingBlock()->hasAutoHeightOrContainingBlockWithAutoHeight()
             || containingBlock()->stretchesToViewport()))
         offset.expand(0, valueForLength(style().top(), !style().top().isFixed() ? containingBlock()->availableHeight() : LayoutUnit()));
 
     else if (!style().bottom().isAuto()
-        && (!style().bottom().isPercent()
+        && (!style().bottom().isPercentOrCalculated()
             || !containingBlock()->hasAutoHeightOrContainingBlockWithAutoHeight()
             || containingBlock()->stretchesToViewport()))
         offset.expand(0, -valueForLength(style().bottom(), !style().bottom().isFixed() ? containingBlock()->availableHeight() : LayoutUnit()));
@@ -519,7 +519,7 @@ int RenderBoxModelObject::pixelSnappedOffsetHeight() const
 LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding) const
 {
     LayoutUnit w = 0;
-    if (padding.isPercent())
+    if (padding.isPercentOrCalculated())
         w = containingBlockLogicalWidthForContent();
     return minimumValueForLength(padding, w);
 }
@@ -932,8 +932,8 @@ LayoutSize RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* i
     FloatSize intrinsicRatio;
     image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, intrinsicRatio);
 
-    ASSERT(!intrinsicWidth.isPercent());
-    ASSERT(!intrinsicHeight.isPercent());
+    ASSERT(!intrinsicWidth.isPercentOrCalculated());
+    ASSERT(!intrinsicHeight.isPercentOrCalculated());
 
     LayoutSize resolvedSize(intrinsicWidth.value(), intrinsicHeight.value());
     LayoutSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height() > 0 ? 1 : 0);
@@ -983,12 +983,12 @@ LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer& fillLaye
 
             if (layerWidth.isFixed())
                 tileSize.setWidth(layerWidth.value());
-            else if (layerWidth.isPercent())
+            else if (layerWidth.isPercentOrCalculated())
                 tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.width()));
             
             if (layerHeight.isFixed())
                 tileSize.setHeight(layerHeight.value());
-            else if (layerHeight.isPercent())
+            else if (layerHeight.isPercentOrCalculated())
                 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.height()));
 
             // If one of the values is auto we have to use the appropriate
index 52b4a3f..db6e099 100644 (file)
@@ -934,7 +934,7 @@ void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool
             continue;
 
         child->clearOverrideSize();
-        if (relayoutChildren || (child->isReplaced() && (child->style().width().isPercent() || child->style().height().isPercent()))
+        if (relayoutChildren || (child->isReplaced() && (child->style().width().isPercentOrCalculated() || child->style().height().isPercentOrCalculated()))
             || (child->style().height().isAuto() && is<RenderBlockFlow>(*child))) {
             child->setChildNeedsLayout(MarkOnlyThis);
 
@@ -1034,7 +1034,7 @@ void RenderDeprecatedFlexibleBox::clearLineClamp()
             continue;
 
         child->clearOverrideSize();
-        if ((child->isReplaced() && (child->style().width().isPercent() || child->style().height().isPercent()))
+        if ((child->isReplaced() && (child->style().width().isPercentOrCalculated() || child->style().height().isPercentOrCalculated()))
             || (child->style().height().isAuto() && is<RenderBlockFlow>(*child))) {
             child->setChildNeedsLayout();
 
index d3679d6..9c7b882 100644 (file)
@@ -1216,7 +1216,7 @@ static bool mustRepaintFillLayers(const RenderElement& renderer, const FillLayer
 
     if (sizeType == SizeLength) {
         LengthSize size = layer->sizeLength();
-        if (size.width().isPercent() || size.height().isPercent())
+        if (size.width().isPercentOrCalculated() || size.height().isPercentOrCalculated())
             return true;
         // If the image has neither an intrinsic width nor an intrinsic height, its size is determined as for 'contain'.
         if ((size.width().isAuto() || size.height().isAuto()) && image->isGeneratedImage())
index d7b75d8..e187ae1 100644 (file)
@@ -213,7 +213,7 @@ void RenderFileUploadControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogic
             defaultLabelWidth += buttonRenderer->maxPreferredLogicalWidth() + afterButtonSpacing;
     maxLogicalWidth = static_cast<int>(ceilf(std::max(minDefaultLabelWidth, defaultLabelWidth)));
 
-    if (!style().width().isPercent())
+    if (!style().width().isPercentOrCalculated())
         minLogicalWidth = maxLogicalWidth;
 }
 
index c290dbe..3331776 100644 (file)
@@ -206,7 +206,7 @@ void RenderFrameSet::layOutAxis(GridAxis& axis, const Length* grid, int availabl
         
         // Count the total percentage of all of the percentage columns/rows -> totalPercent
         // Count the number of columns/rows which are percentages -> countPercent
-        if (grid[i].isPercent()) {
+        if (grid[i].isPercentOrCalculated()) {
             gridLayout[i] = std::max(intValueForLength(grid[i], availableLen), 0);
             totalPercent += gridLayout[i];
             countPercent++;
@@ -244,7 +244,7 @@ void RenderFrameSet::layOutAxis(GridAxis& axis, const Length* grid, int availabl
         int remainingPercent = remainingLen;
 
         for (int i = 0; i < gridLen; ++i) {
-            if (grid[i].isPercent()) {
+            if (grid[i].isPercentOrCalculated()) {
                 gridLayout[i] = (gridLayout[i] * remainingPercent) / totalPercent;
                 remainingLen -= gridLayout[i];
             }
@@ -288,7 +288,7 @@ void RenderFrameSet::layOutAxis(GridAxis& axis, const Length* grid, int availabl
             int changePercent = 0;
 
             for (int i = 0; i < gridLen; ++i) {
-                if (grid[i].isPercent()) {
+                if (grid[i].isPercentOrCalculated()) {
                     changePercent = (remainingPercent * gridLayout[i]) / totalPercent;
                     gridLayout[i] += changePercent;
                     remainingLen -= changePercent;
@@ -320,7 +320,7 @@ void RenderFrameSet::layOutAxis(GridAxis& axis, const Length* grid, int availabl
         int changePercent = 0;
 
         for (int i = 0; i < gridLen; ++i) {
-            if (grid[i].isPercent()) {
+            if (grid[i].isPercentOrCalculated()) {
                 changePercent = remainingPercent / countPercent;
                 gridLayout[i] += changePercent;
                 remainingLen -= changePercent;
index d61d190..b96bc55 100644 (file)
@@ -315,9 +315,9 @@ void RenderImage::repaintOrMarkForLayout(ImageSizeChangeType imageSizeChange, co
     // if the containing block's size depends on the image's size (i.e., the container uses shrink-to-fit sizing).
     // There's no easy way to detect that shrink-to-fit is needed, always force a layout.
     bool containingBlockNeedsToRecomputePreferredSize =
-        style().logicalWidth().isPercent()
-        || style().logicalMaxWidth().isPercent()
-        || style().logicalMinWidth().isPercent();
+        style().logicalWidth().isPercentOrCalculated()
+        || style().logicalMaxWidth().isPercentOrCalculated()
+        || style().logicalMinWidth().isPercentOrCalculated();
 
     bool layoutSizeDependsOnIntrinsicSize = style().aspectRatioType() == AspectRatioFromIntrinsic;
 
index 0b2b513..66f2dc6 100644 (file)
@@ -791,7 +791,7 @@ static LayoutUnit computeMargin(const RenderInline* renderer, const Length& marg
         return 0;
     if (margin.isFixed())
         return margin.value();
-    if (margin.isPercent())
+    if (margin.isPercentOrCalculated())
         return minimumValueForLength(margin, std::max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
     return 0;
 }
index 27c5ed5..16331ab 100644 (file)
@@ -193,7 +193,7 @@ void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, L
     maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
     if (m_vBar)
         maxLogicalWidth += m_vBar->width();
-    if (!style().width().isPercent())
+    if (!style().width().isPercentOrCalculated())
         minLogicalWidth = maxLogicalWidth;
 }
 
index dbe7b1b..98a4f09 100644 (file)
@@ -324,7 +324,7 @@ LayoutRect RenderMenuList::controlClipRect(const LayoutPoint& additionalOffset)
 void RenderMenuList::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 {
     maxLogicalWidth = std::max(m_optionsWidth, theme().minimumMenuListSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
-    if (!style().width().isPercent())
+    if (!style().width().isPercentOrCalculated())
         minLogicalWidth = maxLogicalWidth;
 }
 
index f576ec5..8ef91fe 100644 (file)
@@ -543,7 +543,7 @@ static inline bool objectIsRelayoutBoundary(const RenderElement* object)
     if (!object->hasOverflowClip())
         return false;
 
-    if (object->style().width().isIntrinsicOrAuto() || object->style().height().isIntrinsicOrAuto() || object->style().height().isPercent())
+    if (object->style().width().isIntrinsicOrAuto() || object->style().height().isIntrinsicOrAuto() || object->style().height().isPercentOrCalculated())
         return false;
 
     // Table parts can't be relayout roots since the table is responsible for layouting all the parts.
index 5b90f7a..fb16c0d 100644 (file)
@@ -486,13 +486,13 @@ void RenderReplaced::computePreferredLogicalWidths()
 
     // We cannot resolve any percent logical width here as the available logical
     // width may not be set on our containing block.
-    if (style().logicalWidth().isPercent())
+    if (style().logicalWidth().isPercentOrCalculated())
         computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
     else
         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(ComputePreferred);
 
     const RenderStyle& styleToUse = style();
-    if (styleToUse.logicalWidth().isPercent() || styleToUse.logicalMaxWidth().isPercent())
+    if (styleToUse.logicalWidth().isPercentOrCalculated() || styleToUse.logicalMaxWidth().isPercentOrCalculated())
         m_minPreferredLogicalWidth = 0;
 
     if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().value() > 0) {
index 8b6d467..021b64a 100644 (file)
@@ -72,7 +72,7 @@ int RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirecti
 void RenderSlider::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 {
     maxLogicalWidth = defaultTrackLength * style().effectiveZoom();
-    if (!style().width().isPercent())
+    if (!style().width().isPercentOrCalculated())
         minLogicalWidth = maxLogicalWidth;
 }
 
index b88e693..00772e4 100644 (file)
@@ -368,7 +368,7 @@ LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length&
             borders = borderAndPaddingBefore + borderAndPaddingAfter;
         }
         computedLogicalHeight = styleLogicalHeight.value() - borders;
-    } else if (styleLogicalHeight.isPercent())
+    } else if (styleLogicalHeight.isPercentOrCalculated())
         computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeight);
     else
         ASSERT_NOT_REACHED();
index b309330..3fd69ef 100644 (file)
@@ -67,7 +67,7 @@ static inline void updateLogicalHeightForCell(RenderTableSection::RowStruct& row
         Length cRowLogicalHeight = row.logicalHeight;
         switch (logicalHeight.type()) {
         case Percent:
-            if (!cRowLogicalHeight.isPercentNotCalculated() || cRowLogicalHeight.percent() < logicalHeight.percent())
+            if (!cRowLogicalHeight.isPercent() || cRowLogicalHeight.percent() < logicalHeight.percent())
                 row.logicalHeight = logicalHeight;
             break;
         case Fixed:
@@ -425,7 +425,7 @@ void RenderTableSection::distributeExtraLogicalHeightToPercentRows(int& extraLog
     totalPercent = std::min(totalPercent, 100);
     int rowHeight = m_rowPos[1] - m_rowPos[0];
     for (unsigned r = 0; r < totalRows; ++r) {
-        if (totalPercent > 0 && m_grid[r].logicalHeight.isPercentNotCalculated()) {
+        if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) {
             int toAdd = std::min<int>(extraLogicalHeight, (totalHeight * m_grid[r].logicalHeight.percent() / 100) - rowHeight);
             // If toAdd is negative, then we don't want to shrink the row (this bug
             // affected Outlook Web Access).
@@ -497,7 +497,7 @@ int RenderTableSection::distributeExtraLogicalHeightToRows(int extraLogicalHeigh
     for (unsigned r = 0; r < totalRows; r++) {
         if (m_grid[r].logicalHeight.isAuto())
             ++autoRowsCount;
-        else if (m_grid[r].logicalHeight.isPercentNotCalculated())
+        else if (m_grid[r].logicalHeight.isPercent())
             totalPercent += m_grid[r].logicalHeight.percent();
     }
 
@@ -568,7 +568,7 @@ void RenderTableSection::layoutRows()
                 || (!table()->style().logicalHeight().isAuto() && rHeight != cell->logicalHeight());
 
             for (RenderObject* renderer = cell->firstChild(); renderer; renderer = renderer->nextSibling()) {
-                if (!is<RenderText>(*renderer) && renderer->style().logicalHeight().isPercent() && (flexAllChildren || ((renderer->isReplaced() || (is<RenderBox>(*renderer) && downcast<RenderBox>(*renderer).scrollsOverflow())) && !is<RenderTextControl>(*renderer)))) {
+                if (!is<RenderText>(*renderer) && renderer->style().logicalHeight().isPercentOrCalculated() && (flexAllChildren || ((renderer->isReplaced() || (is<RenderBox>(*renderer) && downcast<RenderBox>(*renderer).scrollsOverflow())) && !is<RenderTextControl>(*renderer)))) {
                     // Tables with no sections do not flex.
                     if (!is<RenderTable>(*renderer) || downcast<RenderTable>(*renderer).hasSections()) {
                         renderer->setNeedsLayout(MarkOnlyThis);
index 5d78eb3..7df383c 100644 (file)
@@ -198,7 +198,7 @@ void RenderTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt
     maxLogicalWidth = preferredContentLogicalWidth(const_cast<RenderTextControl*>(this)->getAverageCharWidth());
     if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox())
         maxLogicalWidth += innerTextRenderBox->paddingStart() + innerTextRenderBox->paddingEnd();
-    if (!style().logicalWidth().isPercent())
+    if (!style().logicalWidth().isPercentOrCalculated())
         minLogicalWidth = maxLogicalWidth;
 }
 
index aabd4c7..24c7934 100644 (file)
@@ -333,9 +333,9 @@ void RenderView::layout()
 
         for (auto& box : childrenOfType<RenderBox>(*this)) {
             if (box.hasRelativeLogicalHeight()
-                || box.style().logicalHeight().isPercent()
-                || box.style().logicalMinHeight().isPercent()
-                || box.style().logicalMaxHeight().isPercent()
+                || box.style().logicalHeight().isPercentOrCalculated()
+                || box.style().logicalMinHeight().isPercentOrCalculated()
+                || box.style().logicalMaxHeight().isPercentOrCalculated()
                 || box.isSVGRoot()
                 )
                 box.setChildNeedsLayout(MarkOnlyThis);
index 7befa35..19ceec2 100644 (file)
@@ -1050,7 +1050,7 @@ LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio
         else if (verticalAlign == LENGTH) {
             LayoutUnit lineHeight;
             //Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages: refer to the 'line-height' of the element itself'.
-            if (renderer->style().verticalAlignLength().isPercent())
+            if (renderer->style().verticalAlignLength().isPercentOrCalculated())
                 lineHeight = renderer->style().computedLineHeight();
             else
                 lineHeight = renderer->lineHeight(firstLine, lineDirection);
index e230019..2747007 100644 (file)
@@ -64,7 +64,7 @@ public:
 
     double flex() const { ASSERT(isFlex()); return m_flex; }
 
-    bool isPercentage() const { return m_type == LengthType && m_length.isPercent(); }
+    bool isPercentage() const { return m_type == LengthType && m_length.isPercentOrCalculated(); }
 
     bool operator==(const GridLength& o) const
     {
index 284a78d..d2c2deb 100644 (file)
@@ -92,7 +92,7 @@ public:
 
     bool isContentSized() const { return m_minTrackBreadth.isContentSized() || m_maxTrackBreadth.isContentSized(); }
 
-    bool isPercentage() const { return m_type == LengthTrackSizing && length().isLength() && length().length().isPercent(); }
+    bool isPercentage() const { return m_type == LengthTrackSizing && length().isLength() && length().length().isPercentOrCalculated(); }
 
     bool operator==(const GridTrackSize& other) const
     {
index 223ae3f..270cfba 100644 (file)
@@ -1077,8 +1077,8 @@ void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRec
     auto& operations = rareNonInheritedData->m_transform->m_operations.operations();
     bool applyTransformOrigin = requireTransformOrigin(operations, applyOrigin);
 
-    float offsetX = transformOriginX().isPercentNotCalculated() ? boundingBox.x() : 0;
-    float offsetY = transformOriginY().isPercentNotCalculated() ? boundingBox.y() : 0;
+    float offsetX = transformOriginX().isPercent() ? boundingBox.x() : 0;
+    float offsetY = transformOriginY().isPercent() ? boundingBox.y() : 0;
 
     if (applyTransformOrigin) {
         transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
@@ -1456,7 +1456,7 @@ int RenderStyle::computedLineHeight() const
     if (lh.isNegative())
         return fontMetrics().lineSpacing();
 
-    if (lh.isPercent())
+    if (lh.isPercentOrCalculated())
         return minimumValueForLength(lh, fontSize());
 
     return clampTo<int>(lh.value());
index 16e52d2..2c23e1f 100644 (file)
@@ -436,7 +436,7 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
 
 bool RenderSVGRoot::hasRelativeDimensions() const
 {
-    return svgSVGElement().intrinsicHeight().isPercent() || svgSVGElement().intrinsicWidth().isPercent();
+    return svgSVGElement().intrinsicHeight().isPercentOrCalculated() || svgSVGElement().intrinsicWidth().isPercentOrCalculated();
 }
 
 void RenderSVGRoot::addResourceForClientInvalidation(RenderSVGResourceContainer* resource)
index b9a6901..fe4b669 100644 (file)
@@ -89,7 +89,7 @@ float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S
 
 float SVGLengthContext::valueForLength(const Length& length, SVGLengthMode mode)
 {
-    if (length.isPercent() && !length.isCalculated())
+    if (length.isPercent())
         return convertValueFromPercentageToUserUnits(length.value() / 100, mode, IGNORE_EXCEPTION);
     if (length.isAuto())
         return 0;
index 5a2ed34..45164ff 100644 (file)
@@ -286,7 +286,7 @@ bool SVGImage::hasRelativeWidth() const
     SVGSVGElement* rootElement = this->rootElement();
     if (!rootElement)
         return false;
-    return rootElement->intrinsicWidth().isPercent();
+    return rootElement->intrinsicWidth().isPercentOrCalculated();
 }
 
 bool SVGImage::hasRelativeHeight() const
@@ -294,7 +294,7 @@ bool SVGImage::hasRelativeHeight() const
     SVGSVGElement* rootElement = this->rootElement();
     if (!rootElement)
         return false;
-    return rootElement->intrinsicHeight().isPercent();
+    return rootElement->intrinsicHeight().isPercentOrCalculated();
 }
 
 void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)