Changeset 202878 in webkit


Ignore:
Timestamp:
Jul 6, 2016 2:23:13 PM (8 years ago)
Author:
mmaxfield@apple.com
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:]):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r202877 r202878  
     12016-07-06  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [RTL Scrollbars] RTL Scrollbars broken with clients creating Web Views via [WKView initWithFrame:contextRef:pageGroupRef:]
     4        https://bugs.webkit.org/show_bug.cgi?id=159383
     5        <rdar://problem/26921117>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        The code which consults with the userInterfaceLayoutDirection of the view is
     10        inside [WKWebView _initializeWithConfiguration:]. However, some clients create
     11        Web Views via [WKView initWithFrame:contextRef:pageGroupRef:] which doesn't
     12        call this code. Therefore, this codepath should do the same kind of direction
     13        consulting.
     14
     15        * UIProcess/API/mac/WKView.mm:
     16        (toUserInterfaceLayoutDirection):
     17        (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
     18
    1192016-07-06  Commit Queue  <commit-queue@webkit.org>
    220
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r202129 r202878  
    3636#import "WebKit2Initialize.h"
    3737#import "WebPageGroup.h"
     38#import "WebPreferencesKeys.h"
    3839#import "WebProcessPool.h"
    3940#import "WebViewImpl.h"
     
    988989}
    989990
     991#if PLATFORM(MAC)
     992static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(NSUserInterfaceLayoutDirection direction)
     993{
     994    switch (direction) {
     995    case NSUserInterfaceLayoutDirectionLeftToRight:
     996        return WebCore::UserInterfaceLayoutDirection::LTR;
     997    case NSUserInterfaceLayoutDirectionRightToLeft:
     998        return WebCore::UserInterfaceLayoutDirection::RTL;
     999    }
     1000    return WebCore::UserInterfaceLayoutDirection::LTR;
     1001}
     1002#endif
     1003
    9901004- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
    9911005{
     
    9941008    configuration->setPageGroup(toImpl(pageGroupRef));
    9951009    configuration->setRelatedPage(toImpl(relatedPage));
     1010#if PLATFORM(MAC)
     1011    configuration->preferenceValues().set(WebKit::WebPreferencesKey::systemLayoutDirectionKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(toUserInterfaceLayoutDirection(self.userInterfaceLayoutDirection))));
     1012#endif
    9961013
    9971014    return [self initWithFrame:frame processPool:*toImpl(contextRef) configuration:WTFMove(configuration) webView:nil];
Note: See TracChangeset for help on using the changeset viewer.