Changeset 245174 in webkit
- Timestamp:
- May 10, 2019 9:05:34 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r245170 r245174 1 2019-05-10 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls 4 https://bugs.webkit.org/show_bug.cgi?id=197271 5 6 Reviewed by Youenn Fablet. 7 8 * dom/Document.cpp: 9 (WebCore::Document::didAssociateFormControlsTimerFired): 10 * loader/EmptyClients.h: 11 * page/ChromeClient.h: 12 1 13 2019-05-09 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/Source/WebCore/dom/Document.cpp
r245142 r245174 6960 6960 auto vector = copyToVector(m_associatedFormControls); 6961 6961 m_associatedFormControls.clear(); 6962 if (auto* page = this->page()) 6963 page->chrome().client().didAssociateFormControls(vector); 6962 if (auto* page = this->page()) { 6963 ASSERT(m_frame); 6964 page->chrome().client().didAssociateFormControls(vector, *m_frame); 6965 } 6964 6966 } 6965 6967 -
trunk/Source/WebCore/loader/EmptyClients.h
r244633 r245174 195 195 bool isEmptyChromeClient() const final { return true; } 196 196 197 void didAssociateFormControls(const Vector<RefPtr<Element>>& ) final { }197 void didAssociateFormControls(const Vector<RefPtr<Element>>&, Frame&) final { } 198 198 bool shouldNotifyOnFormChanges() final { return false; } 199 199 -
trunk/Source/WebCore/page/ChromeClient.h
r245025 r245174 429 429 virtual String plugInExtraScript() const { return String(); } 430 430 431 virtual void didAssociateFormControls(const Vector<RefPtr<Element>>& ) { };431 virtual void didAssociateFormControls(const Vector<RefPtr<Element>>&, Frame&) { }; 432 432 virtual bool shouldNotifyOnFormChanges() { return false; }; 433 433 -
trunk/Source/WebKit/ChangeLog
r245171 r245174 1 2019-05-10 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls 4 https://bugs.webkit.org/show_bug.cgi?id=197271 5 6 Reviewed by Youenn Fablet. 7 8 * WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h: 9 * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: 10 (webkit_web_page_class_init): 11 * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: 12 (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): 13 * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h: 14 (API::InjectedBundle::FormClient::didAssociateFormControls): 15 * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: 16 (WebKit::InjectedBundlePageFormClient::didAssociateFormControls): 17 * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: 18 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 19 (WebKit::WebChromeClient::didAssociateFormControls): 20 * WebProcess/WebCoreSupport/WebChromeClient.h: 21 1 22 2019-05-09 Rob Buis <rbuis@igalia.com> 2 23 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h
r188279 r245174 40 40 typedef bool (*WKBundlePageShouldNotifyOnFormChangesCallback)(WKBundlePageRef page, const void* clientInfo); 41 41 typedef void (*WKBundlePageDidAssociateFormControlsCallback)(WKBundlePageRef page, WKArrayRef elementHandles, const void* clientInfo); 42 typedef void (*WKBundlePageDidAssociateFormControlsForFrameCallback)(WKBundlePageRef page, WKArrayRef elementHandles, WKBundleFrameRef frame, const void* clientInfo); 42 43 43 44 typedef struct WKBundlePageFormClientBase { … … 93 94 } WKBundlePageFormClientV2; 94 95 96 typedef struct WKBundlePageFormClientV3 { 97 WKBundlePageFormClientBase base; 98 99 // Version 0. 100 WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing; 101 WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing; 102 WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField; 103 WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea; 104 WKBundlePageShouldPerformActionInTextFieldCallback shouldPerformActionInTextField; 105 WKBundlePageWillSubmitFormCallback willSubmitForm; 106 107 // Version 1. 108 WKBundlePageWillSendSubmitEventCallback willSendSubmitEvent; 109 110 // version 2. 111 WKBundlePageDidFocusTextFieldCallback didFocusTextField; 112 WKBundlePageShouldNotifyOnFormChangesCallback shouldNotifyOnFormChanges; 113 WKBundlePageDidAssociateFormControlsCallback didAssociateFormControls; 114 115 // version 3. 116 WKBundlePageDidAssociateFormControlsForFrameCallback didAssociateFormControlsForFrame; 117 } WKBundlePageFormClientV3; 118 95 119 #endif // WKBundlePageFormClient_h -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp
r240808 r245174 69 69 CONSOLE_MESSAGE_SENT, 70 70 FORM_CONTROLS_ASSOCIATED, 71 FORM_CONTROLS_ASSOCIATED_FOR_FRAME, 71 72 WILL_SUBMIT_FORM, 72 73 … … 381 382 } 382 383 383 void didAssociateFormControls(WebPage*, const Vector<RefPtr<Element>>& elements ) override384 void didAssociateFormControls(WebPage*, const Vector<RefPtr<Element>>& elements, WebFrame* frame) override 384 385 { 385 386 GRefPtr<GPtrArray> formElements = adoptGRef(g_ptr_array_sized_new(elements.size())); … … 388 389 389 390 g_signal_emit(m_webPage, signals[FORM_CONTROLS_ASSOCIATED], 0, formElements.get()); 391 g_signal_emit(m_webPage, signals[FORM_CONTROLS_ASSOCIATED_FOR_FRAME], 0, formElements.get(), webkitFrameGetOrCreate(frame)); 390 392 } 391 393 … … 566 568 * 567 569 * Since: 2.16 570 * 571 * Deprecated: 2.26, use #WebKitWebPage::form-controls-associated-for-frame instead. 568 572 */ 569 573 signals[FORM_CONTROLS_ASSOCIATED] = g_signal_new( 570 574 "form-controls-associated", 571 575 G_TYPE_FROM_CLASS(klass), 572 G_SIGNAL_RUN_LAST,576 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED), 573 577 0, 0, nullptr, 574 578 g_cclosure_marshal_VOID__BOXED, 575 579 G_TYPE_NONE, 1, 576 580 G_TYPE_PTR_ARRAY); 581 582 /** 583 * WebKitWebPage::form-controls-associated-for-frame: 584 * @web_page: the #WebKitWebPage on which the signal is emitted 585 * @elements: (element-type WebKitDOMElement) (transfer none): a #GPtrArray of 586 * #WebKitDOMElement with the list of forms in the page 587 * @frame: the #WebKitFrame 588 * 589 * Emitted after form elements (or form associated elements) are associated to a particular web 590 * page. This is useful to implement form auto filling for web pages where form fields are added 591 * dynamically. This signal might be emitted multiple times for the same web page. 592 * 593 * Note that this signal could be also emitted when form controls are moved between forms. In 594 * that case, the @elements array carries the list of those elements which have moved. 595 * 596 * Clients should take a reference to the members of the @elements array if it is desired to 597 * keep them alive after the signal handler returns. 598 * 599 * Since: 2.26 600 */ 601 signals[FORM_CONTROLS_ASSOCIATED_FOR_FRAME] = g_signal_new( 602 "form-controls-associated-for-frame", 603 G_TYPE_FROM_CLASS(klass), 604 G_SIGNAL_RUN_LAST, 605 0, 0, nullptr, 606 g_cclosure_marshal_generic, 607 G_TYPE_NONE, 2, 608 G_TYPE_PTR_ARRAY, 609 WEBKIT_TYPE_FRAME); 577 610 578 611 /** -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
r244139 r245174 527 527 } 528 528 529 void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>& elements ) override529 void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>& elements, WebKit::WebFrame*) override 530 530 { 531 531 auto formDelegate = m_controller->_formDelegate.get(); -
trunk/Source/WebKit/WebProcess/InjectedBundle/APIInjectedBundleFormClient.h
r241183 r245174 71 71 virtual void willSubmitForm(WebKit::WebPage*, WebCore::HTMLFormElement*, WebKit::WebFrame*, WebKit::WebFrame*, const Vector<std::pair<WTF::String, WTF::String>>&, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); } 72 72 virtual void willSendSubmitEvent(WebKit::WebPage*, WebCore::HTMLFormElement*, WebKit::WebFrame*, WebKit::WebFrame*, const Vector<std::pair<WTF::String, WTF::String>>&) { } 73 virtual void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>& ) { }73 virtual void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>&, WebKit::WebFrame*) { } 74 74 virtual bool shouldNotifyOnFormChanges(WebKit::WebPage*) { return false; } 75 75 virtual void willBeginInputSession(WebKit::WebPage*, WebCore::Element*, WebKit::WebFrame*, bool userIsInteracting, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); } -
trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
r235205 r245174 158 158 } 159 159 160 void InjectedBundlePageFormClient::didAssociateFormControls(WebPage* page, const Vector<RefPtr<WebCore::Element>>& elements )160 void InjectedBundlePageFormClient::didAssociateFormControls(WebPage* page, const Vector<RefPtr<WebCore::Element>>& elements, WebFrame* frame) 161 161 { 162 if (!m_client.didAssociateFormControls )162 if (!m_client.didAssociateFormControls && !m_client.didAssociateFormControlsForFrame) 163 163 return; 164 164 … … 169 169 elementHandles.uncheckedAppend(InjectedBundleNodeHandle::getOrCreate(element.get())); 170 170 171 m_client.didAssociateFormControls(toAPI(page), toAPI(API::Array::create(WTFMove(elementHandles)).ptr()), m_client.base.clientInfo); 171 if (!m_client.didAssociateFormControlsForFrame) { 172 m_client.didAssociateFormControls(toAPI(page), toAPI(API::Array::create(WTFMove(elementHandles)).ptr()), m_client.base.clientInfo); 173 return; 174 } 175 176 m_client.didAssociateFormControlsForFrame(toAPI(page), toAPI(API::Array::create(WTFMove(elementHandles)).ptr()), toAPI(frame), m_client.base.clientInfo); 172 177 } 173 178 -
trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
r197563 r245174 34 34 35 35 template<> struct ClientTraits<WKBundlePageFormClientBase> { 36 typedef std::tuple<WKBundlePageFormClientV0, WKBundlePageFormClientV1, WKBundlePageFormClientV2 > Versions;36 typedef std::tuple<WKBundlePageFormClientV0, WKBundlePageFormClientV1, WKBundlePageFormClientV2, WKBundlePageFormClientV3> Versions; 37 37 }; 38 38 } … … 52 52 void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&, RefPtr<API::Object>& userData) override; 53 53 void willSendSubmitEvent(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&) override; 54 void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element>>& ) override;54 void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element>>&, WebFrame*) override; 55 55 bool shouldNotifyOnFormChanges(WebPage*) override; 56 56 }; -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r245025 r245174 848 848 #endif 849 849 850 void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<Element>>& elements) 851 { 852 return m_page.injectedBundleFormClient().didAssociateFormControls(&m_page, elements); 850 void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<Element>>& elements, WebCore::Frame& frame) 851 { 852 WebFrame* webFrame = WebFrame::fromCoreFrame(frame); 853 ASSERT(webFrame); 854 return m_page.injectedBundleFormClient().didAssociateFormControls(&m_page, elements, webFrame); 853 855 } 854 856 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r245025 r245174 207 207 #endif 208 208 209 void didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>& ) final;209 void didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>&, WebCore::Frame&) final; 210 210 bool shouldNotifyOnFormChanges() final; 211 211 -
trunk/Tools/ChangeLog
r245172 r245174 1 2019-05-10 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls 4 https://bugs.webkit.org/show_bug.cgi?id=197271 5 6 Reviewed by Youenn Fablet. 7 8 * TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp: 9 (formControlsAssociatedForFrameCallback): 10 (pageCreatedCallback): 11 (formControlsAssociatedCallback): Deleted. 12 1 13 2019-05-10 Adrian Perez de Castro <aperez@igalia.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp
r243534 r245174 317 317 } 318 318 319 static void formControlsAssociatedCallback(WebKitWebPage* webPage, GPtrArray* formElements, WebKitWebExtension* extension) 320 { 321 auto* frame = webkit_web_page_get_main_frame(webPage); 319 static void formControlsAssociatedForFrameCallback(WebKitWebPage* webPage, GPtrArray* formElements, WebKitFrame* frame, WebKitWebExtension* extension) 320 { 322 321 GString* formIdsBuilder = g_string_new(nullptr); 323 322 for (guint i = 0; i < formElements->len; ++i) { … … 414 413 g_signal_connect(webPage, "console-message-sent", G_CALLBACK(consoleMessageSentCallback), nullptr); 415 414 g_signal_connect(webPage, "context-menu", G_CALLBACK(contextMenuCallback), nullptr); 416 g_signal_connect(webPage, "form-controls-associated ", G_CALLBACK(formControlsAssociatedCallback), extension);415 g_signal_connect(webPage, "form-controls-associated-for-frame", G_CALLBACK(formControlsAssociatedForFrameCallback), extension); 417 416 g_signal_connect(webPage, "will-submit-form", G_CALLBACK(willSubmitFormCallback), extension); 418 417 }
Note: See TracChangeset
for help on using the changeset viewer.