Title: [202878] trunk/Source/WebKit2
- Revision
- 202878
- Author
- mmaxfi...@apple.com
- Date
- 2016-07-06 14:23:13 -0700 (Wed, 06 Jul 2016)
Log Message
[RTL Scrollbars] RTL Scrollbars broken with clients creating Web Views via [WKView initWithFrame:contextRef:pageGroupRef:]
https://bugs.webkit.org/show_bug.cgi?id=159383
<rdar://problem/26921117>
Reviewed by Anders Carlsson.
The code which consults with the userInterfaceLayoutDirection of the view is
inside [WKWebView _initializeWithConfiguration:]. However, some clients create
Web Views via [WKView initWithFrame:contextRef:pageGroupRef:] which doesn't
call this code. Therefore, this codepath should do the same kind of direction
consulting.
* UIProcess/API/mac/WKView.mm:
(toUserInterfaceLayoutDirection):
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (202877 => 202878)
--- trunk/Source/WebKit2/ChangeLog 2016-07-06 21:10:28 UTC (rev 202877)
+++ trunk/Source/WebKit2/ChangeLog 2016-07-06 21:23:13 UTC (rev 202878)
@@ -1,3 +1,21 @@
+2016-07-06 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [RTL Scrollbars] RTL Scrollbars broken with clients creating Web Views via [WKView initWithFrame:contextRef:pageGroupRef:]
+ https://bugs.webkit.org/show_bug.cgi?id=159383
+ <rdar://problem/26921117>
+
+ Reviewed by Anders Carlsson.
+
+ The code which consults with the userInterfaceLayoutDirection of the view is
+ inside [WKWebView _initializeWithConfiguration:]. However, some clients create
+ Web Views via [WKView initWithFrame:contextRef:pageGroupRef:] which doesn't
+ call this code. Therefore, this codepath should do the same kind of direction
+ consulting.
+
+ * UIProcess/API/mac/WKView.mm:
+ (toUserInterfaceLayoutDirection):
+ (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
+
2016-07-06 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r202867.
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (202877 => 202878)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2016-07-06 21:10:28 UTC (rev 202877)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2016-07-06 21:23:13 UTC (rev 202878)
@@ -35,6 +35,7 @@
#import "WebBackForwardListItem.h"
#import "WebKit2Initialize.h"
#import "WebPageGroup.h"
+#import "WebPreferencesKeys.h"
#import "WebProcessPool.h"
#import "WebViewImpl.h"
@@ -987,6 +988,19 @@
return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nil];
}
+#if PLATFORM(MAC)
+static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(NSUserInterfaceLayoutDirection direction)
+{
+ switch (direction) {
+ case NSUserInterfaceLayoutDirectionLeftToRight:
+ return WebCore::UserInterfaceLayoutDirection::LTR;
+ case NSUserInterfaceLayoutDirectionRightToLeft:
+ return WebCore::UserInterfaceLayoutDirection::RTL;
+ }
+ return WebCore::UserInterfaceLayoutDirection::LTR;
+}
+#endif
+
- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
{
auto configuration = API::PageConfiguration::create();
@@ -993,6 +1007,9 @@
configuration->setProcessPool(toImpl(contextRef));
configuration->setPageGroup(toImpl(pageGroupRef));
configuration->setRelatedPage(toImpl(relatedPage));
+#if PLATFORM(MAC)
+ configuration->preferenceValues().set(WebKit::WebPreferencesKey::systemLayoutDirectionKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(toUserInterfaceLayoutDirection(self.userInterfaceLayoutDirection))));
+#endif
return [self initWithFrame:frame processPool:*toImpl(contextRef) configuration:WTFMove(configuration) webView:nil];
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes