Changeset 206286 in webkit


Ignore:
Timestamp:
Sep 22, 2016 7:10:48 PM (8 years ago)
Author:
bshafiei@apple.com
Message:

Merge r206033. rdar://problem/28086237

Location:
branches/safari-602-branch
Files:
3 added
41 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/safari-602-branch/Source/WebKit2/ChangeLog

    r206053 r206286  
     12016-09-22  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r206033. rdar://problem/28086237
     4
     5    2016-09-16  Wenson Hsieh  <wenson_hsieh@apple.com>
     6
     7            Inserting a space after inserting an accepted candidate scrolls the document and causes a flicker
     8            https://bugs.webkit.org/show_bug.cgi?id=162009
     9            <rdar://problem/28086237>
     10
     11            Reviewed by Tim Horton.
     12
     13            After inserting a text candidate, if the candidate ended with a soft space, the next space we insert should just
     14            replace the soft space. This currently works because we leave the text insertion out of the list of
     15            KeypressCommands sent to the web process and instead replace the soft space via WebPage::InsertTextAsync.
     16            However, this means when the web process handles this keydown event, the current editor will not handle it,
     17            since the list of key commands is empty despite the text and unmodified text being non-empty.
     18
     19            To fix this, when sending keydown or keyup events where we replace a soft space, we set the key event's text to
     20            an empty string instead of a space. This allows us to return early in EventHandler::keyEvent and avoid the
     21            codepath that tries to insert text into the current editor and (in the case of inserting a ' ') scrolls the
     22            document if necessary. Since we've already handled text insertion via WebPage::InsertTextAsync, there is no need
     23            to also dispatch the keypress to the editor.
     24
     25            Additionally, this patch addresses flickering in the candidates UI due to the fact that we're asynchronously
     26            replacing the last soft space. During this operation, we select the range of the soft space and then insert the
     27            new text. This causes a momentary range selection which the web process notifies the UI process about, prompting
     28            us to hide the candidates list. To address this, we suppress the EditorStateChanged message fired from the web
     29            process to the UI process while we're selecting the original range to replace.
     30
     31            This patch adds 3 new WebKit API tests.
     32
     33            * Shared/NativeWebKeyboardEvent.h:
     34            * Shared/mac/NativeWebKeyboardEventMac.mm:
     35            (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
     36            * Shared/mac/WebEventFactory.h:
     37            * Shared/mac/WebEventFactory.mm:
     38            (WebKit::textFromEvent):
     39            (WebKit::unmodifiedTextFromEvent):
     40            (WebKit::WebEventFactory::createWebKeyboardEvent):
     41            * UIProcess/API/Cocoa/WKWebView.mm:
     42            (-[WKWebView _handleAcceptedCandidate:]):
     43            (-[WKWebView _didHandleAcceptedCandidate]):
     44            (-[WKWebView _didUpdateCandidateListVisibility:]):
     45            (-[WKWebView _forceRequestCandidates]):
     46            (-[WKWebView _handleControlledElementIDResponse:]): Deleted.
     47            * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     48            * UIProcess/API/mac/WKView.mm:
     49            (-[WKView _didHandleAcceptedCandidate]):
     50            (-[WKView _didUpdateCandidateListVisibility:]):
     51            * UIProcess/Cocoa/WebViewImpl.h:
     52            * UIProcess/Cocoa/WebViewImpl.mm:
     53            (WebKit::WebViewImpl::forceRequestCandidatesForTesting):
     54            (WebKit::WebViewImpl::becomeFirstResponder):
     55            (WebKit::WebViewImpl::didHandleAcceptedCandidate):
     56            (WebKit::WebViewImpl::insertText):
     57            (WebKit::WebViewImpl::performKeyEquivalent):
     58            (WebKit::WebViewImpl::keyUp):
     59            (WebKit::WebViewImpl::keyDown):
     60            (WebKit::WebViewImpl::flagsChanged):
     61            * UIProcess/WebPageProxy.cpp:
     62            (WebKit::WebPageProxy::insertTextAsync):
     63            * UIProcess/WebPageProxy.h:
     64            * WebProcess/WebPage/WebPage.cpp:
     65            (WebKit::WebPage::insertTextAsync):
     66            (WebKit::WebPage::didChangeSelection):
     67            * WebProcess/WebPage/WebPage.h:
     68            * WebProcess/WebPage/WebPage.messages.in:
     69
    1702016-09-16  Babak Shafiei  <bshafiei@apple.com>
    271
  • branches/safari-602-branch/Source/WebKit2/Shared/NativeWebKeyboardEvent.h

    r185415 r206286  
    6161public:
    6262#if USE(APPKIT)
    63     NativeWebKeyboardEvent(NSEvent *, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>&);
     63    NativeWebKeyboardEvent(NSEvent *, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>&);
    6464#elif PLATFORM(GTK)
    6565    NativeWebKeyboardEvent(const NativeWebKeyboardEvent&);
  • branches/safari-602-branch/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm

    r165356 r206286  
    3636namespace WebKit {
    3737
    38 NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, const Vector<KeypressCommand>& commands)
    39     : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, handledByInputMethod, commands))
     38NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, bool replacesSoftSpace, const Vector<KeypressCommand>& commands)
     39    : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, handledByInputMethod, replacesSoftSpace, commands))
    4040    , m_nativeEvent(event)
    4141{
  • branches/safari-602-branch/Source/WebKit2/Shared/mac/WebEventFactory.h

    r182963 r206286  
    4545    static WebMouseEvent createWebMouseEvent(NSEvent *, NSEvent *lastPressureEvent, NSView *windowView);
    4646    static WebWheelEvent createWebWheelEvent(NSEvent *, NSView *windowView);
    47     static WebKeyboardEvent createWebKeyboardEvent(NSEvent *, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>&);
     47    static WebKeyboardEvent createWebKeyboardEvent(NSEvent *, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>&);
    4848    static bool shouldBeHandledAsContextClick(const WebCore::PlatformMouseEvent&);
    4949#endif // USE(APPKIT)
  • branches/safari-602-branch/Source/WebKit2/Shared/mac/WebEventFactory.mm

    r203085 r206286  
    237237}
    238238
    239 static inline String textFromEvent(NSEvent* event)
    240 {
     239static inline String textFromEvent(NSEvent* event, bool replacesSoftSpace)
     240{
     241    if (replacesSoftSpace)
     242        return emptyString();
    241243#pragma clang diagnostic push
    242244#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     
    247249}
    248250
    249 static inline String unmodifiedTextFromEvent(NSEvent* event)
    250 {
     251static inline String unmodifiedTextFromEvent(NSEvent* event, bool replacesSoftSpace)
     252{
     253    if (replacesSoftSpace)
     254        return emptyString();
    251255#pragma clang diagnostic push
    252256#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     
    458462}
    459463
    460 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands)
     464WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>& commands)
    461465{
    462466    WebEvent::Type type             = isKeyUpEvent(event) ? WebEvent::KeyUp : WebEvent::KeyDown;
    463     String text                     = textFromEvent(event);
    464     String unmodifiedText           = unmodifiedTextFromEvent(event);
     467    String text                     = textFromEvent(event, replacesSoftSpace);
     468    String unmodifiedText           = unmodifiedTextFromEvent(event, replacesSoftSpace);
    465469    String keyIdentifier            = keyIdentifierForKeyEvent(event);
    466470    int windowsVirtualKeyCode       = windowsKeyCodeForKeyEvent(event);
  • branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r205710 r206286  
    45534553    // Overridden by subclasses.
    45544554}
     4555
     4556- (void)_handleAcceptedCandidate:(NSTextCheckingResult *)candidate
     4557{
     4558#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     4559    _impl->handleAcceptedCandidate(candidate);
     4560#endif
     4561}
     4562
     4563- (void)_didHandleAcceptedCandidate
     4564{
     4565    // Overridden by subclasses.
     4566}
     4567
     4568- (void)_didUpdateCandidateListVisibility:(BOOL)visible
     4569{
     4570    // Overridden by subclasses.
     4571}
     4572
     4573- (void)_forceRequestCandidates
     4574{
     4575    _impl->forceRequestCandidatesForTesting();
     4576}
    45554577#endif // PLATFORM(MAC)
    45564578
  • branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r205705 r206286  
    271271- (void)_requestControlledElementID WK_API_AVAILABLE(macosx(WK_MAC_TBA));
    272272- (void)_handleControlledElementIDResponse:(NSString *)identifier WK_API_AVAILABLE(macosx(WK_MAC_TBA));
     273- (void)_handleAcceptedCandidate:(NSTextCheckingResult *)candidate WK_API_AVAILABLE(macosx(WK_MAC_TBA));
     274- (void)_didHandleAcceptedCandidate WK_API_AVAILABLE(macosx(WK_MAC_TBA));
     275- (void)_forceRequestCandidates WK_API_AVAILABLE(macosx(WK_MAC_TBA));
     276- (void)_didUpdateCandidateListVisibility:(BOOL)visible WK_API_AVAILABLE(macosx(WK_MAC_TBA));
    273277#endif
    274278
  • branches/safari-602-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r202878 r206286  
    970970}
    971971
     972- (void)_didHandleAcceptedCandidate
     973{
     974}
     975
     976- (void)_didUpdateCandidateListVisibility:(BOOL)visible
     977{
     978}
     979
    972980@end
    973981
  • branches/safari-602-branch/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h

    r203312 r206286  
    8585- (void)_web_didAddMediaControlsManager:(id)controlsManager;
    8686- (void)_web_didRemoveMediaControlsManager;
     87- (void)_didHandleAcceptedCandidate;
     88- (void)_didUpdateCandidateListVisibility:(BOOL)visible;
    8789
    8890@end
     
    479481
    480482    void updateWebViewImplAdditions();
     483    void forceRequestCandidatesForTesting();
    481484    bool shouldRequestCandidates() const;
    482485    void showCandidates(NSArray *candidates, NSString *, NSRect rectOfTypedString, NSRange selectedRange, NSView *, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate));
     
    650653    bool m_requiresUserActionForEditingControlsManager { false };
    651654    bool m_editableElementIsFocused { false };
     655    bool m_isTextInsertionReplacingSoftSpace { false };
    652656};
    653657   
  • branches/safari-602-branch/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm

    r203312 r206286  
    441441}
    442442
     443void WebViewImpl::forceRequestCandidatesForTesting()
     444{
     445}
     446
    443447bool WebViewImpl::shouldRequestCandidates() const
    444448{
     
    620624            keyboardEvent = event;
    621625#pragma clang diagnostic pop
    622         m_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, { }), [](WebKit::CallbackBase::Error) { });
     626        m_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, false, { }), [](WebKit::CallbackBase::Error) { });
    623627    }
    624628    return true;
     
    24302434{
    24312435    m_isHandlingAcceptedCandidate = false;
     2436
     2437    [m_view _didHandleAcceptedCandidate];
    24322438}
    24332439
     
    35613567        text = string;
    35623568
    3563     BOOL needToRemoveSoftSpace = NO;
     3569    m_isTextInsertionReplacingSoftSpace = false;
    35643570#if HAVE(ADVANCED_SPELL_CHECKING)
    35653571    if (m_softSpaceRange.location != NSNotFound && (replacementRange.location == NSMaxRange(m_softSpaceRange) || replacementRange.location == NSNotFound) && replacementRange.length == 0 && [[NSSpellChecker sharedSpellChecker] deletesAutospaceBeforeString:text language:nil]) {
    35663572        replacementRange = m_softSpaceRange;
    3567         needToRemoveSoftSpace = YES;
     3573        m_isTextInsertionReplacingSoftSpace = true;
    35683574    }
    35693575#endif
     
    35763582    // then we also execute it immediately, as there will be no other chance.
    35773583    Vector<WebCore::KeypressCommand>* keypressCommands = m_collectedKeypressCommands;
    3578     if (keypressCommands && !needToRemoveSoftSpace) {
     3584    if (keypressCommands && !m_isTextInsertionReplacingSoftSpace) {
    35793585        ASSERT(replacementRange.location == NSNotFound);
    35803586        WebCore::KeypressCommand command("insertText:", text);
     
    35903596        m_page->insertDictatedTextAsync(eventText, replacementRange, dictationAlternatives, registerUndoGroup);
    35913597    else
    3592         m_page->insertTextAsync(eventText, replacementRange, registerUndoGroup, needToRemoveSoftSpace ? EditingRangeIsRelativeTo::Paragraph : EditingRangeIsRelativeTo::EditableRoot);
     3598        m_page->insertTextAsync(eventText, replacementRange, registerUndoGroup, m_isTextInsertionReplacingSoftSpace ? EditingRangeIsRelativeTo::Paragraph : EditingRangeIsRelativeTo::EditableRoot, m_isTextInsertionReplacingSoftSpace);
    35933599}
    35943600
     
    38643870    if (m_view == m_view.window.firstResponder) {
    38653871        interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
    3866             m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
     3872            m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, false, commands));
    38673873        });
    38683874        return YES;
     
    38793885    LOG(TextInput, "keyUp:%p %@", event, event);
    38803886
     3887    m_isTextInsertionReplacingSoftSpace = false;
    38813888    interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
    38823889        ASSERT(!handledByInputMethod || commands.isEmpty());
    3883         m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
     3890        m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, m_isTextInsertionReplacingSoftSpace, commands));
    38843891    });
    38853892}
     
    39063913    }
    39073914
     3915    m_isTextInsertionReplacingSoftSpace = false;
    39083916    interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
    39093917        ASSERT(!handledByInputMethod || commands.isEmpty());
    3910         m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
     3918        m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, m_isTextInsertionReplacingSoftSpace, commands));
    39113919    });
    39123920}
     
    39243932
    39253933    interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
    3926         m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
     3934        m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, false, commands));
    39273935    });
    39283936}
  • branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r206053 r206286  
    61016101#if PLATFORM(COCOA)
    61026102
    6103 void WebPageProxy::insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup, EditingRangeIsRelativeTo editingRangeIsRelativeTo)
    6104 {
    6105     if (!isValid())
    6106         return;
    6107 
    6108     process().send(Messages::WebPage::InsertTextAsync(text, replacementRange, registerUndoGroup, static_cast<uint32_t>(editingRangeIsRelativeTo)), m_pageID);
     6103void WebPageProxy::insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup, EditingRangeIsRelativeTo editingRangeIsRelativeTo, bool suppressSelectionUpdate)
     6104{
     6105    if (!isValid())
     6106        return;
     6107
     6108    process().send(Messages::WebPage::InsertTextAsync(text, replacementRange, registerUndoGroup, static_cast<uint32_t>(editingRangeIsRelativeTo), suppressSelectionUpdate), m_pageID);
    61096109}
    61106110
  • branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.h

    r206053 r206286  
    564564    LayerOrView* acceleratedCompositingRootLayer() const;
    565565
    566     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot);
     566    void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
    567567    void getMarkedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)>);
    568568    void getSelectedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)>);
  • branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r206051 r206286  
    45784578#if PLATFORM(COCOA)
    45794579
    4580 void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo)
     4580void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate)
    45814581{
    45824582    Frame& frame = m_page->focusController().focusedOrMainFrame();
     
    45844584    if (replacementEditingRange.location != notFound) {
    45854585        RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange, static_cast<EditingRangeIsRelativeTo>(editingRangeIsRelativeTo));
    4586         if (replacementRange)
     4586        if (replacementRange) {
     4587            TemporaryChange<bool> isSelectingTextWhileInsertingAsynchronously(m_isSelectingTextWhileInsertingAsynchronously, suppressSelectionUpdate);
    45874588            frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
     4589        }
    45884590    }
    45894591   
     
    48084810    // then it will change back.
    48094811    if (m_isGettingDictionaryPopupInfo)
     4812        return;
     4813
     4814    // Similarly, we don't want to propagate changes to the web process when inserting text asynchronously, since we will
     4815    // end up with a range selection very briefly right before inserting the text.
     4816    if (m_isSelectingTextWhileInsertingAsynchronously)
    48104817        return;
    48114818
  • branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r206051 r206286  
    663663    void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
    664664
    665     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, uint32_t editingRangeIsRelativeTo = (uint32_t)EditingRangeIsRelativeTo::EditableRoot);
     665    void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, uint32_t editingRangeIsRelativeTo = (uint32_t)EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
    666666    void getMarkedRangeAsync(uint64_t callbackID);
    667667    void getSelectedRangeAsync(uint64_t callbackID);
     
    14741474    bool m_isEditorStateMissingPostLayoutData { false };
    14751475    bool m_isGettingDictionaryPopupInfo { false };
     1476    bool m_isSelectingTextWhileInsertingAsynchronously { false };
    14761477
    14771478    enum class EditorStateIsContentEditable { No, Yes, Unset };
  • branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r206051 r206286  
    365365    AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result)
    366366
    367     InsertTextAsync(String text, struct WebKit::EditingRange replacementRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo)
     367    InsertTextAsync(String text, struct WebKit::EditingRange replacementRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate)
    368368    GetMarkedRangeAsync(uint64_t callbackID)
    369369    GetSelectedRangeAsync(uint64_t callbackID)
  • branches/safari-602-branch/Tools/ChangeLog

    r206050 r206286  
     12016-09-22  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r206033. rdar://problem/28086237
     4
     5    2016-09-16  Wenson Hsieh  <wenson_hsieh@apple.com>
     6
     7            Inserting a space after inserting an accepted candidate scrolls the document and causes a flicker
     8            https://bugs.webkit.org/show_bug.cgi?id=162009
     9            <rdar://problem/28086237>
     10
     11            Reviewed by Tim Horton.
     12
     13            Adds 3 new text editing API tests covering candidate insertion, as well as support for testing candidates in
     14            WKWebViews. Refactors common WKWebView helpers across both VideoControlsManager tests and the new
     15            WKWebViewCandidateTests into a new utility class, TestWKWebView in TestWKWebView.mm, which is capable of
     16            simulating mouse and keyboard events as well as waiting for JavaScript messages sent from the web process and
     17            performing actions in response.
     18
     19            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     20            * TestWebKitAPI/Tests/WebKit/ios/audio-only.html:
     21            * TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html:
     22            * TestWebKitAPI/Tests/WebKit/ios/video-without-audio.html:
     23            * TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
     24            (TestWebKitAPI::TEST):
     25            (-[MessageHandler initWithMessage:handler:]): Deleted.
     26            (-[MessageHandler userContentController:didReceiveScriptMessage:]): Deleted.
     27            (-[VideoControlsManagerTestWebView mouseDownAtPoint:]): Deleted.
     28            (-[VideoControlsManagerTestWebView performAfterLoading:]): Deleted.
     29            (-[VideoControlsManagerTestWebView callJavascriptFunction:]): Deleted.
     30            (-[VideoControlsManagerTestWebView loadTestPageNamed:]): Deleted.
     31            (-[VideoControlsManagerTestWebView performAfterReceivingMessage:action:]): Deleted.
     32            * TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm: Added.
     33            (-[TestCandidate initWithReplacementString:inRange:]):
     34            (-[TestCandidate replacementString]):
     35            (-[TestCandidate resultType]):
     36            (-[TestCandidate range]):
     37            (-[CandidateTestWebView insertCandidatesAndWaitForResponse:range:]):
     38            (-[CandidateTestWebView _didHandleAcceptedCandidate]):
     39            (-[CandidateTestWebView expectCandidateListVisibilityUpdates:whenPerformingActions:]):
     40            (-[CandidateTestWebView _didUpdateCandidateListVisibility:]):
     41            (TEST):
     42            * TestWebKitAPI/Tests/WebKit2Cocoa/autoplaying-video-with-audio.html:
     43            * TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-click.html:
     44            * TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-end.html:
     45            * TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html:
     46            * TestWebKitAPI/Tests/WebKit2Cocoa/input-field-in-scrollable-document.html: Added.
     47            * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-hides-controls-after-seek-to-end.html:
     48            * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-mutes-onplaying.html:
     49            * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-offscreen.html:
     50            * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-playing-scroll-away.html:
     51            * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-after-ending.html:
     52            * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-to-beginning-and-play-after-ending.html:
     53            * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html:
     54            * TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html:
     55            * TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html:
     56            * TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-scroll-to-video.html:
     57            * TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-paused-video-hides-controls.html:
     58            * TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-muted-video-hides-controls.html:
     59            * TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-video-keeps-controls.html:
     60            * TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html:
     61            * TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html:
     62            * TestWebKitAPI/Tests/WebKit2Cocoa/wide-autoplaying-video-with-audio.html:
     63            * TestWebKitAPI/mac/TestWKWebViewMac.h: Added.
     64            * TestWebKitAPI/mac/TestWKWebViewMac.mm: Added.
     65            (-[TestMessageHandler initWithMessage:handler:]):
     66            (-[TestMessageHandler userContentController:didReceiveScriptMessage:]):
     67            (-[TestWKWebView mouseDownAtPoint:]):
     68            (-[TestWKWebView performAfterReceivingMessage:action:]):
     69            (-[TestWKWebView loadTestPageNamed:]):
     70            (-[TestWKWebView typeCharacter:]):
     71            (-[TestWKWebView stringByEvaluatingJavaScript:]):
     72            (-[TestWKWebView waitForMessage:]):
     73            (-[TestWKWebView performAfterLoading:]):
     74
    1752016-09-16  Babak Shafiei  <bshafiei@apple.com>
    276
  • branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r206050 r206286  
    7676                2EFF06C51D8867760004BB30 /* change-video-source-on-click.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */; };
    7777                2EFF06C71D886A580004BB30 /* change-video-source-on-end.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */; };
     78                2EFF06CD1D8A429A0004BB30 /* input-field-in-scrollable-document.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */; };
     79                2EFF06D41D8AEDBB0004BB30 /* TestWKWebViewMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D31D8AEDBB0004BB30 /* TestWKWebViewMac.mm */; };
     80                2EFF06D71D8AF34A0004BB30 /* WKWebViewCandidateTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */; };
    7881                33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */; };
    7982                33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33DC890E1419539300747EF7 /* simple-iframe.html */; };
     
    576579                                7A1458FC1AD5C07000E06772 /* mouse-button-listener.html in Copy Resources */,
    577580                                7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */,
     581                                2EFF06CD1D8A429A0004BB30 /* input-field-in-scrollable-document.html in Copy Resources */,
    578582                                2EFF06C71D886A580004BB30 /* change-video-source-on-end.html in Copy Resources */,
    579583                                2EFF06C51D8867760004BB30 /* change-video-source-on-click.html in Copy Resources */,
     
    762766                2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "change-video-source-on-click.html"; sourceTree = "<group>"; };
    763767                2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "change-video-source-on-end.html"; sourceTree = "<group>"; };
     768                2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "input-field-in-scrollable-document.html"; sourceTree = "<group>"; };
     769                2EFF06D21D8AEDBB0004BB30 /* TestWKWebViewMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestWKWebViewMac.h; sourceTree = "<group>"; };
     770                2EFF06D31D8AEDBB0004BB30 /* TestWKWebViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestWKWebViewMac.mm; sourceTree = "<group>"; };
     771                2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewCandidateTests.mm; sourceTree = "<group>"; };
    764772                333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; };
    765773                33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; };
     
    13211329                                2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
    13221330                                5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */,
     1331                                2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */,
    13231332                                7C417F311D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm */,
    13241333                                0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
     
    14051414                                2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */,
    14061415                                2E1DFDEE1D42A6EB00714A00 /* large-videos-with-audio-autoplay.html */,
     1416                                2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */,
    14071417                                2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */,
    14081418                                2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */,
     
    17491759                                29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */,
    17501760                                29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */,
     1761                                2EFF06D21D8AEDBB0004BB30 /* TestWKWebViewMac.h */,
     1762                                2EFF06D31D8AEDBB0004BB30 /* TestWKWebViewMac.mm */,
    17511763                                C08587BE13FE956C001EF4E5 /* WebKitAgnosticTest.h */,
    17521764                                C08587BD13FE956C001EF4E5 /* WebKitAgnosticTest.mm */,
     
    22592271                                7CCE7EFC1A411AE600447C4C /* InjectedBundleFrameHitTest.cpp in Sources */,
    22602272                                7CCE7EFD1A411AE600447C4C /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */,
     2273                                2EFF06D41D8AEDBB0004BB30 /* TestWKWebViewMac.mm in Sources */,
    22612274                                7CCE7EC31A411A7E00447C4C /* InspectorBar.mm in Sources */,
    22622275                                7CCE7EDA1A411A8700447C4C /* InstanceMethodSwizzler.mm in Sources */,
     
    23842397                                7CCE7ED91A411A7E00447C4C /* WindowlessWebViewWithMedia.mm in Sources */,
    23852398                                7C83E0B71D0A64B800FEBCF3 /* MenuTypesForMouseEvents.cpp in Sources */,
     2399                                2EFF06D71D8AF34A0004BB30 /* WKWebViewCandidateTests.mm in Sources */,
    23862400                                7CCE7F2E1A411B1000447C4C /* WKBrowsingContextGroupTest.mm in Sources */,
    23872401                                7CCE7F2F1A411B1000447C4C /* WKBrowsingContextLoadDelegateTest.mm in Sources */,
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit/ios/audio-only.html

    r197953 r206286  
    1313        window.clearTimeout(timeout);
    1414        try {
    15             window.webkit.messageHandlers.playingHandler.postMessage('playing');
     15            window.webkit.messageHandlers.testHandler.postMessage('playing');
    1616        } catch(e) {
    1717            window.location = 'callback:playing';
     
    2121    function notPlaying() {
    2222        try {
    23             window.webkit.messageHandlers.playingHandler.postMessage('not playing');
     23            window.webkit.messageHandlers.testHandler.postMessage('not playing');
    2424        } catch(e) { }
    2525    }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html

    r197953 r206286  
    1515        window.clearTimeout(timeout);
    1616        try {
    17             window.webkit.messageHandlers.playingHandler.postMessage('playing');
     17            window.webkit.messageHandlers.testHandler.postMessage('playing');
    1818        } catch(e) {
    1919            window.location = 'callback:playing';
     
    2323    function notPlaying() {
    2424        try {
    25             window.webkit.messageHandlers.playingHandler.postMessage('not playing');
     25            window.webkit.messageHandlers.testHandler.postMessage('not playing');
    2626        } catch(e) { }
    2727    }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit/ios/video-without-audio.html

    r197953 r206286  
    1313        window.clearTimeout(timeout);
    1414        try {
    15             window.webkit.messageHandlers.playingHandler.postMessage('playing');
     15            window.webkit.messageHandlers.testHandler.postMessage('playing');
    1616        } catch(e) {
    1717            window.location = 'callback:playing';
     
    2121    function notPlaying() {
    2222        try {
    23             window.webkit.messageHandlers.playingHandler.postMessage('not playing');
     23            window.webkit.messageHandlers.testHandler.postMessage('not playing');
    2424        } catch(e) { }
    2525    }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm

    r205952 r206286  
    2727
    2828#import "PlatformUtilities.h"
    29 
    30 #if PLATFORM(MAC)
    31 #import <Carbon/Carbon.h>
    32 #endif
     29#import "TestWKWebViewMac.h"
    3330
    3431#import <WebKit/WKWebViewConfigurationPrivate.h>
     
    4441@end
    4542
    46 @interface MessageHandler : NSObject <WKScriptMessageHandler>
    47 @end
    48 
    49 @implementation MessageHandler {
    50     dispatch_block_t _handler;
    51     NSString *_message;
    52 }
    53 
    54 - (instancetype)initWithMessage:(NSString *)message handler:(dispatch_block_t)handler
    55 {
    56     if (!(self = [super init]))
    57         return nil;
    58 
    59     _handler = [handler copy];
    60     _message = message;
    61 
    62     return self;
    63 }
    64 
    65 - (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message
    66 {
    67     if ([(NSString *)[message body] isEqualToString:_message] && _handler)
    68         _handler();
    69 }
    70 
    71 @end
    72 
    73 @interface VideoControlsManagerTestWebView : WKWebView
     43@interface VideoControlsManagerTestWebView : TestWKWebView
    7444@end
    7545
     
    7747    bool _isDoneQueryingControlledElementID;
    7848    NSString *_controlledElementID;
    79 }
    80 
    81 - (void)mouseDownAtPoint:(NSPoint)point {
    82     [self mouseDown:[NSEvent mouseEventWithType:NSEventTypeLeftMouseDown location:NSMakePoint(point.x, point.y) modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:0 context:[NSGraphicsContext currentContext] eventNumber:0 clickCount:0 pressure:0]];
    83 }
    84 
    85 - (void)performAfterLoading:(dispatch_block_t)actions {
    86     MessageHandler *handler = [[MessageHandler alloc] initWithMessage:@"loaded" handler:actions];
    87     NSString *onloadScript = @"window.onload = function() { window.webkit.messageHandlers.onloadHandler.postMessage('loaded'); }";
    88     WKUserScript *script = [[WKUserScript alloc] initWithSource:onloadScript injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO];
    89 
    90     WKUserContentController* contentController = [[self configuration] userContentController];
    91     [contentController addUserScript:script];
    92     [contentController addScriptMessageHandler:handler name:@"onloadHandler"];
    93 }
    94 
    95 - (void)callJavascriptFunction:(NSString *)functionName
    96 {
    97     NSString *command = [NSString stringWithFormat:@"%@()", functionName];
    98     [self evaluateJavaScript:command completionHandler:nil];
    99 }
    100 
    101 - (void)loadTestPageNamed:(NSString *)pageName
    102 {
    103     NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:pageName withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
    104     [self loadRequest:request];
    10549}
    10650
     
    13276}
    13377
    134 - (void)performAfterReceivingMessage:(NSString *)message action:(dispatch_block_t)action
    135 {
    136     RetainPtr<MessageHandler> handler = adoptNS([[MessageHandler alloc] initWithMessage:message handler:action]);
    137     WKUserContentController* contentController = [[self configuration] userContentController];
    138     [contentController removeScriptMessageHandlerForName:@"playingHandler"];
    139     [contentController addScriptMessageHandler:handler.get() name:@"playingHandler"];
    140 }
    141 
    14278- (void)waitForPageToLoadWithAutoplayingVideos:(int)numberOfAutoplayingVideos
    14379{
     
    241177    [webView waitForPageToLoadWithAutoplayingVideos:1];
    242178
    243     [webView callJavascriptFunction:@"pauseFirstVideoAndScrollToSecondVideo"];
     179    [webView stringByEvaluatingJavaScript:@"pauseFirstVideoAndScrollToSecondVideo()"];
    244180    [webView expectControlsManager:NO afterReceivingMessage:@"paused"];
    245181}
     
    252188    [webView waitForPageToLoadWithAutoplayingVideos:1];
    253189
    254     [webView callJavascriptFunction:@"scrollToSecondVideo"];
     190    [webView stringByEvaluatingJavaScript:@"scrollToSecondVideo()"];
    255191    [webView expectControlsManager:YES afterReceivingMessage:@"scrolled"];
    256192}
     
    263199    [webView waitForPageToLoadWithAutoplayingVideos:1];
    264200
    265     [webView callJavascriptFunction:@"muteFirstVideoAndScrollToSecondVideo"];
     201    [webView stringByEvaluatingJavaScript:@"muteFirstVideoAndScrollToSecondVideo()"];
    266202    [webView expectControlsManager:NO afterReceivingMessage:@"playing"];
    267203}
     
    301237    [webView waitForPageToLoadWithAutoplayingVideos:2];
    302238
    303     [webView callJavascriptFunction:@"scrollToSecondView"];
     239    [webView stringByEvaluatingJavaScript:@"scrollToSecondView()"];
    304240    [webView expectControlsManager:YES afterReceivingMessage:@"scrolled"];
    305241
     
    313249    [webView loadTestPageNamed:@"large-video-playing-scroll-away"];
    314250    [webView waitForPageToLoadWithAutoplayingVideos:1];
    315     [webView callJavascriptFunction:@"scrollVideoOutOfView"];
     251    [webView stringByEvaluatingJavaScript:@"scrollVideoOutOfView()"];
    316252    [webView expectControlsManager:YES afterReceivingMessage:@"scrolled"];
    317253}
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autoplaying-video-with-audio.html

    r205706 r206286  
    1313        setTimeout(function() {
    1414            try {
    15                 window.webkit.messageHandlers.playingHandler.postMessage("paused");
     15                window.webkit.messageHandlers.testHandler.postMessage("paused");
    1616            } catch(e) { }
    1717        }, 0);
     
    2121        setTimeout(function() {
    2222            try {
    23                 window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     23                window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    2424            } catch(e) {
    2525            }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-click.html

    r205952 r206286  
    1313            setTimeout(function() {
    1414                try {
    15                     window.webkit.messageHandlers.playingHandler.postMessage("changed");
     15                    window.webkit.messageHandlers.testHandler.postMessage("changed");
    1616                } catch(e) {
    1717                }
     
    2222            setTimeout(function() {
    2323                try {
    24                     window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     24                    window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    2525                } catch(e) {
    2626                }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-end.html

    r205952 r206286  
    1515            setTimeout(function() {
    1616                try {
    17                     window.webkit.messageHandlers.playingHandler.postMessage("changed");
     17                    window.webkit.messageHandlers.testHandler.postMessage("changed");
    1818                } catch(e) {
    1919                }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html

    r203968 r206286  
    1212        setTimeout(function() {
    1313            try {
    14                 window.webkit.messageHandlers.playingHandler.postMessage("playing");
     14                window.webkit.messageHandlers.testHandler.postMessage("playing");
    1515            } catch(e) { }
    1616        }, 0);
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-hides-controls-after-seek-to-end.html

    r205706 r206286  
    88        setTimeout(function() {
    99            try {
    10                 window.webkit.messageHandlers.playingHandler.postMessage("ended");
     10                window.webkit.messageHandlers.testHandler.postMessage("ended");
    1111            } catch(e) { }
    1212        }, 0);
     
    2727        setTimeout(function() {
    2828            try {
    29                 window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     29                window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    3030            } catch(e) {
    3131            }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-mutes-onplaying.html

    r205706 r206286  
    44    function handlePlaying() {
    55        try {
    6             window.webkit.messageHandlers.playingHandler.postMessage("playing");
     6            window.webkit.messageHandlers.testHandler.postMessage("playing");
    77        } catch(e) {
    88        }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-offscreen.html

    r205952 r206286  
    1717            setTimeout(function() {
    1818                try {
    19                     window.webkit.messageHandlers.playingHandler.postMessage("moved");
     19                    window.webkit.messageHandlers.testHandler.postMessage("moved");
    2020                } catch(e) {
    2121                }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-playing-scroll-away.html

    r205706 r206286  
    1515                document.querySelector("div").scrollIntoView();
    1616                setTimeout(function() {
    17                     window.webkit.messageHandlers.playingHandler.postMessage("scrolled");
     17                    window.webkit.messageHandlers.testHandler.postMessage("scrolled");
    1818                }, 0);
    1919            }
     
    2222                setTimeout(function() {
    2323                    try {
    24                         window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     24                        window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    2525                    } catch(e) {
    2626                    }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-after-ending.html

    r203871 r206286  
    77            // The media controls should be updated on the next runloop.
    88            setTimeout(function() {
    9                 window.webkit.messageHandlers.playingHandler.postMessage("ended");
     9                window.webkit.messageHandlers.testHandler.postMessage("ended");
    1010            }, 0);
    1111        }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-to-beginning-and-play-after-ending.html

    r203871 r206286  
    99            // The media controls should be updated on the next runloop.
    1010            setTimeout(function() {
    11                 window.webkit.messageHandlers.playingHandler.postMessage("replaying");
     11                window.webkit.messageHandlers.testHandler.postMessage("replaying");
    1212            }, 0);
    1313        }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html

    r203875 r206286  
    1515        setTimeout(function() {
    1616            try {
    17                 window.webkit.messageHandlers.playingHandler.postMessage('playing');
     17                window.webkit.messageHandlers.testHandler.postMessage('playing');
    1818            } catch(e) {
    1919                window.location = 'callback:playing';
     
    2424    function notPlaying() {
    2525        try {
    26             window.webkit.messageHandlers.playingHandler.postMessage('not playing');
     26            window.webkit.messageHandlers.testHandler.postMessage('not playing');
    2727        } catch(e) { }
    2828    }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html

    r200403 r206286  
    1414        window.clearTimeout(timeout);
    1515        try {
    16             window.webkit.messageHandlers.playingHandler.postMessage('playing');
     16            window.webkit.messageHandlers.testHandler.postMessage('playing');
    1717        } catch(e) {
    1818            window.location = 'callback:playing';
     
    2222    function notPlaying() {
    2323        try {
    24             window.webkit.messageHandlers.playingHandler.postMessage('not playing');
     24            window.webkit.messageHandlers.testHandler.postMessage('not playing');
    2525        } catch(e) { }
    2626    }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html

    r205706 r206286  
    1818                setTimeout(function() {
    1919                    try {
    20                         window.webkit.messageHandlers.playingHandler.postMessage("paused");
     20                        window.webkit.messageHandlers.testHandler.postMessage("paused");
    2121                    } catch(e) { }
    2222                }, 0);
     
    2626                setTimeout(function() {
    2727                    try {
    28                         window.webkit.messageHandlers.playingHandler.postMessage("paused");
     28                        window.webkit.messageHandlers.testHandler.postMessage("paused");
    2929                    } catch(e) { }
    3030                }, 0);
     
    3434                setTimeout(function() {
    3535                    try {
    36                         window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     36                        window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    3737                    } catch(e) {
    3838                    }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-scroll-to-video.html

    r205706 r206286  
    1515                document.querySelector("#second").scrollIntoView();
    1616                setTimeout(function() {
    17                     window.webkit.messageHandlers.playingHandler.postMessage("scrolled");
     17                    window.webkit.messageHandlers.testHandler.postMessage("scrolled");
    1818                }, 0);
    1919            }
     
    2121                setTimeout(function() {
    2222                    try {
    23                         window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     23                        window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    2424                    } catch(e) {
    2525                    }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-paused-video-hides-controls.html

    r205706 r206286  
    1818        setTimeout(function() {
    1919            try {
    20                 window.webkit.messageHandlers.playingHandler.postMessage("paused");
     20                window.webkit.messageHandlers.testHandler.postMessage("paused");
    2121            } catch(e) { }
    2222        }, 0);
     
    2525        setTimeout(function() {
    2626            try {
    27                 window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     27                window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    2828            } catch(e) {
    2929            }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-muted-video-hides-controls.html

    r205706 r206286  
    1616        setTimeout(function() {
    1717            try {
    18                 window.webkit.messageHandlers.playingHandler.postMessage("playing");
     18                window.webkit.messageHandlers.testHandler.postMessage("playing");
    1919            } catch(e) { }
    2020        }, 0);
     
    2323        setTimeout(function() {
    2424            try {
    25                 window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     25                window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    2626            } catch(e) {
    2727            }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-video-keeps-controls.html

    r205706 r206286  
    1515        setTimeout(function() {
    1616            try {
    17                 window.webkit.messageHandlers.playingHandler.postMessage("scrolled");
     17                window.webkit.messageHandlers.testHandler.postMessage("scrolled");
    1818            } catch(e) { }
    1919        }, 0);
     
    2222        setTimeout(function() {
    2323            try {
    24                 window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     24                window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    2525            } catch(e) {
    2626            }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html

    r205706 r206286  
    55        setTimeout(function() {
    66            try {
    7                 window.webkit.messageHandlers.playingHandler.postMessage("autoplayed");
     7                window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
    88            } catch(e) {
    99            }
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html

    r203968 r206286  
    1212        setTimeout(function() {
    1313            try {
    14                 window.webkit.messageHandlers.playingHandler.postMessage("playing");
     14                window.webkit.messageHandlers.testHandler.postMessage("playing");
    1515            } catch(e) { }
    1616        }, 0);
  • branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/wide-autoplaying-video-with-audio.html

    r205799 r206286  
    1212        setTimeout(function() {
    1313            try {
    14                 window.webkit.messageHandlers.playingHandler.postMessage("playing");
     14                window.webkit.messageHandlers.testHandler.postMessage("playing");
    1515            } catch(e) { }
    1616        }, 0);
  • branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h

    r206273 r206286  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import "config.h"
    27 #import "NativeWebKeyboardEvent.h"
     26#ifndef TestWKWebViewMac_h
     27#define TestWKWebViewMac_h
    2828
    29 #if USE(APPKIT)
     29#import <WebKit/WebKit.h>
    3030
    31 #import "WebEventFactory.h"
    32 #import <WebCore/KeyboardEvent.h>
     31#if WK_API_ENABLED && PLATFORM(MAC)
    3332
    34 using namespace WebCore;
     33@interface TestMessageHandler : NSObject <WKScriptMessageHandler>
     34- (instancetype)initWithMessage:(NSString *)message handler:(dispatch_block_t)handler;
     35@end
    3536
    36 namespace WebKit {
     37@interface TestWKWebView : WKWebView
     38- (void)mouseDownAtPoint:(NSPoint)point;
     39- (void)performAfterReceivingMessage:(NSString *)message action:(dispatch_block_t)action;
     40- (void)loadTestPageNamed:(NSString *)pageName;
     41- (void)typeCharacter:(char)character;
     42- (NSString *)stringByEvaluatingJavaScript:(NSString *)script;
     43- (void)waitForMessage:(NSString *)message;
     44- (void)performAfterLoading:(dispatch_block_t)actions;
     45@end
    3746
    38 NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, const Vector<KeypressCommand>& commands)
    39     : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, handledByInputMethod, commands))
    40     , m_nativeEvent(event)
    41 {
    42 }
     47#endif /* WK_API_ENABLED && PLATFORM(MAC) */
    4348
    44 } // namespace WebKit
    45 
    46 #endif // USE(APPKIT)
     49#endif /* TestWKWebViewMac_h */
Note: See TracChangeset for help on using the changeset viewer.