Title: [200217] trunk/Source
- Revision
- 200217
- Author
- [email protected]
- Date
- 2016-04-28 17:41:32 -0700 (Thu, 28 Apr 2016)
Log Message
RTL <select> popup menu is in the wrong location
https://bugs.webkit.org/show_bug.cgi?id=157159
<rdar://problem/25894451>
Reviewed by Simon Fraser.
Source/WebKit/mac:
Make sure both the NSPopupMenuCell and the NSPopupMenu take
the text direction into account, and offset the position
of the menu slightly if we're in RTL mode.
Unfortunately our test infrastructure is unable to exercise
this because it runs without a window, and the popup menu
is not captured in the screenshot.
* WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::show):
Source/WebKit2:
Make sure the NSPopupMenu takes the text direction
into account, and offset the position
of the menu slightly if we're in RTL mode.
Unfortunately our test infrastructure is unable to exercise
this because it runs without a window, and the popup menu
is not captured in the screenshot.
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::showPopupMenu):
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (200216 => 200217)
--- trunk/Source/WebKit/mac/ChangeLog 2016-04-28 23:38:09 UTC (rev 200216)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-04-29 00:41:32 UTC (rev 200217)
@@ -1,3 +1,22 @@
+2016-04-28 Dean Jackson <[email protected]>
+
+ RTL <select> popup menu is in the wrong location
+ https://bugs.webkit.org/show_bug.cgi?id=157159
+ <rdar://problem/25894451>
+
+ Reviewed by Simon Fraser.
+
+ Make sure both the NSPopupMenuCell and the NSPopupMenu take
+ the text direction into account, and offset the position
+ of the menu slightly if we're in RTL mode.
+
+ Unfortunately our test infrastructure is unable to exercise
+ this because it runs without a window, and the popup menu
+ is not captured in the screenshot.
+
+ * WebCoreSupport/PopupMenuMac.mm:
+ (PopupMenuMac::show):
+
2016-04-28 Manuel Rego Casasnovas <[email protected]>
[css-grid] Add CSS Grid Layout runtime flag
Modified: trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm (200216 => 200217)
--- trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm 2016-04-28 23:38:09 UTC (rev 200216)
+++ trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm 2016-04-29 00:41:32 UTC (rev 200217)
@@ -148,11 +148,15 @@
NSView* view = v->documentView();
+ TextDirection textDirection = m_client->menuStyle().textDirection();
+
[m_popup attachPopUpWithFrame:r inView:view];
[m_popup selectItemAtIndex:index];
+ [m_popup setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
NSMenu* menu = [m_popup menu];
-
+ [menu setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
+
NSPoint location;
NSFont* font = m_client->menuStyle().font().primaryFont().getNSFont();
@@ -169,8 +173,9 @@
NSFont* defaultFont = [NSFont systemFontOfSize:[font pointSize]];
vertOffset += [font descender] - [defaultFont descender];
vertOffset = fminf(NSHeight(r), vertOffset);
-
- location = NSMakePoint(NSMinX(r) + popOverHorizontalAdjust, NSMaxY(r) - vertOffset);
+
+ float horizontalOffset = textDirection == LTR ? popOverHorizontalAdjust : 0;
+ location = NSMakePoint(NSMinX(r) + horizontalOffset, NSMaxY(r) - vertOffset);
} else
location = NSMakePoint(NSMinX(r) + popUnderHorizontalAdjust, NSMaxY(r) + popUnderVerticalAdjust);
Modified: trunk/Source/WebKit2/ChangeLog (200216 => 200217)
--- trunk/Source/WebKit2/ChangeLog 2016-04-28 23:38:09 UTC (rev 200216)
+++ trunk/Source/WebKit2/ChangeLog 2016-04-29 00:41:32 UTC (rev 200217)
@@ -1,3 +1,22 @@
+2016-04-28 Dean Jackson <[email protected]>
+
+ RTL <select> popup menu is in the wrong location
+ https://bugs.webkit.org/show_bug.cgi?id=157159
+ <rdar://problem/25894451>
+
+ Reviewed by Simon Fraser.
+
+ Make sure the NSPopupMenu takes the text direction
+ into account, and offset the position
+ of the menu slightly if we're in RTL mode.
+
+ Unfortunately our test infrastructure is unable to exercise
+ this because it runs without a window, and the popup menu
+ is not captured in the screenshot.
+
+ * UIProcess/mac/WebPopupMenuProxyMac.mm:
+ (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+
2016-04-28 Manuel Rego Casasnovas <[email protected]>
[css-grid] Add CSS Grid Layout runtime flag
Modified: trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm (200216 => 200217)
--- trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm 2016-04-28 23:38:09 UTC (rev 200216)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm 2016-04-29 00:41:32 UTC (rev 200217)
@@ -118,6 +118,7 @@
[m_popup setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
NSMenu *menu = [m_popup menu];
+ [menu setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
// These values were borrowed from AppKit to match their placement of the menu.
const int popOverHorizontalAdjust = -10;
@@ -131,8 +132,9 @@
NSRect titleFrame = [m_popup titleRectForBounds:rect];
if (titleFrame.size.width <= 0 || titleFrame.size.height <= 0)
titleFrame = rect;
- float vertOffset = roundf((NSMaxY(rect) - NSMaxY(titleFrame)) + NSHeight(titleFrame));
- location = NSMakePoint(NSMinX(rect) + popOverHorizontalAdjust, NSMaxY(rect) - vertOffset);
+ float verticalOffset = roundf((NSMaxY(rect) - NSMaxY(titleFrame)) + NSHeight(titleFrame));
+ float horizontalOffset = textDirection == LTR ? popOverHorizontalAdjust : 0;
+ location = NSMakePoint(NSMinX(rect) + horizontalOffset, NSMaxY(rect) - verticalOffset);
} else
location = NSMakePoint(NSMinX(rect) + popUnderHorizontalAdjust, NSMaxY(rect) + popUnderVerticalAdjust);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes