menu is either inappropriately resized or positioned offscreen.
https://bugs.webkit.org/show_bug.cgi?id=91913
<rdar://problem/
7611229>
Patch by Roger Fong <roger_fong@apple.com> 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 <roger_fong@apple.com> 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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123411
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-07-23 Roger Fong <roger_fong@apple.com>
+
+ 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 <simon.fraser@apple.com>
Implement sticky positioning
--- /dev/null
+<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>
+
+2012-07-23 Roger Fong <roger_fong@apple.com>
+
+ 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 <ddorwin@chromium.org>
Fixed crash in webkitAddKey() when key parameter is null.
}
// 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;
}