Changeset 189959 in webkit


Ignore:
Timestamp:
Sep 17, 2015 6:58:40 PM (9 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] WTR fails to set the key window in the UIKit sense
https://bugs.webkit.org/show_bug.cgi?id=149325

Reviewed by Tim Horton.

-[WebKitTestRunnerWindow isKeyWindow] just returned _platformWebView->windowIsKey().
This causes UIKit to bypass code that actually sets the key window, resulting in
[UIAppliation sharedApplication].keyWindow always being nil.

Fix by PlatformWebView::setWindowIsKey() actually call -makeKeyWindow, and having
-[WebKitTestRunnerWindow isKeyWindow] call super.

  • WebKitTestRunner/PlatformWebView.h:

(WTR::PlatformWebView::setWindowIsKey): Deleted.

  • WebKitTestRunner/efl/PlatformWebViewEfl.cpp:

(WTR::PlatformWebView::setWindowIsKey):

  • WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:

(WTR::PlatformWebView::setWindowIsKey):

  • WebKitTestRunner/ios/PlatformWebViewIOS.mm:

(-[WebKitTestRunnerWindow isKeyWindow]):
(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::~PlatformWebView):
(WTR::PlatformWebView::setWindowIsKey):

  • WebKitTestRunner/mac/PlatformWebViewMac.mm:

(WTR::PlatformWebView::setWindowIsKey):

Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r189958 r189959  
     12015-09-17  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] WTR fails to set the key window in the UIKit sense
     4        https://bugs.webkit.org/show_bug.cgi?id=149325
     5
     6        Reviewed by Tim Horton.
     7
     8        -[WebKitTestRunnerWindow isKeyWindow] just returned _platformWebView->windowIsKey().
     9        This causes UIKit to bypass code that actually sets the key window, resulting in
     10        [UIAppliation sharedApplication].keyWindow always being nil.
     11
     12        Fix by PlatformWebView::setWindowIsKey() actually call -makeKeyWindow, and having
     13        -[WebKitTestRunnerWindow isKeyWindow] call super.
     14
     15        * WebKitTestRunner/PlatformWebView.h:
     16        (WTR::PlatformWebView::setWindowIsKey): Deleted.
     17        * WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
     18        (WTR::PlatformWebView::setWindowIsKey):
     19        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
     20        (WTR::PlatformWebView::setWindowIsKey):
     21        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
     22        (-[WebKitTestRunnerWindow isKeyWindow]):
     23        (WTR::PlatformWebView::PlatformWebView):
     24        (WTR::PlatformWebView::~PlatformWebView):
     25        (WTR::PlatformWebView::setWindowIsKey):
     26        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     27        (WTR::PlatformWebView::setWindowIsKey):
     28
    1292015-09-17  Simon Fraser  <simon.fraser@apple.com>
    230
  • trunk/Tools/WebKitTestRunner/PlatformWebView.h

    r189668 r189959  
    7878    void removeChromeInputField();
    7979    void makeWebViewFirstResponder();
    80     void setWindowIsKey(bool isKey) { m_windowIsKey = isKey; }
     80    void setWindowIsKey(bool);
    8181    bool windowIsKey() const { return m_windowIsKey; }
    8282
  • trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp

    r189668 r189959  
    8383}
    8484
     85void PlatformWebView::setWindowIsKey(bool isKey)
     86{
     87    m_windowIsKey = isKey;
     88}
     89
    8590void PlatformWebView::resizeTo(unsigned width, unsigned height)
    8691{
  • trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp

    r189668 r189959  
    5757{
    5858    gtk_widget_destroy(m_window);
     59}
     60
     61void PlatformWebView::setWindowIsKey(bool isKey)
     62{
     63    m_windowIsKey = isKey;
    5964}
    6065
  • trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm

    r189669 r189959  
    5656    return self;
    5757}
     58
    5859- (BOOL)isKeyWindow
    5960{
    60     return _platformWebView ? _platformWebView->windowIsKey() : YES;
     61    return [super isKeyWindow] && (_platformWebView ? _platformWebView->windowIsKey() : YES);
    6162}
    6263
     
    108109    m_view = [[WKWebView alloc] initWithFrame:rect configuration:configuration];
    109110
    110     CGRect windowRect = rect;
    111     m_window = [[WebKitTestRunnerWindow alloc] initWithFrame:windowRect];
     111    m_window = [[WebKitTestRunnerWindow alloc] initWithFrame:rect];
    112112    m_window.platformWebView = this;
    113113
    114114    [m_window addSubview:m_view];
    115115    [m_window makeKeyAndVisible];
     116}
     117
     118PlatformWebView::~PlatformWebView()
     119{
     120    m_window.platformWebView = nil;
     121    [m_view release];
     122    [m_window release];
     123}
     124
     125void PlatformWebView::setWindowIsKey(bool isKey)
     126{
     127    m_windowIsKey = isKey;
     128    if (isKey)
     129        [m_window makeKeyWindow];
    116130}
    117131
     
    122136    frame.size.height = height;
    123137    setWindowFrame(frame);
    124 }
    125 
    126 PlatformWebView::~PlatformWebView()
    127 {
    128     m_window.platformWebView = 0;
    129     [m_view release];
    130     [m_window release];
    131138}
    132139
  • trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r189669 r189959  
    146146}
    147147
     148void PlatformWebView::setWindowIsKey(bool isKey)
     149{
     150    m_windowIsKey = isKey;
     151}
     152
    148153void PlatformWebView::resizeTo(unsigned width, unsigned height)
    149154{
Note: See TracChangeset for help on using the changeset viewer.