Title: [128805] branches/chromium/1229

Diff

Copied: branches/chromium/1229/LayoutTests/fast/sub-pixel/large-sizes-expected.txt (from rev 127933, trunk/LayoutTests/fast/sub-pixel/large-sizes-expected.txt) (0 => 128805)


--- branches/chromium/1229/LayoutTests/fast/sub-pixel/large-sizes-expected.txt	                        (rev 0)
+++ branches/chromium/1229/LayoutTests/fast/sub-pixel/large-sizes-expected.txt	2012-09-17 21:22:35 UTC (rev 128805)
@@ -0,0 +1,12 @@
+PASS element.width = 5000px, returns offsetWidth 5000, rect.width 5000 and computed width 5000px as expected.
+PASS element.width = 50000px, returns offsetWidth 50000, rect.width 50000 and computed width 50000px as expected.
+PASS element.width = 500000px, returns offsetWidth 500000, rect.width 500000 and computed width 500000px as expected.
+PASS element.width = 5000000px, returns offsetWidth 5000000, rect.width 5000000 and computed width 5000000px as expected.
+PASS element.width = 50000000px, returns offsetWidth 0, rect.width 0 and computed width 0px as expected.
+PASS element.width = 35791388px, returns offsetWidth 35791388, rect.width 35791388 and computed width 35791388px as expected.
+PASS element.width = 35791390px, returns offsetWidth 35791392, rect.width 35791392 and computed width 35791392px as expected.
+PASS element.width = 35791392px, returns offsetWidth 35791392, rect.width 35791392 and computed width 35791392px as expected.
+PASS element.width = 35791394px, returns offsetWidth 35791392, rect.width 35791392 and computed width 35791392px as expected.
+PASS element.width = 35791395px, returns offsetWidth 0, rect.width 0 and computed width 0px as expected.
+PASS element.width = 35791396px, returns offsetWidth 0, rect.width 0 and computed width 0px as expected.
+Test handling of sizes exceeding the maximum supported value.

Copied: branches/chromium/1229/LayoutTests/fast/sub-pixel/large-sizes.html (from rev 127933, trunk/LayoutTests/fast/sub-pixel/large-sizes.html) (0 => 128805)


--- branches/chromium/1229/LayoutTests/fast/sub-pixel/large-sizes.html	                        (rev 0)
+++ branches/chromium/1229/LayoutTests/fast/sub-pixel/large-sizes.html	2012-09-17 21:22:35 UTC (rev 128805)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+    </head>
+    <body>
+        <p>
+            Test handling of sizes exceeding the maximum supported value.
+        </p>
+        <script>
+            function testSize(width, expectedWidth)
+            {
+                el.style.width = width + 'px';
+                var style = window.getComputedStyle(el, null);
+                var rect = el.getBoundingClientRect();
+                if (el.offsetWidth == expectedWidth && rect.width == expectedWidth && style.width == expectedWidth + 'px')
+                    //testPassed('Element given a width of ' + width + ' returns 
+                    testPassed('element.width = ' + width + 'px, returns offsetWidth ' + el.offsetWidth + ', rect.width ' + rect.width + ' and computed width ' + style.width + ' as expected.');
+                else
+                    testFailed('element.width = ' + width + 'px, returns offsetWidth ' + el.offsetWidth + ', rect.width ' + rect.width + ' and computed width ' + style.width + ', expected ' + expectedWidth + '.');
+            }
+            
+            var el = document.createElement('div');
+            document.body.appendChild(el);
+
+            testSize(5000, 5000);
+            testSize(50000, 50000);
+            testSize(500000, 500000);
+            testSize(5000000, 5000000);
+            testSize(50000000, 0);
+            testSize(35791388, 35791388);
+            testSize(35791390, 35791392); // float impression
+            testSize(35791392, 35791392);
+            testSize(35791394, 35791392); // float impression
+            testSize(35791395, 0);
+            testSize(35791396, 0);
+            
+            document.body.removeChild(el);
+        </script>
+    </body>
+</html>

Copied: branches/chromium/1229/LayoutTests/platform/chromium/fast/css/large-number-round-trip-expected.txt (from rev 127933, trunk/LayoutTests/platform/chromium/fast/css/large-number-round-trip-expected.txt) (0 => 128805)


--- branches/chromium/1229/LayoutTests/platform/chromium/fast/css/large-number-round-trip-expected.txt	                        (rev 0)
+++ branches/chromium/1229/LayoutTests/platform/chromium/fast/css/large-number-round-trip-expected.txt	2012-09-17 21:22:35 UTC (rev 128805)
@@ -0,0 +1 @@
+PASS: read 90010000px back as 0px, read again as 0px

Modified: branches/chromium/1229/LayoutTests/platform/chromium-win/media/video-zoom-controls-expected.txt (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/chromium-win/media/video-zoom-controls-expected.txt	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/chromium-win/media/video-zoom-controls-expected.txt	2012-09-17 21:22:35 UTC (rev 128805)
@@ -28,7 +28,7 @@
         RenderBlock {DIV} at (1,1) size 6x36
         RenderBlock {DIV} at (-4,1) size 36x36
     RenderButton {INPUT} at (284,0) size 46x45
-layer at (127,217) size 49x36
+layer at (127,217) size 48x36
   RenderBlock (relative positioned) {DIV} at (-11,-12) size 49x36
 layer at (57,310) size 240x180
   RenderVideo {VIDEO} at (45,298) size 240x180
@@ -52,5 +52,5 @@
         RenderBlock {DIV} at (1,1) size 6x36
         RenderBlock {DIV} at (-4,1) size 36x36
     RenderButton {INPUT} at (284,0) size 46x45
-layer at (127,442) size 49x36 backgroundClip at (60,417) size 225x45 clip at (60,417) size 225x45 outlineClip at (60,417) size 225x45
+layer at (127,442) size 48x36 backgroundClip at (60,417) size 225x45 clip at (60,417) size 225x45 outlineClip at (60,417) size 225x45
   RenderBlock (relative positioned) {DIV} at (-11,-12) size 49x36

Modified: branches/chromium/1229/LayoutTests/platform/mac/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/mac/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/mac/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -822,6 +822,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/mac-lion/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/mac-lion/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/mac-lion/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -111,6 +111,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/mac-snowleopard/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/mac-snowleopard/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/mac-snowleopard/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -205,6 +205,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/mac-wk2/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/mac-wk2/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/mac-wk2/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -211,6 +211,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/qt/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/qt/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/qt/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -278,6 +278,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/qt-4.8/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/qt-4.8/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/qt-4.8/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -98,6 +98,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/win/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/win/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/win/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -1732,6 +1732,7 @@
 # Fail until SUBPIXEL_LAYOUT is enabled
 # https://bugs.webkit.org/show_bug.cgi?id=85532
 fast/sub-pixel/client-width-height-snapping.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/size-of-box-with-zoom.html
 

Modified: branches/chromium/1229/LayoutTests/platform/win-wk2/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/win-wk2/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/win-wk2/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -944,6 +944,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/win-xp/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/win-xp/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/win-xp/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -44,6 +44,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/wincairo/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/wincairo/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/wincairo/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -2125,6 +2125,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/LayoutTests/platform/wk2/Skipped (128804 => 128805)


--- branches/chromium/1229/LayoutTests/platform/wk2/Skipped	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/LayoutTests/platform/wk2/Skipped	2012-09-17 21:22:35 UTC (rev 128805)
@@ -94,6 +94,7 @@
 fast/sub-pixel/inline-block-should-not-wrap.html
 fast/sub-pixel/inline-block-with-margin.html
 fast/sub-pixel/inline-block-with-padding.html
+fast/sub-pixel/large-sizes.html
 fast/sub-pixel/layout-boxes-with-zoom.html
 fast/sub-pixel/position-right-aligns-with-container.html
 fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html

Modified: branches/chromium/1229/Source/WebCore/css/CSSPrimitiveValue.cpp (128804 => 128805)


--- branches/chromium/1229/Source/WebCore/css/CSSPrimitiveValue.cpp	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/Source/WebCore/css/CSSPrimitiveValue.cpp	2012-09-17 21:22:35 UTC (rev 128805)
@@ -469,7 +469,8 @@
 template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
 #if ENABLE(SUBPIXEL_LAYOUT)
-    return Length(static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
+    double value = computeLengthDouble(style, rootStyle, multiplier, computingFontSize);
+    return Length(static_cast<float>(value > intMaxForLayoutUnit || value < intMinForLayoutUnit ? 0.0 : value), Fixed);
 #else
     return Length(roundForImpreciseConversion<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
 #endif

Modified: branches/chromium/1229/Source/WebCore/platform/FractionalLayoutUnit.h (128804 => 128805)


--- branches/chromium/1229/Source/WebCore/platform/FractionalLayoutUnit.h	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/Source/WebCore/platform/FractionalLayoutUnit.h	2012-09-17 21:22:35 UTC (rev 128805)
@@ -182,6 +182,21 @@
         m.m_value = std::numeric_limits<int>::min();
         return m;
     }
+
+    // Versions of max/min that are slightly smaller/larger than max/min() to allow for roinding without overflowing.
+    static const FractionalLayoutUnit nearlyMax()
+    {
+        FractionalLayoutUnit m;
+        m.m_value = std::numeric_limits<int>::max() - kFixedPointDenominator / 2;
+        return m;
+    }
+    static const FractionalLayoutUnit nearlyMin()
+    {
+        FractionalLayoutUnit m;
+        m.m_value = std::numeric_limits<int>::min() + kFixedPointDenominator / 2;
+        return m;
+    }
+    
     static FractionalLayoutUnit clamp(double value)
     {
         return clampTo<FractionalLayoutUnit>(value, FractionalLayoutUnit::min(), FractionalLayoutUnit::max());
@@ -685,7 +700,8 @@
 
 inline int snapSizeToPixel(FractionalLayoutUnit size, FractionalLayoutUnit location) 
 {
-    return (location + size).round() - location.round();
+    FractionalLayoutUnit fraction = location - location.floor();
+    return (fraction + size).round() - fraction.round();
 }
 
 #if PLATFORM(QT)

Modified: branches/chromium/1229/Source/WebCore/platform/graphics/FractionalLayoutRect.h (128804 => 128805)


--- branches/chromium/1229/Source/WebCore/platform/graphics/FractionalLayoutRect.h	2012-09-17 21:11:04 UTC (rev 128804)
+++ branches/chromium/1229/Source/WebCore/platform/graphics/FractionalLayoutRect.h	2012-09-17 21:22:35 UTC (rev 128805)
@@ -165,7 +165,11 @@
 
     FractionalLayoutRect transposedRect() const { return FractionalLayoutRect(m_location.transposedPoint(), m_size.transposedSize()); }
 
-    static FractionalLayoutRect infiniteRect() {return FractionalLayoutRect(FractionalLayoutUnit::min() / 2, FractionalLayoutUnit::min() / 2, FractionalLayoutUnit::max(), FractionalLayoutUnit::max()); }
+    static FractionalLayoutRect infiniteRect()
+    {
+        // Return a rect that is slightly smaller than the true max rect to allow pixelSnapping to round up to the nearest IntRect without overflowing.
+        return FractionalLayoutRect(FractionalLayoutUnit::nearlyMin() / 2, FractionalLayoutUnit::nearlyMin() / 2, FractionalLayoutUnit::nearlyMax(), FractionalLayoutUnit::nearlyMax());
+    }
 
 #if PLATFORM(QT)
     explicit FractionalLayoutRect(const QRect&);
@@ -207,9 +211,9 @@
 inline IntRect pixelSnappedIntRect(const FractionalLayoutRect& rect)
 {
 #if ENABLE(SUBPIXEL_LAYOUT)
-    IntPoint roundedLocation = roundedIntPoint(rect.location());
-    return IntRect(roundedLocation, IntSize((rect.x() + rect.width()).round() - roundedLocation.x(),
-                                            (rect.y() + rect.height()).round() - roundedLocation.y()));
+    return IntRect(roundedIntPoint(rect.location()), IntSize(snapSizeToPixel(rect.width(), rect.x()),
+                                                             snapSizeToPixel(rect.height(), rect.y())));
+
 #else
     return IntRect(rect);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to