Title: [166920] trunk/Source/WebCore
Revision
166920
Author
da...@apple.com
Date
2014-04-08 01:58:43 -0700 (Tue, 08 Apr 2014)

Log Message

Fix assertions triggered by CSS calc changes in r166860
https://bugs.webkit.org/show_bug.cgi?id=131346

Reviewed by Andrei Bucur.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::getBorderRadiusCornerValues): Use isPercentNotCalculated() instead of
type() == Percent; no behavior change.
(WebCore::getBorderRadiusCornerValue): Ditto.
(WebCore::lineHeightFromStyle): Use isPercentNotCalculated() before code
that calls percent(), which won't work for a calculated length.

* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyBorderRadius::applyValue): Use isNegative and isZero rather
than calling value() unconditionally. Should make calculated values work better.

* html/HTMLPlugInImageElement.cpp:
(WebCore::is100Percent): Use isPercentNotCalculated() before code
that calls percent(), which won't work for a calculated length.

* platform/Length.cpp:
(WebCore::CalculationValueMap::deref): Use adoptRef here instead of calling deref
immediately, so the deref will happen after calling remove. This makes the code
work properly even if it's reentered inside the calculation value's destructor.

* platform/Length.h:
(WebCore::Length::percent): Change assert to isPercentNotCalculated, since the
value function this calls only works for non-calculated values anyway.
(WebCore::Length::isPercentNotCalculated): Added.
(WebCore::Length::isPercent): Changed to call isPercentNotCalculated.
(WebCore::Length::isSpecified): Changed to call isPercent.

* platform/graphics/transforms/TranslateTransformOperation.h:
(WebCore::TranslateTransformOperation::apply): Use isPercentNotCalculated()
instead of type() == Percent; no behavior change.

* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn): Use isPercentNotCalculated()
before code that calls value() or percent(), which won't work for a calculated length.
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths): Ditto.
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth): Ditto.
(WebCore::AutoTableLayout::layout): Ditto.
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::layout): Ditto.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): Ditto.
* rendering/RenderTableSection.cpp:
(WebCore::updateLogicalHeightForCell): Ditto.
(WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows): Ditto.
(WebCore::RenderTableSection::distributeExtraLogicalHeightToRows): Ditto.

* rendering/style/RenderStyle.cpp:
(WebCore::requireTransformOrigin): Use modern for loop. Also marked function static,
since it's private to this file.
(WebCore::RenderStyle::applyTransform): Use isPercentNotCalculated() instead of
type() == Percent; no behavior change. Also use a modern for loop and auto& to avoid
a really long type name.

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation): Use isPercentNotCalculated()
before code that calls percent(), which won't work for a calculated length.

* platform/Length.h:
(WebCore::Length::percent):
(WebCore::Length::isPercentNotCalculated):
(WebCore::Length::isPercent):
(WebCore::Length::isSpecified):
* platform/graphics/transforms/TranslateTransformOperation.h:
(WebCore::TranslateTransformOperation::apply):
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
(WebCore::AutoTableLayout::layout):
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::layout):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
* rendering/RenderTableSection.cpp:
(WebCore::updateLogicalHeightForCell):
(WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows):
(WebCore::RenderTableSection::distributeExtraLogicalHeightToRows):
* rendering/style/RenderStyle.cpp:
(WebCore::requireTransformOrigin):
(WebCore::RenderStyle::applyTransform):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (166919 => 166920)


--- trunk/Source/WebCore/ChangeLog	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/ChangeLog	2014-04-08 08:58:43 UTC (rev 166920)
@@ -1,3 +1,93 @@
+2014-04-08  Darin Adler  <da...@apple.com>
+
+        Fix assertions triggered by CSS calc changes in r166860
+        https://bugs.webkit.org/show_bug.cgi?id=131346
+
+        Reviewed by Andrei Bucur.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::getBorderRadiusCornerValues): Use isPercentNotCalculated() instead of
+        type() == Percent; no behavior change.
+        (WebCore::getBorderRadiusCornerValue): Ditto.
+        (WebCore::lineHeightFromStyle): Use isPercentNotCalculated() before code
+        that calls percent(), which won't work for a calculated length.
+
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::ApplyPropertyBorderRadius::applyValue): Use isNegative and isZero rather
+        than calling value() unconditionally. Should make calculated values work better.
+
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::is100Percent): Use isPercentNotCalculated() before code
+        that calls percent(), which won't work for a calculated length.
+
+        * platform/Length.cpp:
+        (WebCore::CalculationValueMap::deref): Use adoptRef here instead of calling deref
+        immediately, so the deref will happen after calling remove. This makes the code
+        work properly even if it's reentered inside the calculation value's destructor.
+
+        * platform/Length.h:
+        (WebCore::Length::percent): Change assert to isPercentNotCalculated, since the
+        value function this calls only works for non-calculated values anyway.
+        (WebCore::Length::isPercentNotCalculated): Added.
+        (WebCore::Length::isPercent): Changed to call isPercentNotCalculated.
+        (WebCore::Length::isSpecified): Changed to call isPercent.
+
+        * platform/graphics/transforms/TranslateTransformOperation.h:
+        (WebCore::TranslateTransformOperation::apply): Use isPercentNotCalculated()
+        instead of type() == Percent; no behavior change.
+
+        * rendering/AutoTableLayout.cpp:
+        (WebCore::AutoTableLayout::recalcColumn): Use isPercentNotCalculated()
+        before code that calls value() or percent(), which won't work for a calculated length.
+        (WebCore::AutoTableLayout::computeIntrinsicLogicalWidths): Ditto.
+        (WebCore::AutoTableLayout::calcEffectiveLogicalWidth): Ditto.
+        (WebCore::AutoTableLayout::layout): Ditto.
+        * rendering/FixedTableLayout.cpp:
+        (WebCore::FixedTableLayout::layout): Ditto.
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): Ditto.
+        * rendering/RenderTableSection.cpp:
+        (WebCore::updateLogicalHeightForCell): Ditto.
+        (WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows): Ditto.
+        (WebCore::RenderTableSection::distributeExtraLogicalHeightToRows): Ditto.
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::requireTransformOrigin): Use modern for loop. Also marked function static,
+        since it's private to this file.
+        (WebCore::RenderStyle::applyTransform): Use isPercentNotCalculated() instead of
+        type() == Percent; no behavior change. Also use a modern for loop and auto& to avoid
+        a really long type name.
+
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation): Use isPercentNotCalculated()
+        before code that calls percent(), which won't work for a calculated length.
+
+        * platform/Length.h:
+        (WebCore::Length::percent):
+        (WebCore::Length::isPercentNotCalculated):
+        (WebCore::Length::isPercent):
+        (WebCore::Length::isSpecified):
+        * platform/graphics/transforms/TranslateTransformOperation.h:
+        (WebCore::TranslateTransformOperation::apply):
+        * rendering/AutoTableLayout.cpp:
+        (WebCore::AutoTableLayout::recalcColumn):
+        (WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
+        (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
+        (WebCore::AutoTableLayout::layout):
+        * rendering/FixedTableLayout.cpp:
+        (WebCore::FixedTableLayout::layout):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::updateLogicalHeightForCell):
+        (WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows):
+        (WebCore::RenderTableSection::distributeExtraLogicalHeightToRows):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::requireTransformOrigin):
+        (WebCore::RenderStyle::applyTransform):
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation):
+
 2014-04-08  Xabier Rodriguez Calvar  <calva...@igalia.com>
 
         [GTK] Remove media controls dead code

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (166919 => 166920)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -705,11 +705,11 @@
 static PassRef<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
 {
     auto list = CSSValueList::createSpaceSeparated();
-    if (radius.width().type() == Percent)
+    if (radius.width().isPercentNotCalculated())
         list.get().append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
     else
         list.get().append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style));
-    if (radius.height().type() == Percent)
+    if (radius.height().isPercentNotCalculated())
         list.get().append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
     else
         list.get().append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style));
@@ -719,7 +719,7 @@
 static PassRef<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
 {
     if (radius.width() == radius.height()) {
-        if (radius.width().type() == Percent)
+        if (radius.width().isPercentNotCalculated())
             return cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
         return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style);
     }
@@ -1452,12 +1452,13 @@
     Length length = style->lineHeight();
     if (length.isNegative())
         return cssValuePool().createIdentifierValue(CSSValueNormal);
-    if (length.isPercent())
+    if (length.isPercentNotCalculated()) {
         // 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
         // that here either.
         return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
+    }
     return zoomAdjustedPixelValue(floatValueForLength(length, 0, renderView), style);
 }
 
@@ -2164,12 +2165,12 @@
             if (marginRight.isFixed() || !renderer || !renderer->isBox())
                 return zoomAdjustedPixelValueForLength(marginRight, style.get());
             float value;
-            if (marginRight.isPercent() || marginRight.isViewportPercentage())
+            if (marginRight.isPercent() || marginRight.isViewportPercentage()) {
                 // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
                 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
                 // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
                 value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document().renderView());
-            else
+            } else
                 value = toRenderBox(renderer)->marginRight();
             return zoomAdjustedPixelValue(value, style.get());
         }

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (166919 => 166920)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -443,7 +443,6 @@
             return;
 
         Length radiusWidth;
-        Length radiusHeight;
         if (pair->first()->isPercentage())
             radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
         else if (pair->first()->isViewportPercentageLength())
@@ -452,6 +451,8 @@
             radiusWidth = Length(pair->first()->cssCalcValue()->createCalculationValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
         else
             radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
+
+        Length radiusHeight;
         if (pair->second()->isPercentage())
             radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
         else if (pair->second()->isViewportPercentageLength())
@@ -460,17 +461,16 @@
             radiusHeight = Length(pair->second()->cssCalcValue()->createCalculationValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
         else
             radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
-        int width = radiusWidth.value();
-        int height = radiusHeight.value();
-        if (width < 0 || height < 0)
+
+        if (radiusWidth.isNegative() || radiusHeight.isNegative())
             return;
-        if (!width)
-            radiusHeight = radiusWidth; // Null out the other value.
-        else if (!height)
-            radiusWidth = radiusHeight; // Null out the other value.
 
-        LengthSize size(radiusWidth, radiusHeight);
-        setValue(styleResolver->style(), size);
+        if (radiusWidth.isZero() || radiusHeight.isZero()) {
+            radiusWidth.setValue(Fixed, 0);
+            radiusHeight.setValue(Fixed, 0);
+        }
+
+        setValue(styleResolver->style(), LengthSize(radiusWidth, radiusHeight));
     }
     static PropertyHandler createHandler()
     {

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (166919 => 166920)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -610,7 +610,7 @@
 
 static inline bool is100Percent(Length length)
 {
-    return length.isPercent() && length.percent() == 100;
+    return length.isPercentNotCalculated() && length.percent() == 100;
 }
 
 void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const URL& url)

Modified: trunk/Source/WebCore/platform/Length.cpp (166919 => 166920)


--- trunk/Source/WebCore/platform/Length.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/platform/Length.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -196,7 +196,7 @@
 {
     ASSERT(m_nextAvailableHandle);
 
-    // The leakRef below is balanced by the deref in the deref member function.
+    // The leakRef below is balanced by the adoptRef in the deref member function.
     Entry leakedValue = value.leakRef();
 
     // FIXME: This monotonically increasing handle generation scheme is potentially wasteful
@@ -231,8 +231,9 @@
         return;
     }
 
-    // The deref below is balanced by the leakRef in the insert member function.
-    it->value.value->deref();
+    // The adoptRef here is balanced by the leakRef in the insert member function.
+    Ref<CalculationValue> value { adoptRef(*it->value.value) };
+
     m_map.remove(it);
 }
 

Modified: trunk/Source/WebCore/platform/Length.h (166919 => 166920)


--- trunk/Source/WebCore/platform/Length.h	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/platform/Length.h	2014-04-08 08:58:43 UTC (rev 166920)
@@ -84,6 +84,7 @@
     bool isFixed() const;
     bool isMaxContent() const;
     bool isMinContent() const;
+    bool isPercentNotCalculated() const; // FIXME: Rename to isPercent.
     bool isRelative() const;
     bool isUndefined() const;
 
@@ -97,11 +98,7 @@
     bool isPositive() const;
     bool isNegative() const;
 
-    // Returns true for both Percent and Calculated.
-    // FIXME: Doesn't really seem OK to return true for Calculated given this function's name,
-    // even though all calculated values are treated as percentages. Callers can tell Percent
-    // from a Calculated already by looking at type, so this function only half-hides the distinction.
-    bool isPercent() const;
+    bool isPercent() const; // Returns true for both Percent and Calculated. FIXME: Find a better name for this.
 
     bool isIntrinsic() const;
     bool isIntrinsicOrAuto() const;
@@ -262,7 +259,7 @@
 
 inline float Length::percent() const
 {
-    ASSERT(isPercent());
+    ASSERT(isPercentNotCalculated());
     return value();
 }
 
@@ -341,6 +338,11 @@
     return m_isFloat ? (m_floatValue < 0) : (m_intValue < 0);
 }
 
+inline bool Length::isPercentNotCalculated() const
+{
+    return type() == Percent;
+}
+
 inline bool Length::isRelative() const
 {
     return type() == Relative;
@@ -353,7 +355,7 @@
 
 inline bool Length::isPercent() const
 {
-    return type() == Percent || isCalculated();
+    return isPercentNotCalculated() || isCalculated();
 }
 
 inline bool Length::isPositive() const
@@ -395,7 +397,7 @@
 
 inline bool Length::isSpecified() const
 {
-    return isFixed() || type() == Percent || isCalculated() || isViewportPercentage();
+    return isFixed() || isPercent() || isViewportPercentage();
 }
 
 inline bool Length::isSpecifiedOrIntrinsic() const

Modified: trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h (166919 => 166920)


--- trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h	2014-04-08 08:58:43 UTC (rev 166920)
@@ -68,7 +68,7 @@
     virtual bool apply(TransformationMatrix& transform, const FloatSize& borderBoxSize) const
     {
         transform.translate3d(x(borderBoxSize), y(borderBoxSize), z(borderBoxSize));
-        return m_x.type() == Percent || m_y.type() == Percent;
+        return m_x.isPercentNotCalculated() || m_y.isPercentNotCalculated();
     }
 
     virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);

Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (166919 => 166920)


--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -108,7 +108,7 @@
                         break;
                     case Percent:
                         m_hasPercent = true;
-                        if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.value() > columnLayout.logicalWidth.value()))
+                        if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercentNotCalculated() || cellLogicalWidth.percent() > columnLayout.logicalWidth.percent()))
                             columnLayout.logicalWidth = cellLogicalWidth;
                         break;
                     case Relative:
@@ -229,8 +229,8 @@
         minWidth += m_layoutStruct[i].effectiveMinLogicalWidth;
         maxWidth += m_layoutStruct[i].effectiveMaxLogicalWidth;
         if (scaleColumns) {
-            if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) {
-                float percent = std::min(static_cast<float>(m_layoutStruct[i].effectiveLogicalWidth.percent()), remainingPercent);
+            if (m_layoutStruct[i].effectiveLogicalWidth.isPercentNotCalculated()) {
+                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);
                 remainingPercent -= percent;
@@ -322,7 +322,7 @@
                 //   <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.isPercent()) {
+                if (!columnLayout.effectiveLogicalWidth.isPercentNotCalculated()) {
                     columnLayout.effectiveLogicalWidth = Length();
                     allColsArePercent = false;
                 } else
@@ -340,7 +340,7 @@
         }
 
         // adjust table max width if needed
-        if (cellLogicalWidth.isPercent()) {
+        if (cellLogicalWidth.isPercentNotCalculated()) {
             if (totalPercent > cellLogicalWidth.percent() || allColsArePercent) {
                 // can't satify this condition, treat as variable
                 cellLogicalWidth = Length();
@@ -383,9 +383,9 @@
                 int allocatedMinLogicalWidth = 0;
                 int allocatedMaxLogicalWidth = 0;
                 for (unsigned pos = effCol; pos < lastCol; ++pos) {
-                    ASSERT(m_layoutStruct[pos].logicalWidth.isPercent() || m_layoutStruct[pos].effectiveLogicalWidth.isPercent());
+                    ASSERT(m_layoutStruct[pos].logicalWidth.isPercentNotCalculated() || m_layoutStruct[pos].effectiveLogicalWidth.isPercentNotCalculated());
                     // |allColsArePercent| means that either the logicalWidth *or* the effectiveLogicalWidth are percents, handle both of them here.
-                    float percent = m_layoutStruct[pos].logicalWidth.isPercent() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLogicalWidth.percent();
+                    float percent = m_layoutStruct[pos].logicalWidth.isPercentNotCalculated() ? 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);
@@ -619,7 +619,7 @@
     if (available > 0 && m_hasPercent && totalPercent < 100) {
         for (size_t i = 0; i < nEffCols; ++i) {
             Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
-            if (logicalWidth.isPercent()) {
+            if (logicalWidth.isPercentNotCalculated()) {
                 int cellLogicalWidth = available * logicalWidth.percent() / totalPercent;
                 available -= cellLogicalWidth;
                 totalPercent -= logicalWidth.percent();

Modified: trunk/Source/WebCore/rendering/FixedTableLayout.cpp (166919 => 166920)


--- trunk/Source/WebCore/rendering/FixedTableLayout.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/rendering/FixedTableLayout.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -225,7 +225,7 @@
         if (m_width[i].isFixed()) {
             calcWidth[i] = m_width[i].value();
             totalFixedWidth += calcWidth[i];
-        } else if (m_width[i].isPercent()) {
+        } else if (m_width[i].isPercentNotCalculated()) {
             calcWidth[i] = valueForLength(m_width[i], tableLogicalWidth);
             totalPercentWidth += calcWidth[i];
             totalPercent += m_width[i].percent();
@@ -254,7 +254,7 @@
             if (totalPercent) {
                 totalPercentWidth = 0;
                 for (unsigned i = 0; i < nEffCols; i++) {
-                    if (m_width[i].isPercent()) {
+                    if (m_width[i].isPercentNotCalculated()) {
                         calcWidth[i] = m_width[i].percent() * (tableLogicalWidth - totalFixedWidth) / totalPercent;
                         totalPercentWidth += calcWidth[i];
                     }

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (166919 => 166920)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -892,7 +892,7 @@
     // that establishes the coordinate system for the 'background-position' property. 
     
     // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
-    if (intrinsicWidth.isPercent() && intrinsicHeight.isPercent() && intrinsicRatio.isEmpty()) {
+    if (intrinsicWidth.isPercentNotCalculated() && intrinsicHeight.isPercentNotCalculated() && intrinsicRatio.isEmpty()) {
         // Resolve width/height percentages against positioningAreaSize, only if no intrinsic ratio is provided.
         float resolvedWidth = positioningAreaSize.width() * intrinsicWidth.percent() / 100;
         float resolvedHeight = positioningAreaSize.height() * intrinsicHeight.percent() / 100;

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (166919 => 166920)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -65,12 +65,11 @@
         Length cRowLogicalHeight = row.logicalHeight;
         switch (logicalHeight.type()) {
         case Percent:
-            if (!(cRowLogicalHeight.isPercent())
-                || (cRowLogicalHeight.isPercent() && cRowLogicalHeight.percent() < logicalHeight.percent()))
+            if (!cRowLogicalHeight.isPercentNotCalculated() || cRowLogicalHeight.percent() < logicalHeight.percent())
                 row.logicalHeight = logicalHeight;
             break;
         case Fixed:
-            if (cRowLogicalHeight.type() < Percent
+            if (cRowLogicalHeight.isAuto() || cRowLogicalHeight.isRelative()
                 || (cRowLogicalHeight.isFixed() && cRowLogicalHeight.value() < logicalHeight.value()))
                 row.logicalHeight = logicalHeight;
             break;
@@ -435,7 +434,7 @@
     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.isPercent()) {
+        if (totalPercent > 0 && m_grid[r].logicalHeight.isPercentNotCalculated()) {
             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).
@@ -507,7 +506,7 @@
     for (unsigned r = 0; r < totalRows; r++) {
         if (m_grid[r].logicalHeight.isAuto())
             ++autoRowsCount;
-        else if (m_grid[r].logicalHeight.isPercent())
+        else if (m_grid[r].logicalHeight.isPercentNotCalculated())
             totalPercent += m_grid[r].logicalHeight.percent();
     }
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (166919 => 166920)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -932,7 +932,7 @@
     return rareNonInheritedData->m_altText;
 }
 
-inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& transformOperations, RenderStyle::ApplyTransformOrigin applyOrigin)
+static inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& transformOperations, RenderStyle::ApplyTransformOrigin applyOrigin)
 {
     // transform-origin brackets the transform with translate operations.
     // Optimize for the case where the only transform is a translation, since the transform-origin is irrelevant
@@ -940,9 +940,8 @@
     if (applyOrigin != RenderStyle::IncludeTransformOrigin)
         return false;
 
-    unsigned size = transformOperations.size();
-    for (unsigned i = 0; i < size; ++i) {
-        TransformOperation::OperationType type = transformOperations[i]->type();
+    for (auto& operation : transformOperations) {
+        TransformOperation::OperationType type = operation->type();
         if (type != TransformOperation::TRANSLATE_X
             && type != TransformOperation::TRANSLATE_Y
             && type != TransformOperation::TRANSLATE 
@@ -950,28 +949,27 @@
             && type != TransformOperation::TRANSLATE_3D)
             return true;
     }
-    
+
     return false;
 }
 
 void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRect& boundingBox, ApplyTransformOrigin applyOrigin) const
 {
-    const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInheritedData->m_transform->m_operations.operations();
-    bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
-    
-    float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0;
-    float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0;
-    
+    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;
+
     if (applyTransformOrigin) {
         transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
                               floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY,
                               transformOriginZ());
     }
-    
-    unsigned size = transformOperations.size();
-    for (unsigned i = 0; i < size; ++i)
-        transformOperations[i]->apply(transform, boundingBox.size());
-    
+
+    for (auto& operation : operations)
+        operation->apply(transform, boundingBox.size());
+
     if (applyTransformOrigin) {
         transform.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX,
                               -floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY,

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (166919 => 166920)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2014-04-08 08:15:39 UTC (rev 166919)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2014-04-08 08:58:43 UTC (rev 166920)
@@ -113,7 +113,7 @@
 
     // If our intrinsic size is in percentage units, return those to the caller through the intrinsicSize. Notify the caller
     // about the special situation, by setting isPercentageIntrinsicSize=true, so it knows how to interpret the return values.
-    if (intrinsicWidthAttribute.isPercent() && intrinsicHeightAttribute.isPercent()) {
+    if (intrinsicWidthAttribute.isPercentNotCalculated() && intrinsicHeightAttribute.isPercentNotCalculated()) {
         isPercentageIntrinsicSize = true;
         intrinsicSize = FloatSize(intrinsicWidthAttribute.percent(), intrinsicHeightAttribute.percent());
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to