Changeset 206286 in webkit
- Timestamp:
- Sep 22, 2016 7:10:48 PM (8 years ago)
- 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 1 2016-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 1 70 2016-09-16 Babak Shafiei <bshafiei@apple.com> 2 71 -
branches/safari-602-branch/Source/WebKit2/Shared/NativeWebKeyboardEvent.h
r185415 r206286 61 61 public: 62 62 #if USE(APPKIT) 63 NativeWebKeyboardEvent(NSEvent *, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>&);63 NativeWebKeyboardEvent(NSEvent *, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>&); 64 64 #elif PLATFORM(GTK) 65 65 NativeWebKeyboardEvent(const NativeWebKeyboardEvent&); -
branches/safari-602-branch/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm
r165356 r206286 36 36 namespace WebKit { 37 37 38 NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, const Vector<KeypressCommand>& commands)39 : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, handledByInputMethod, commands))38 NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, bool replacesSoftSpace, const Vector<KeypressCommand>& commands) 39 : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, handledByInputMethod, replacesSoftSpace, commands)) 40 40 , m_nativeEvent(event) 41 41 { -
branches/safari-602-branch/Source/WebKit2/Shared/mac/WebEventFactory.h
r182963 r206286 45 45 static WebMouseEvent createWebMouseEvent(NSEvent *, NSEvent *lastPressureEvent, NSView *windowView); 46 46 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>&); 48 48 static bool shouldBeHandledAsContextClick(const WebCore::PlatformMouseEvent&); 49 49 #endif // USE(APPKIT) -
branches/safari-602-branch/Source/WebKit2/Shared/mac/WebEventFactory.mm
r203085 r206286 237 237 } 238 238 239 static inline String textFromEvent(NSEvent* event) 240 { 239 static inline String textFromEvent(NSEvent* event, bool replacesSoftSpace) 240 { 241 if (replacesSoftSpace) 242 return emptyString(); 241 243 #pragma clang diagnostic push 242 244 #pragma clang diagnostic ignored "-Wdeprecated-declarations" … … 247 249 } 248 250 249 static inline String unmodifiedTextFromEvent(NSEvent* event) 250 { 251 static inline String unmodifiedTextFromEvent(NSEvent* event, bool replacesSoftSpace) 252 { 253 if (replacesSoftSpace) 254 return emptyString(); 251 255 #pragma clang diagnostic push 252 256 #pragma clang diagnostic ignored "-Wdeprecated-declarations" … … 458 462 } 459 463 460 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands)464 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>& commands) 461 465 { 462 466 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); 465 469 String keyIdentifier = keyIdentifierForKeyEvent(event); 466 470 int windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event); -
branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r205710 r206286 4553 4553 // Overridden by subclasses. 4554 4554 } 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 } 4555 4577 #endif // PLATFORM(MAC) 4556 4578 -
branches/safari-602-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r205705 r206286 271 271 - (void)_requestControlledElementID WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 272 272 - (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)); 273 277 #endif 274 278 -
branches/safari-602-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm
r202878 r206286 970 970 } 971 971 972 - (void)_didHandleAcceptedCandidate 973 { 974 } 975 976 - (void)_didUpdateCandidateListVisibility:(BOOL)visible 977 { 978 } 979 972 980 @end 973 981 -
branches/safari-602-branch/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h
r203312 r206286 85 85 - (void)_web_didAddMediaControlsManager:(id)controlsManager; 86 86 - (void)_web_didRemoveMediaControlsManager; 87 - (void)_didHandleAcceptedCandidate; 88 - (void)_didUpdateCandidateListVisibility:(BOOL)visible; 87 89 88 90 @end … … 479 481 480 482 void updateWebViewImplAdditions(); 483 void forceRequestCandidatesForTesting(); 481 484 bool shouldRequestCandidates() const; 482 485 void showCandidates(NSArray *candidates, NSString *, NSRect rectOfTypedString, NSRange selectedRange, NSView *, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate)); … … 650 653 bool m_requiresUserActionForEditingControlsManager { false }; 651 654 bool m_editableElementIsFocused { false }; 655 bool m_isTextInsertionReplacingSoftSpace { false }; 652 656 }; 653 657 -
branches/safari-602-branch/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm
r203312 r206286 441 441 } 442 442 443 void WebViewImpl::forceRequestCandidatesForTesting() 444 { 445 } 446 443 447 bool WebViewImpl::shouldRequestCandidates() const 444 448 { … … 620 624 keyboardEvent = event; 621 625 #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) { }); 623 627 } 624 628 return true; … … 2430 2434 { 2431 2435 m_isHandlingAcceptedCandidate = false; 2436 2437 [m_view _didHandleAcceptedCandidate]; 2432 2438 } 2433 2439 … … 3561 3567 text = string; 3562 3568 3563 BOOL needToRemoveSoftSpace = NO;3569 m_isTextInsertionReplacingSoftSpace = false; 3564 3570 #if HAVE(ADVANCED_SPELL_CHECKING) 3565 3571 if (m_softSpaceRange.location != NSNotFound && (replacementRange.location == NSMaxRange(m_softSpaceRange) || replacementRange.location == NSNotFound) && replacementRange.length == 0 && [[NSSpellChecker sharedSpellChecker] deletesAutospaceBeforeString:text language:nil]) { 3566 3572 replacementRange = m_softSpaceRange; 3567 needToRemoveSoftSpace = YES;3573 m_isTextInsertionReplacingSoftSpace = true; 3568 3574 } 3569 3575 #endif … … 3576 3582 // then we also execute it immediately, as there will be no other chance. 3577 3583 Vector<WebCore::KeypressCommand>* keypressCommands = m_collectedKeypressCommands; 3578 if (keypressCommands && ! needToRemoveSoftSpace) {3584 if (keypressCommands && !m_isTextInsertionReplacingSoftSpace) { 3579 3585 ASSERT(replacementRange.location == NSNotFound); 3580 3586 WebCore::KeypressCommand command("insertText:", text); … … 3590 3596 m_page->insertDictatedTextAsync(eventText, replacementRange, dictationAlternatives, registerUndoGroup); 3591 3597 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); 3593 3599 } 3594 3600 … … 3864 3870 if (m_view == m_view.window.firstResponder) { 3865 3871 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)); 3867 3873 }); 3868 3874 return YES; … … 3879 3885 LOG(TextInput, "keyUp:%p %@", event, event); 3880 3886 3887 m_isTextInsertionReplacingSoftSpace = false; 3881 3888 interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) { 3882 3889 ASSERT(!handledByInputMethod || commands.isEmpty()); 3883 m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));3890 m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, m_isTextInsertionReplacingSoftSpace, commands)); 3884 3891 }); 3885 3892 } … … 3906 3913 } 3907 3914 3915 m_isTextInsertionReplacingSoftSpace = false; 3908 3916 interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) { 3909 3917 ASSERT(!handledByInputMethod || commands.isEmpty()); 3910 m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));3918 m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, m_isTextInsertionReplacingSoftSpace, commands)); 3911 3919 }); 3912 3920 } … … 3924 3932 3925 3933 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)); 3927 3935 }); 3928 3936 } -
branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp
r206053 r206286 6101 6101 #if PLATFORM(COCOA) 6102 6102 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);6103 void 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); 6109 6109 } 6110 6110 -
branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.h
r206053 r206286 564 564 LayerOrView* acceleratedCompositingRootLayer() const; 565 565 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); 567 567 void getMarkedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)>); 568 568 void getSelectedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)>); -
branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r206051 r206286 4578 4578 #if PLATFORM(COCOA) 4579 4579 4580 void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo )4580 void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate) 4581 4581 { 4582 4582 Frame& frame = m_page->focusController().focusedOrMainFrame(); … … 4584 4584 if (replacementEditingRange.location != notFound) { 4585 4585 RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange, static_cast<EditingRangeIsRelativeTo>(editingRangeIsRelativeTo)); 4586 if (replacementRange) 4586 if (replacementRange) { 4587 TemporaryChange<bool> isSelectingTextWhileInsertingAsynchronously(m_isSelectingTextWhileInsertingAsynchronously, suppressSelectionUpdate); 4587 4588 frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY)); 4589 } 4588 4590 } 4589 4591 … … 4808 4810 // then it will change back. 4809 4811 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) 4810 4817 return; 4811 4818 -
branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h
r206051 r206286 663 663 void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput); 664 664 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); 666 666 void getMarkedRangeAsync(uint64_t callbackID); 667 667 void getSelectedRangeAsync(uint64_t callbackID); … … 1474 1474 bool m_isEditorStateMissingPostLayoutData { false }; 1475 1475 bool m_isGettingDictionaryPopupInfo { false }; 1476 bool m_isSelectingTextWhileInsertingAsynchronously { false }; 1476 1477 1477 1478 enum class EditorStateIsContentEditable { No, Yes, Unset }; -
branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r206051 r206286 365 365 AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) 366 366 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) 368 368 GetMarkedRangeAsync(uint64_t callbackID) 369 369 GetSelectedRangeAsync(uint64_t callbackID) -
branches/safari-602-branch/Tools/ChangeLog
r206050 r206286 1 2016-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 1 75 2016-09-16 Babak Shafiei <bshafiei@apple.com> 2 76 -
branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r206050 r206286 76 76 2EFF06C51D8867760004BB30 /* change-video-source-on-click.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */; }; 77 77 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 */; }; 78 81 33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */; }; 79 82 33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33DC890E1419539300747EF7 /* simple-iframe.html */; }; … … 576 579 7A1458FC1AD5C07000E06772 /* mouse-button-listener.html in Copy Resources */, 577 580 7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */, 581 2EFF06CD1D8A429A0004BB30 /* input-field-in-scrollable-document.html in Copy Resources */, 578 582 2EFF06C71D886A580004BB30 /* change-video-source-on-end.html in Copy Resources */, 579 583 2EFF06C51D8867760004BB30 /* change-video-source-on-click.html in Copy Resources */, … … 762 766 2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "change-video-source-on-click.html"; sourceTree = "<group>"; }; 763 767 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>"; }; 764 772 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; }; 765 773 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; }; … … 1321 1329 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */, 1322 1330 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */, 1331 2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */, 1323 1332 7C417F311D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm */, 1324 1333 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */, … … 1405 1414 2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */, 1406 1415 2E1DFDEE1D42A6EB00714A00 /* large-videos-with-audio-autoplay.html */, 1416 2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */, 1407 1417 2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */, 1408 1418 2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */, … … 1749 1759 29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */, 1750 1760 29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */, 1761 2EFF06D21D8AEDBB0004BB30 /* TestWKWebViewMac.h */, 1762 2EFF06D31D8AEDBB0004BB30 /* TestWKWebViewMac.mm */, 1751 1763 C08587BE13FE956C001EF4E5 /* WebKitAgnosticTest.h */, 1752 1764 C08587BD13FE956C001EF4E5 /* WebKitAgnosticTest.mm */, … … 2259 2271 7CCE7EFC1A411AE600447C4C /* InjectedBundleFrameHitTest.cpp in Sources */, 2260 2272 7CCE7EFD1A411AE600447C4C /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */, 2273 2EFF06D41D8AEDBB0004BB30 /* TestWKWebViewMac.mm in Sources */, 2261 2274 7CCE7EC31A411A7E00447C4C /* InspectorBar.mm in Sources */, 2262 2275 7CCE7EDA1A411A8700447C4C /* InstanceMethodSwizzler.mm in Sources */, … … 2384 2397 7CCE7ED91A411A7E00447C4C /* WindowlessWebViewWithMedia.mm in Sources */, 2385 2398 7C83E0B71D0A64B800FEBCF3 /* MenuTypesForMouseEvents.cpp in Sources */, 2399 2EFF06D71D8AF34A0004BB30 /* WKWebViewCandidateTests.mm in Sources */, 2386 2400 7CCE7F2E1A411B1000447C4C /* WKBrowsingContextGroupTest.mm in Sources */, 2387 2401 7CCE7F2F1A411B1000447C4C /* WKBrowsingContextLoadDelegateTest.mm in Sources */, -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit/ios/audio-only.html
r197953 r206286 13 13 window.clearTimeout(timeout); 14 14 try { 15 window.webkit.messageHandlers. playingHandler.postMessage('playing');15 window.webkit.messageHandlers.testHandler.postMessage('playing'); 16 16 } catch(e) { 17 17 window.location = 'callback:playing'; … … 21 21 function notPlaying() { 22 22 try { 23 window.webkit.messageHandlers. playingHandler.postMessage('not playing');23 window.webkit.messageHandlers.testHandler.postMessage('not playing'); 24 24 } catch(e) { } 25 25 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html
r197953 r206286 15 15 window.clearTimeout(timeout); 16 16 try { 17 window.webkit.messageHandlers. playingHandler.postMessage('playing');17 window.webkit.messageHandlers.testHandler.postMessage('playing'); 18 18 } catch(e) { 19 19 window.location = 'callback:playing'; … … 23 23 function notPlaying() { 24 24 try { 25 window.webkit.messageHandlers. playingHandler.postMessage('not playing');25 window.webkit.messageHandlers.testHandler.postMessage('not playing'); 26 26 } catch(e) { } 27 27 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit/ios/video-without-audio.html
r197953 r206286 13 13 window.clearTimeout(timeout); 14 14 try { 15 window.webkit.messageHandlers. playingHandler.postMessage('playing');15 window.webkit.messageHandlers.testHandler.postMessage('playing'); 16 16 } catch(e) { 17 17 window.location = 'callback:playing'; … … 21 21 function notPlaying() { 22 22 try { 23 window.webkit.messageHandlers. playingHandler.postMessage('not playing');23 window.webkit.messageHandlers.testHandler.postMessage('not playing'); 24 24 } catch(e) { } 25 25 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm
r205952 r206286 27 27 28 28 #import "PlatformUtilities.h" 29 30 #if PLATFORM(MAC) 31 #import <Carbon/Carbon.h> 32 #endif 29 #import "TestWKWebViewMac.h" 33 30 34 31 #import <WebKit/WKWebViewConfigurationPrivate.h> … … 44 41 @end 45 42 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 74 44 @end 75 45 … … 77 47 bool _isDoneQueryingControlledElementID; 78 48 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 *)functionName96 {97 NSString *command = [NSString stringWithFormat:@"%@()", functionName];98 [self evaluateJavaScript:command completionHandler:nil];99 }100 101 - (void)loadTestPageNamed:(NSString *)pageName102 {103 NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:pageName withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];104 [self loadRequest:request];105 49 } 106 50 … … 132 76 } 133 77 134 - (void)performAfterReceivingMessage:(NSString *)message action:(dispatch_block_t)action135 {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 142 78 - (void)waitForPageToLoadWithAutoplayingVideos:(int)numberOfAutoplayingVideos 143 79 { … … 241 177 [webView waitForPageToLoadWithAutoplayingVideos:1]; 242 178 243 [webView callJavascriptFunction:@"pauseFirstVideoAndScrollToSecondVideo"];179 [webView stringByEvaluatingJavaScript:@"pauseFirstVideoAndScrollToSecondVideo()"]; 244 180 [webView expectControlsManager:NO afterReceivingMessage:@"paused"]; 245 181 } … … 252 188 [webView waitForPageToLoadWithAutoplayingVideos:1]; 253 189 254 [webView callJavascriptFunction:@"scrollToSecondVideo"];190 [webView stringByEvaluatingJavaScript:@"scrollToSecondVideo()"]; 255 191 [webView expectControlsManager:YES afterReceivingMessage:@"scrolled"]; 256 192 } … … 263 199 [webView waitForPageToLoadWithAutoplayingVideos:1]; 264 200 265 [webView callJavascriptFunction:@"muteFirstVideoAndScrollToSecondVideo"];201 [webView stringByEvaluatingJavaScript:@"muteFirstVideoAndScrollToSecondVideo()"]; 266 202 [webView expectControlsManager:NO afterReceivingMessage:@"playing"]; 267 203 } … … 301 237 [webView waitForPageToLoadWithAutoplayingVideos:2]; 302 238 303 [webView callJavascriptFunction:@"scrollToSecondView"];239 [webView stringByEvaluatingJavaScript:@"scrollToSecondView()"]; 304 240 [webView expectControlsManager:YES afterReceivingMessage:@"scrolled"]; 305 241 … … 313 249 [webView loadTestPageNamed:@"large-video-playing-scroll-away"]; 314 250 [webView waitForPageToLoadWithAutoplayingVideos:1]; 315 [webView callJavascriptFunction:@"scrollVideoOutOfView"];251 [webView stringByEvaluatingJavaScript:@"scrollVideoOutOfView()"]; 316 252 [webView expectControlsManager:YES afterReceivingMessage:@"scrolled"]; 317 253 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autoplaying-video-with-audio.html
r205706 r206286 13 13 setTimeout(function() { 14 14 try { 15 window.webkit.messageHandlers. playingHandler.postMessage("paused");15 window.webkit.messageHandlers.testHandler.postMessage("paused"); 16 16 } catch(e) { } 17 17 }, 0); … … 21 21 setTimeout(function() { 22 22 try { 23 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");23 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 24 24 } catch(e) { 25 25 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-click.html
r205952 r206286 13 13 setTimeout(function() { 14 14 try { 15 window.webkit.messageHandlers. playingHandler.postMessage("changed");15 window.webkit.messageHandlers.testHandler.postMessage("changed"); 16 16 } catch(e) { 17 17 } … … 22 22 setTimeout(function() { 23 23 try { 24 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");24 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 25 25 } catch(e) { 26 26 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-end.html
r205952 r206286 15 15 setTimeout(function() { 16 16 try { 17 window.webkit.messageHandlers. playingHandler.postMessage("changed");17 window.webkit.messageHandlers.testHandler.postMessage("changed"); 18 18 } catch(e) { 19 19 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html
r203968 r206286 12 12 setTimeout(function() { 13 13 try { 14 window.webkit.messageHandlers. playingHandler.postMessage("playing");14 window.webkit.messageHandlers.testHandler.postMessage("playing"); 15 15 } catch(e) { } 16 16 }, 0); -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-hides-controls-after-seek-to-end.html
r205706 r206286 8 8 setTimeout(function() { 9 9 try { 10 window.webkit.messageHandlers. playingHandler.postMessage("ended");10 window.webkit.messageHandlers.testHandler.postMessage("ended"); 11 11 } catch(e) { } 12 12 }, 0); … … 27 27 setTimeout(function() { 28 28 try { 29 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");29 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 30 30 } catch(e) { 31 31 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-mutes-onplaying.html
r205706 r206286 4 4 function handlePlaying() { 5 5 try { 6 window.webkit.messageHandlers. playingHandler.postMessage("playing");6 window.webkit.messageHandlers.testHandler.postMessage("playing"); 7 7 } catch(e) { 8 8 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-offscreen.html
r205952 r206286 17 17 setTimeout(function() { 18 18 try { 19 window.webkit.messageHandlers. playingHandler.postMessage("moved");19 window.webkit.messageHandlers.testHandler.postMessage("moved"); 20 20 } catch(e) { 21 21 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-playing-scroll-away.html
r205706 r206286 15 15 document.querySelector("div").scrollIntoView(); 16 16 setTimeout(function() { 17 window.webkit.messageHandlers. playingHandler.postMessage("scrolled");17 window.webkit.messageHandlers.testHandler.postMessage("scrolled"); 18 18 }, 0); 19 19 } … … 22 22 setTimeout(function() { 23 23 try { 24 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");24 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 25 25 } catch(e) { 26 26 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-after-ending.html
r203871 r206286 7 7 // The media controls should be updated on the next runloop. 8 8 setTimeout(function() { 9 window.webkit.messageHandlers. playingHandler.postMessage("ended");9 window.webkit.messageHandlers.testHandler.postMessage("ended"); 10 10 }, 0); 11 11 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-to-beginning-and-play-after-ending.html
r203871 r206286 9 9 // The media controls should be updated on the next runloop. 10 10 setTimeout(function() { 11 window.webkit.messageHandlers. playingHandler.postMessage("replaying");11 window.webkit.messageHandlers.testHandler.postMessage("replaying"); 12 12 }, 0); 13 13 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html
r203875 r206286 15 15 setTimeout(function() { 16 16 try { 17 window.webkit.messageHandlers. playingHandler.postMessage('playing');17 window.webkit.messageHandlers.testHandler.postMessage('playing'); 18 18 } catch(e) { 19 19 window.location = 'callback:playing'; … … 24 24 function notPlaying() { 25 25 try { 26 window.webkit.messageHandlers. playingHandler.postMessage('not playing');26 window.webkit.messageHandlers.testHandler.postMessage('not playing'); 27 27 } catch(e) { } 28 28 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html
r200403 r206286 14 14 window.clearTimeout(timeout); 15 15 try { 16 window.webkit.messageHandlers. playingHandler.postMessage('playing');16 window.webkit.messageHandlers.testHandler.postMessage('playing'); 17 17 } catch(e) { 18 18 window.location = 'callback:playing'; … … 22 22 function notPlaying() { 23 23 try { 24 window.webkit.messageHandlers. playingHandler.postMessage('not playing');24 window.webkit.messageHandlers.testHandler.postMessage('not playing'); 25 25 } catch(e) { } 26 26 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html
r205706 r206286 18 18 setTimeout(function() { 19 19 try { 20 window.webkit.messageHandlers. playingHandler.postMessage("paused");20 window.webkit.messageHandlers.testHandler.postMessage("paused"); 21 21 } catch(e) { } 22 22 }, 0); … … 26 26 setTimeout(function() { 27 27 try { 28 window.webkit.messageHandlers. playingHandler.postMessage("paused");28 window.webkit.messageHandlers.testHandler.postMessage("paused"); 29 29 } catch(e) { } 30 30 }, 0); … … 34 34 setTimeout(function() { 35 35 try { 36 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");36 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 37 37 } catch(e) { 38 38 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-scroll-to-video.html
r205706 r206286 15 15 document.querySelector("#second").scrollIntoView(); 16 16 setTimeout(function() { 17 window.webkit.messageHandlers. playingHandler.postMessage("scrolled");17 window.webkit.messageHandlers.testHandler.postMessage("scrolled"); 18 18 }, 0); 19 19 } … … 21 21 setTimeout(function() { 22 22 try { 23 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");23 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 24 24 } catch(e) { 25 25 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-paused-video-hides-controls.html
r205706 r206286 18 18 setTimeout(function() { 19 19 try { 20 window.webkit.messageHandlers. playingHandler.postMessage("paused");20 window.webkit.messageHandlers.testHandler.postMessage("paused"); 21 21 } catch(e) { } 22 22 }, 0); … … 25 25 setTimeout(function() { 26 26 try { 27 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");27 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 28 28 } catch(e) { 29 29 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-muted-video-hides-controls.html
r205706 r206286 16 16 setTimeout(function() { 17 17 try { 18 window.webkit.messageHandlers. playingHandler.postMessage("playing");18 window.webkit.messageHandlers.testHandler.postMessage("playing"); 19 19 } catch(e) { } 20 20 }, 0); … … 23 23 setTimeout(function() { 24 24 try { 25 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");25 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 26 26 } catch(e) { 27 27 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-video-keeps-controls.html
r205706 r206286 15 15 setTimeout(function() { 16 16 try { 17 window.webkit.messageHandlers. playingHandler.postMessage("scrolled");17 window.webkit.messageHandlers.testHandler.postMessage("scrolled"); 18 18 } catch(e) { } 19 19 }, 0); … … 22 22 setTimeout(function() { 23 23 try { 24 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");24 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 25 25 } catch(e) { 26 26 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html
r205706 r206286 5 5 setTimeout(function() { 6 6 try { 7 window.webkit.messageHandlers. playingHandler.postMessage("autoplayed");7 window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); 8 8 } catch(e) { 9 9 } -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html
r203968 r206286 12 12 setTimeout(function() { 13 13 try { 14 window.webkit.messageHandlers. playingHandler.postMessage("playing");14 window.webkit.messageHandlers.testHandler.postMessage("playing"); 15 15 } catch(e) { } 16 16 }, 0); -
branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/wide-autoplaying-video-with-audio.html
r205799 r206286 12 12 setTimeout(function() { 13 13 try { 14 window.webkit.messageHandlers. playingHandler.postMessage("playing");14 window.webkit.messageHandlers.testHandler.postMessage("playing"); 15 15 } catch(e) { } 16 16 }, 0); -
branches/safari-602-branch/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h
r206273 r206286 1 1 /* 2 * Copyright (C) 201 0Apple Inc. All rights reserved.2 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #i mport "config.h"27 # import "NativeWebKeyboardEvent.h"26 #ifndef TestWKWebViewMac_h 27 #define TestWKWebViewMac_h 28 28 29 #i f USE(APPKIT)29 #import <WebKit/WebKit.h> 30 30 31 #import "WebEventFactory.h" 32 #import <WebCore/KeyboardEvent.h> 31 #if WK_API_ENABLED && PLATFORM(MAC) 33 32 34 using namespace WebCore; 33 @interface TestMessageHandler : NSObject <WKScriptMessageHandler> 34 - (instancetype)initWithMessage:(NSString *)message handler:(dispatch_block_t)handler; 35 @end 35 36 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 37 46 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) */ 43 48 44 } // namespace WebKit 45 46 #endif // USE(APPKIT) 49 #endif /* TestWKWebViewMac_h */
Note: See TracChangeset
for help on using the changeset viewer.