Title: [123411] trunk
Revision
123411
Author
[email protected]
Date
2012-07-23 17:48:06 -0700 (Mon, 23 Jul 2012)

Log Message

.: If select element in Windows is off screen horizontally,
menu is either inappropriately resized or positioned offscreen.
https://bugs.webkit.org/show_bug.cgi?id=91913
<rdar://problem/7611229>

Patch by Roger Fong <[email protected]> on 2012-07-23
Reviewed by Tim Horton.

Add a manual test to verify that popup menus render in the correct place.

* ManualTests/win/select-menu-off-screen.html: Added.

Source/WebCore: On Windows, if select element is off screen horizontally,
menu is either inappropriately resized or positioned offscreen.
https://bugs.webkit.org/show_bug.cgi?id=91913
<rdar://problem/7611229>

Patch by Roger Fong <[email protected]> on 2012-07-23
Reviewed by Tim Horton.

If the select element is positioned off the edge of the screen to the left,
the menu is resized. It should not be resized, just shifted to remain on the screen.
If the select element is positioned off the edge of the screen to the right,
the menu goes off screen instead of being shifted over to appear on screen.
This problem only occurs on Windows.

Test: ManualTests/win/select-menu-off-screen.html

* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::calculatePositionAndSize):
Modified final horizontal position calculation code to position
popup menu on screen if it would otherwise go off.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (123410 => 123411)


--- trunk/ChangeLog	2012-07-24 00:42:53 UTC (rev 123410)
+++ trunk/ChangeLog	2012-07-24 00:48:06 UTC (rev 123411)
@@ -1,3 +1,16 @@
+2012-07-23  Roger Fong  <[email protected]>
+
+        If select element in Windows is off screen horizontally, 
+        menu is either inappropriately resized or positioned offscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=91913
+        <rdar://problem/7611229>
+
+        Reviewed by Tim Horton.
+
+        Add a manual test to verify that popup menus render in the correct place.
+        
+        * ManualTests/win/select-menu-off-screen.html: Added.
+
 2012-07-23  Simon Fraser  <[email protected]>
 
         Implement sticky positioning

Added: trunk/ManualTests/win/select-menu-off-screen.html (0 => 123411)


--- trunk/ManualTests/win/select-menu-off-screen.html	                        (rev 0)
+++ trunk/ManualTests/win/select-menu-off-screen.html	2012-07-24 00:48:06 UTC (rev 123411)
@@ -0,0 +1,22 @@
+<html>
+<body>
+    <ol>
+    <li>Maximize window.</li>
+    <li>Click on left menu and make sure whole menu (all of the entries should be completely visible) appears on screen against the left edge of the screen.</li>
+    <li>Click on right menuand make sure whole menu (all of the entries should be completely visible) appears on screen against the right edge of the screen.</li>
+    </ol>
+    <select id="left-select-over" style="margin-left:-50px;">
+      <option value="first">First</option>
+      <option value="second">Second</option>
+      <option value="third">Third</option>
+      <option value="fourth">Fourth</option>
+    </select>
+    <select id="right-select-over" style="float:right; margin-right:-50px;">
+      <option value="first">First</option>
+      <option value="second">Second</option>
+      <option value="third">Third</option>
+      <option value="fourth">Fourth</option>
+    </select>
+</body>
+<html>
+

Modified: trunk/Source/WebCore/ChangeLog (123410 => 123411)


--- trunk/Source/WebCore/ChangeLog	2012-07-24 00:42:53 UTC (rev 123410)
+++ trunk/Source/WebCore/ChangeLog	2012-07-24 00:48:06 UTC (rev 123411)
@@ -1,3 +1,25 @@
+2012-07-23  Roger Fong  <[email protected]>
+
+        On Windows, if select element is off screen horizontally, 
+        menu is either inappropriately resized or positioned offscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=91913
+        <rdar://problem/7611229>
+
+        Reviewed by Tim Horton.
+
+        If the select element is positioned off the edge of the screen to the left, 
+        the menu is resized. It should not be resized, just shifted to remain on the screen.
+        If the select element is positioned off the edge of the screen to the right, 
+        the menu goes off screen instead of being shifted over to appear on screen.
+        This problem only occurs on Windows.
+        
+        Test: ManualTests/win/select-menu-off-screen.html
+
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::calculatePositionAndSize):
+        Modified final horizontal position calculation code to position
+        popup menu on screen if it would otherwise go off.
+        
 2012-07-23  David Dorwin  <[email protected]>
 
         Fixed crash in webkitAddKey() when key parameter is null.

Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (123410 => 123411)


--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2012-07-24 00:42:53 UTC (rev 123410)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2012-07-24 00:48:06 UTC (rev 123411)
@@ -378,10 +378,11 @@
     }
 
     // Check that we don't go off the screen horizontally
-    if (popupRect.x() < screen.x()) {
-        popupRect.setWidth(popupRect.width() - (screen.x() - popupRect.x()));
+    if (popupRect.x() + popupRect.width() > screen.width())
+        popupRect.setX(screen.x() + screen.width() - popupRect.width());
+    if (popupRect.x() < screen.x())
         popupRect.setX(screen.x());
-    }
+
     m_windowRect = popupRect;
     return;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to