Title: [127545] branches/chromium/1229
Revision
127545
Author
[email protected]
Date
2012-09-04 19:48:12 -0700 (Tue, 04 Sep 2012)

Log Message

Merge 127520 - REGRESSION(r120832): RenderLayer::clampScrollOffset doesn't properly clamp
https://bugs.webkit.org/show_bug.cgi?id=95776

Reviewed by Simon Fraser.

.:

* ManualTests/select-menu-list-wrongly-positioned.html: Added.

Source/WebCore:

r120832 consolidated the clamping logic into RenderLayer::clampScrollOffset. The existing code wouldn't properly ensure that
the offset were positive which got exposed to other code paths, leading to the regression.

Tested by ManualTests/select-menu-list-wrongly-positioned.html as I didn't find a way to create a reliable layout test.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::clampScrollOffset):
Fixed the clamping logic to ensure that the scroll offset's dimensions are positive.


[email protected]
Review URL: https://chromiumcodereview.appspot.com/10908086

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1229/ManualTests/select-menu-list-wrongly-positioned.html (from rev 127520, trunk/ManualTests/select-menu-list-wrongly-positioned.html) (0 => 127545)


--- branches/chromium/1229/ManualTests/select-menu-list-wrongly-positioned.html	                        (rev 0)
+++ branches/chromium/1229/ManualTests/select-menu-list-wrongly-positioned.html	2012-09-05 02:48:12 UTC (rev 127545)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    table {
+        overflow: hidden;
+    }
+</style>
+<script>
+    function onSelectionChange(select)
+    {
+        document.getElementById('hiddenRow').style.display = '';
+    }
+</script>
+</head>
+<body>
+    <div><a href="" REGRESSION(r120832): RenderLayer::clampScrollOffset doesn't properly clamp</div>
+    <div>Manual test: click on the menu below and &lt;select&gt; the 'shown' option. Click somewhere on the page so that the &lt;select&gt; loses focus and click again on the &lt;select&gt;.</div>
+    <div>To pass the menu should be properly placed below the &lt;select&gt;.</div>
+    <form name="teste">
+        <table>
+        <tr>
+            <th>Test select:</th>
+            <td>
+            <select _onchange_=onSelectionChange(this)>
+                <option value="0">hidden</option>
+                <option value="1">shown</option>
+            </select>
+            </td>
+        </tr>
+        <tr id="hiddenRow" style="display: none;">
+            <th>Lorem ipsum</th>
+            <td>dolor sic amet.</td>
+        </tr>
+        </table>
+    </form>
+</body>
+</html>

Modified: branches/chromium/1229/Source/WebCore/rendering/RenderLayer.cpp (127544 => 127545)


--- branches/chromium/1229/Source/WebCore/rendering/RenderLayer.cpp	2012-09-05 02:36:45 UTC (rev 127544)
+++ branches/chromium/1229/Source/WebCore/rendering/RenderLayer.cpp	2012-09-05 02:48:12 UTC (rev 127545)
@@ -1625,8 +1625,8 @@
     int maxX = scrollWidth() - box->pixelSnappedClientWidth();
     int maxY = scrollHeight() - box->pixelSnappedClientHeight();
 
-    int x = min(max(scrollOffset.width(), 0), maxX);
-    int y = min(max(scrollOffset.height(), 0), maxY);
+    int x = max(min(scrollOffset.width(), maxX), 0);
+    int y = max(min(scrollOffset.height(), maxY), 0);
     return IntSize(x, y);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to