Title: [111156] trunk
Revision
111156
Author
macpher...@chromium.org
Date
2012-03-18 23:37:54 -0700 (Sun, 18 Mar 2012)

Log Message

Remove remnants of code that assume Lengths are 28 bit integers.
https://bugs.webkit.org/show_bug.cgi?id=67976

Reviewed by Eric Seidel.

Source/WebCore:

Test: LayoutTests/fast/table/max-width-integer-overflow-expected.html

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeLength):
Bound by INT_MAX and INT_MIN instead of 28 bit bounds.
* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyBorderRadius::applyValue):
Use PrimitiveValue::computeLength function directly.
* platform/Length.h:
Remove 28 bit integer limit constants.
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::computePreferredLogicalWidths):
Use std::numeric_limits.

LayoutTests:

* platform/mac/fast/table/max-width-integer-overflow-expected.png:
* platform/mac/fast/table/max-width-integer-overflow-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (111155 => 111156)


--- trunk/LayoutTests/ChangeLog	2012-03-19 06:16:44 UTC (rev 111155)
+++ trunk/LayoutTests/ChangeLog	2012-03-19 06:37:54 UTC (rev 111156)
@@ -1,3 +1,13 @@
+2012-03-18  Luke Macpherson   <macpher...@chromium.org>
+
+        Remove remnants of code that assume Lengths are 28 bit integers.
+        https://bugs.webkit.org/show_bug.cgi?id=67976
+
+        Reviewed by Eric Seidel.
+
+        * platform/mac/fast/table/max-width-integer-overflow-expected.png:
+        * platform/mac/fast/table/max-width-integer-overflow-expected.txt:
+
 2012-03-16  Shinya Kawanaka  <shin...@chromium.org>
 
         Should remove RuntimeEnabledFeatures::multipleShadowSubtreesEnabled

Modified: trunk/LayoutTests/platform/mac/fast/table/max-width-integer-overflow-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/table/max-width-integer-overflow-expected.txt (111155 => 111156)


--- trunk/LayoutTests/platform/mac/fast/table/max-width-integer-overflow-expected.txt	2012-03-19 06:16:44 UTC (rev 111155)
+++ trunk/LayoutTests/platform/mac/fast/table/max-width-integer-overflow-expected.txt	2012-03-19 06:37:54 UTC (rev 111156)
@@ -6,16 +6,16 @@
       RenderTable {TABLE} at (0,0) size 780x24 [bgcolor=#FF0000]
         RenderTableSection {TBODY} at (0,0) size 780x24
           RenderTableRow {TR} at (0,0) size 780x24
-            RenderTableCell {TD} at (0,0) size 770x24 [r=0 c=0 rs=1 cs=1]
-              RenderTable {TABLE} at (0,0) size 770x24
-                RenderTableSection {TBODY} at (0,0) size 770x24
-                  RenderTableRow {TR} at (0,0) size 770x24
-                    RenderTableCell {TD} at (0,0) size 770x24 [r=0 c=0 rs=1 cs=1]
-                      RenderBlock {DIV} at (0,0) size 770x24
-                        RenderTable {TABLE} at (0,0) size 770x24 [bgcolor=#008000]
-                          RenderTableSection {TBODY} at (0,0) size 770x24
-                            RenderTableRow {TR} at (0,2) size 770x20
-                              RenderTableCell {TD} at (2,11) size 762x2 [r=0 c=0 rs=1 cs=1]
-                              RenderTableCell {TD} at (766,11) size 2x2 [r=0 c=1 rs=1 cs=1]
-            RenderTableCell {TD} at (770,0) size 10x24 [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (0,0) size 780x24 [r=0 c=0 rs=1 cs=1]
+              RenderTable {TABLE} at (0,0) size 780x24
+                RenderTableSection {TBODY} at (0,0) size 780x24
+                  RenderTableRow {TR} at (0,0) size 780x24
+                    RenderTableCell {TD} at (0,0) size 780x24 [r=0 c=0 rs=1 cs=1]
+                      RenderBlock {DIV} at (0,0) size 780x24
+                        RenderTable {TABLE} at (0,0) size 780x24 [bgcolor=#008000]
+                          RenderTableSection {TBODY} at (0,0) size 780x24
+                            RenderTableRow {TR} at (0,2) size 780x20
+                              RenderTableCell {TD} at (2,11) size 772x2 [r=0 c=0 rs=1 cs=1]
+                              RenderTableCell {TD} at (776,11) size 2x2 [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (780,0) size 10x24 [r=0 c=1 rs=1 cs=1]
               RenderBlock {DIV} at (0,0) size 10x24 [bgcolor=#008000]

Modified: trunk/Source/WebCore/ChangeLog (111155 => 111156)


--- trunk/Source/WebCore/ChangeLog	2012-03-19 06:16:44 UTC (rev 111155)
+++ trunk/Source/WebCore/ChangeLog	2012-03-19 06:37:54 UTC (rev 111156)
@@ -1,3 +1,24 @@
+2012-03-18  Luke Macpherson   <macpher...@chromium.org>
+
+        Remove remnants of code that assume Lengths are 28 bit integers.
+        https://bugs.webkit.org/show_bug.cgi?id=67976
+
+        Reviewed by Eric Seidel.
+
+        Test: LayoutTests/fast/table/max-width-integer-overflow-expected.html
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::computeLength):
+        Bound by INT_MAX and INT_MIN instead of 28 bit bounds.
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::ApplyPropertyBorderRadius::applyValue):
+        Use PrimitiveValue::computeLength function directly.
+        * platform/Length.h:
+        Remove 28 bit integer limit constants.
+        * rendering/AutoTableLayout.cpp:
+        (WebCore::AutoTableLayout::computePreferredLogicalWidths):
+        Use std::numeric_limits.
+
 2012-03-16  Shinya Kawanaka  <shin...@chromium.org>
 
         Should remove RuntimeEnabledFeatures::multipleShadowSubtreesEnabled

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (111155 => 111156)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2012-03-19 06:16:44 UTC (rev 111155)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2012-03-19 06:37:54 UTC (rev 111156)
@@ -404,8 +404,7 @@
 
 template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
-    // FIXME: Length.h no longer expects 28 bit integers, so these bounds should be INT_MAX and INT_MIN
-    return Length(roundForImpreciseConversion<int, intMaxForLength, intMinForLength>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
+    return Length(roundForImpreciseConversion<int, INT_MAX, INT_MIN>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
 }
 
 template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (111155 => 111156)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2012-03-19 06:16:44 UTC (rev 111155)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2012-03-19 06:37:54 UTC (rev 111156)
@@ -448,7 +448,7 @@
             // handle this case
             return;
         } else
-            radiusWidth = Length(max(intMinForLength, min(intMaxForLength, pair->first()->computeLength<int>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed);
+            radiusWidth = pair->first()->computeLength<Length>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
         if (pair->second()->isPercentage())
             radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
         else if (pair->second()->isCalculatedPercentageWithLength()) {
@@ -456,7 +456,7 @@
             // handle this case
             return;
         } else
-            radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLength<int>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed);
+            radiusHeight = pair->second()->computeLength<Length>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
         int width = radiusWidth.value();
         int height = radiusHeight.value();
         if (width < 0 || height < 0)

Modified: trunk/Source/WebCore/platform/Length.h (111155 => 111156)


--- trunk/Source/WebCore/platform/Length.h	2012-03-19 06:16:44 UTC (rev 111155)
+++ trunk/Source/WebCore/platform/Length.h	2012-03-19 06:37:54 UTC (rev 111156)
@@ -33,9 +33,6 @@
 
 namespace WebCore {
 
-const int intMaxForLength = 0x7ffffff; // max value for a 28-bit int
-const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int
-
 enum LengthType { Auto, Relative, Percent, Fixed, Intrinsic, MinIntrinsic, Calculated, Undefined };
  
 class CalculationValue;    

Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (111155 => 111156)


--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp	2012-03-19 06:16:44 UTC (rev 111155)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp	2012-03-19 06:37:54 UTC (rev 111156)
@@ -266,8 +266,8 @@
         minWidth = max<int>(minWidth, tableLogicalWidth.value());
         maxWidth = minWidth;
     } else if (!remainingPercent && maxNonPercent) {
-        // if there was no remaining percent, maxWidth is invalid.
-        maxWidth = intMaxForLength;        
+        // if there was no remaining percent, maxWidth is invalid
+        maxWidth = std::numeric_limits<LayoutUnit>::max();
     }
 
     Length tableLogicalMinWidth = m_table->style()->logicalMinWidth();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to