Title: [202112] trunk/Source
- Revision
- 202112
- Author
- d...@apple.com
- Date
- 2016-06-15 15:14:09 -0700 (Wed, 15 Jun 2016)
Log Message
RTL <select> forms are misplaced
https://bugs.webkit.org/show_bug.cgi?id=158810
<rdar://problem/24847541>
Reviewed by Eric Carlson.
AppKit made a change in Sierra that causes popup menus
to snap to a different point when the system language is RTL.
We need to be more explicit about what directionality
we want, and override the location of the popup based
on the text direction.
I also made a small tweak to the fudge offsets we use
in order to make button text and menu text to be
more consistent.
Unfortunately since this is just about the location
of the popup menu, it's unable to be tested in our
current infrastructure.
Source/WebKit/mac:
* WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::show):
Source/WebKit2:
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::showPopupMenu):
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (202111 => 202112)
--- trunk/Source/WebKit/mac/ChangeLog 2016-06-15 22:07:57 UTC (rev 202111)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-06-15 22:14:09 UTC (rev 202112)
@@ -1,3 +1,28 @@
+2016-06-15 Dean Jackson <d...@apple.com>
+
+ RTL <select> forms are misplaced
+ https://bugs.webkit.org/show_bug.cgi?id=158810
+ <rdar://problem/24847541>
+
+ Reviewed by Eric Carlson.
+
+ AppKit made a change in Sierra that causes popup menus
+ to snap to a different point when the system language is RTL.
+ We need to be more explicit about what directionality
+ we want, and override the location of the popup based
+ on the text direction.
+
+ I also made a small tweak to the fudge offsets we use
+ in order to make button text and menu text to be
+ more consistent.
+
+ Unfortunately since this is just about the location
+ of the popup menu, it's unable to be tested in our
+ current infrastructure.
+
+ * WebCoreSupport/PopupMenuMac.mm:
+ (PopupMenuMac::show):
+
2016-06-15 Chris Dumez <cdu...@apple.com>
Drop some unnecessary header includes
Modified: trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm (202111 => 202112)
--- trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm 2016-06-15 22:07:57 UTC (rev 202111)
+++ trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm 2016-06-15 22:14:09 UTC (rev 202112)
@@ -163,7 +163,7 @@
CTFontRef font = m_client->menuStyle().font().primaryFont().getCTFont();
// These values were borrowed from AppKit to match their placement of the menu.
- const int popOverHorizontalAdjust = -10;
+ const int popOverHorizontalAdjust = -13;
const int popUnderHorizontalAdjust = 6;
const int popUnderVerticalAdjust = 6;
if (m_client->shouldPopOver()) {
@@ -175,9 +175,14 @@
auto defaultFont = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, CTFontGetSize(font), nil));
vertOffset += CTFontGetDescent(font) - CTFontGetDescent(defaultFont.get());
vertOffset = fminf(NSHeight(r), vertOffset);
-
- float horizontalOffset = textDirection == LTR ? popOverHorizontalAdjust : 0;
- location = NSMakePoint(NSMinX(r) + horizontalOffset, NSMaxY(r) - vertOffset);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ if (textDirection == LTR)
+ location = NSMakePoint(NSMinX(r) + popOverHorizontalAdjust, NSMaxY(r) - vertOffset);
+ else
+ location = NSMakePoint(NSMinX(r) - popOverHorizontalAdjust, NSMaxY(r) - vertOffset);
+#else
+ location = NSMakePoint(NSMinX(r) + popOverHorizontalAdjust, NSMaxY(r) - vertOffset);
+#endif
} else
location = NSMakePoint(NSMinX(r) + popUnderHorizontalAdjust, NSMaxY(r) + popUnderVerticalAdjust);
Modified: trunk/Source/WebKit2/ChangeLog (202111 => 202112)
--- trunk/Source/WebKit2/ChangeLog 2016-06-15 22:07:57 UTC (rev 202111)
+++ trunk/Source/WebKit2/ChangeLog 2016-06-15 22:14:09 UTC (rev 202112)
@@ -1,3 +1,28 @@
+2016-06-15 Dean Jackson <d...@apple.com>
+
+ RTL <select> forms are misplaced
+ https://bugs.webkit.org/show_bug.cgi?id=158810
+ <rdar://problem/24847541>
+
+ Reviewed by Eric Carlson.
+
+ AppKit made a change in Sierra that causes popup menus
+ to snap to a different point when the system language is RTL.
+ We need to be more explicit about what directionality
+ we want, and override the location of the popup based
+ on the text direction.
+
+ I also made a small tweak to the fudge offsets we use
+ in order to make button text and menu text to be
+ more consistent.
+
+ Unfortunately since this is just about the location
+ of the popup menu, it's unable to be tested in our
+ current infrastructure.
+
+ * UIProcess/mac/WebPopupMenuProxyMac.mm:
+ (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+
2016-06-15 Chris Dumez <cdu...@apple.com>
Drop some unnecessary header includes
Modified: trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm (202111 => 202112)
--- trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm 2016-06-15 22:07:57 UTC (rev 202111)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm 2016-06-15 22:14:09 UTC (rev 202112)
@@ -123,7 +123,7 @@
#endif
// These values were borrowed from AppKit to match their placement of the menu.
- const int popOverHorizontalAdjust = -10;
+ const int popOverHorizontalAdjust = -13;
const int popUnderHorizontalAdjust = 6;
const int popUnderVerticalAdjust = 6;
@@ -134,13 +134,21 @@
NSRect titleFrame = [m_popup titleRectForBounds:rect];
if (titleFrame.size.width <= 0 || titleFrame.size.height <= 0)
titleFrame = rect;
- float verticalOffset = roundf((NSMaxY(rect) - NSMaxY(titleFrame)) + NSHeight(titleFrame));
- float horizontalOffset = textDirection == LTR ? popOverHorizontalAdjust : 0;
- location = NSMakePoint(NSMinX(rect) + horizontalOffset, NSMaxY(rect) - verticalOffset);
+ float verticalOffset = roundf((NSMaxY(rect) - NSMaxY(titleFrame)) + NSHeight(titleFrame)) + 1;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ if (textDirection == LTR)
+ location = NSMakePoint(NSMinX(rect) + popOverHorizontalAdjust, NSMaxY(rect) - verticalOffset);
+ else
+ location = NSMakePoint(NSMaxX(rect) - popOverHorizontalAdjust, NSMaxY(rect) - verticalOffset);
+#else
+ location = NSMakePoint(NSMinX(rect) + popOverHorizontalAdjust, NSMaxY(rect) - verticalOffset);
+#endif
+
} else
location = NSMakePoint(NSMinX(rect) + popUnderHorizontalAdjust, NSMaxY(rect) + popUnderVerticalAdjust);
RetainPtr<NSView> dummyView = adoptNS([[NSView alloc] initWithFrame:rect]);
+ [dummyView.get() setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
[m_webView addSubview:dummyView.get()];
location = [dummyView convertPoint:location fromView:m_webView];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes