Diff
Modified: trunk/Source/WebCore/ChangeLog (245173 => 245174)
--- trunk/Source/WebCore/ChangeLog 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebCore/ChangeLog 2019-05-10 16:05:34 UTC (rev 245174)
@@ -1,3 +1,15 @@
+2019-05-10 Michael Catanzaro <[email protected]>
+
+ [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls
+ https://bugs.webkit.org/show_bug.cgi?id=197271
+
+ Reviewed by Youenn Fablet.
+
+ * dom/Document.cpp:
+ (WebCore::Document::didAssociateFormControlsTimerFired):
+ * loader/EmptyClients.h:
+ * page/ChromeClient.h:
+
2019-05-09 Simon Fraser <[email protected]>
Implement backing-sharing in compositing layers, allowing overlap layers to paint into the backing store of another layer
Modified: trunk/Source/WebCore/dom/Document.cpp (245173 => 245174)
--- trunk/Source/WebCore/dom/Document.cpp 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebCore/dom/Document.cpp 2019-05-10 16:05:34 UTC (rev 245174)
@@ -6959,8 +6959,10 @@
{
auto vector = copyToVector(m_associatedFormControls);
m_associatedFormControls.clear();
- if (auto* page = this->page())
- page->chrome().client().didAssociateFormControls(vector);
+ if (auto* page = this->page()) {
+ ASSERT(m_frame);
+ page->chrome().client().didAssociateFormControls(vector, *m_frame);
+ }
}
void Document::setCachedDOMCookies(const String& cookies)
Modified: trunk/Source/WebCore/loader/EmptyClients.h (245173 => 245174)
--- trunk/Source/WebCore/loader/EmptyClients.h 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2019-05-10 16:05:34 UTC (rev 245174)
@@ -194,7 +194,7 @@
bool isEmptyChromeClient() const final { return true; }
- void didAssociateFormControls(const Vector<RefPtr<Element>>&) final { }
+ void didAssociateFormControls(const Vector<RefPtr<Element>>&, Frame&) final { }
bool shouldNotifyOnFormChanges() final { return false; }
RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) final { return nullptr; }
Modified: trunk/Source/WebCore/page/ChromeClient.h (245173 => 245174)
--- trunk/Source/WebCore/page/ChromeClient.h 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebCore/page/ChromeClient.h 2019-05-10 16:05:34 UTC (rev 245174)
@@ -428,7 +428,7 @@
virtual String plugInExtraStyleSheet() const { return String(); }
virtual String plugInExtraScript() const { return String(); }
- virtual void didAssociateFormControls(const Vector<RefPtr<Element>>&) { };
+ virtual void didAssociateFormControls(const Vector<RefPtr<Element>>&, Frame&) { };
virtual bool shouldNotifyOnFormChanges() { return false; };
virtual void didAddHeaderLayer(GraphicsLayer&) { }
Modified: trunk/Source/WebKit/ChangeLog (245173 => 245174)
--- trunk/Source/WebKit/ChangeLog 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/ChangeLog 2019-05-10 16:05:34 UTC (rev 245174)
@@ -1,3 +1,24 @@
+2019-05-10 Michael Catanzaro <[email protected]>
+
+ [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls
+ https://bugs.webkit.org/show_bug.cgi?id=197271
+
+ Reviewed by Youenn Fablet.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h:
+ * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
+ (webkit_web_page_class_init):
+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+ (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
+ * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
+ (API::InjectedBundle::FormClient::didAssociateFormControls):
+ * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
+ (WebKit::InjectedBundlePageFormClient::didAssociateFormControls):
+ * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::didAssociateFormControls):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+
2019-05-09 Rob Buis <[email protected]>
Limit number of prefetches of a given page
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h (245173 => 245174)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h 2019-05-10 16:05:34 UTC (rev 245174)
@@ -39,6 +39,7 @@
typedef void (*WKBundlePageDidFocusTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
typedef bool (*WKBundlePageShouldNotifyOnFormChangesCallback)(WKBundlePageRef page, const void* clientInfo);
typedef void (*WKBundlePageDidAssociateFormControlsCallback)(WKBundlePageRef page, WKArrayRef elementHandles, const void* clientInfo);
+typedef void (*WKBundlePageDidAssociateFormControlsForFrameCallback)(WKBundlePageRef page, WKArrayRef elementHandles, WKBundleFrameRef frame, const void* clientInfo);
typedef struct WKBundlePageFormClientBase {
int version;
@@ -92,4 +93,27 @@
WKBundlePageDidAssociateFormControlsCallback didAssociateFormControls;
} WKBundlePageFormClientV2;
+typedef struct WKBundlePageFormClientV3 {
+ WKBundlePageFormClientBase base;
+
+ // Version 0.
+ WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing;
+ WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing;
+ WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField;
+ WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea;
+ WKBundlePageShouldPerformActionInTextFieldCallback shouldPerformActionInTextField;
+ WKBundlePageWillSubmitFormCallback willSubmitForm;
+
+ // Version 1.
+ WKBundlePageWillSendSubmitEventCallback willSendSubmitEvent;
+
+ // version 2.
+ WKBundlePageDidFocusTextFieldCallback didFocusTextField;
+ WKBundlePageShouldNotifyOnFormChangesCallback shouldNotifyOnFormChanges;
+ WKBundlePageDidAssociateFormControlsCallback didAssociateFormControls;
+
+ // version 3.
+ WKBundlePageDidAssociateFormControlsForFrameCallback didAssociateFormControlsForFrame;
+} WKBundlePageFormClientV3;
+
#endif // WKBundlePageFormClient_h
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp (245173 => 245174)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp 2019-05-10 16:05:34 UTC (rev 245174)
@@ -68,6 +68,7 @@
CONTEXT_MENU,
CONSOLE_MESSAGE_SENT,
FORM_CONTROLS_ASSOCIATED,
+ FORM_CONTROLS_ASSOCIATED_FOR_FRAME,
WILL_SUBMIT_FORM,
LAST_SIGNAL
@@ -380,7 +381,7 @@
fireFormSubmissionEvent(WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT, formElement, frame, sourceFrame, values);
}
- void didAssociateFormControls(WebPage*, const Vector<RefPtr<Element>>& elements) override
+ void didAssociateFormControls(WebPage*, const Vector<RefPtr<Element>>& elements, WebFrame* frame) override
{
GRefPtr<GPtrArray> formElements = adoptGRef(g_ptr_array_sized_new(elements.size()));
for (size_t i = 0; i < elements.size(); ++i)
@@ -387,6 +388,7 @@
g_ptr_array_add(formElements.get(), WebKit::kit(elements[i].get()));
g_signal_emit(m_webPage, signals[FORM_CONTROLS_ASSOCIATED], 0, formElements.get());
+ g_signal_emit(m_webPage, signals[FORM_CONTROLS_ASSOCIATED_FOR_FRAME], 0, formElements.get(), webkitFrameGetOrCreate(frame));
}
bool shouldNotifyOnFormChanges(WebPage*) override { return true; }
@@ -565,11 +567,13 @@
* keep them alive after the signal handler returns.
*
* Since: 2.16
+ *
+ * Deprecated: 2.26, use #WebKitWebPage::form-controls-associated-for-frame instead.
*/
signals[FORM_CONTROLS_ASSOCIATED] = g_signal_new(
"form-controls-associated",
G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
+ static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED),
0, 0, nullptr,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
@@ -576,6 +580,35 @@
G_TYPE_PTR_ARRAY);
/**
+ * WebKitWebPage::form-controls-associated-for-frame:
+ * @web_page: the #WebKitWebPage on which the signal is emitted
+ * @elements: (element-type WebKitDOMElement) (transfer none): a #GPtrArray of
+ * #WebKitDOMElement with the list of forms in the page
+ * @frame: the #WebKitFrame
+ *
+ * Emitted after form elements (or form associated elements) are associated to a particular web
+ * page. This is useful to implement form auto filling for web pages where form fields are added
+ * dynamically. This signal might be emitted multiple times for the same web page.
+ *
+ * Note that this signal could be also emitted when form controls are moved between forms. In
+ * that case, the @elements array carries the list of those elements which have moved.
+ *
+ * Clients should take a reference to the members of the @elements array if it is desired to
+ * keep them alive after the signal handler returns.
+ *
+ * Since: 2.26
+ */
+ signals[FORM_CONTROLS_ASSOCIATED_FOR_FRAME] = g_signal_new(
+ "form-controls-associated-for-frame",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ 0, 0, nullptr,
+ g_cclosure_marshal_generic,
+ G_TYPE_NONE, 2,
+ G_TYPE_PTR_ARRAY,
+ WEBKIT_TYPE_FRAME);
+
+ /**
* WebKitWebPage::will-submit-form:
* @web_page: the #WebKitWebPage on which the signal is emitted
* @form: the #WebKitDOMElement to be submitted, which will always correspond to an HTMLFormElement
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (245173 => 245174)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2019-05-10 16:05:34 UTC (rev 245174)
@@ -526,7 +526,7 @@
return [formDelegate _webProcessPlugInBrowserContextControllerShouldNotifyOnFormChanges:m_controller];
}
- void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>& elements) override
+ void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>& elements, WebKit::WebFrame*) override
{
auto formDelegate = m_controller->_formDelegate.get();
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/APIInjectedBundleFormClient.h (245173 => 245174)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/APIInjectedBundleFormClient.h 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/APIInjectedBundleFormClient.h 2019-05-10 16:05:34 UTC (rev 245174)
@@ -70,7 +70,7 @@
virtual bool shouldPerformActionInTextField(WebKit::WebPage*, WebCore::HTMLInputElement*, InputFieldAction, WebKit::WebFrame*) { return false; }
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); }
virtual void willSendSubmitEvent(WebKit::WebPage*, WebCore::HTMLFormElement*, WebKit::WebFrame*, WebKit::WebFrame*, const Vector<std::pair<WTF::String, WTF::String>>&) { }
- virtual void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>&) { }
+ virtual void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>&, WebKit::WebFrame*) { }
virtual bool shouldNotifyOnFormChanges(WebKit::WebPage*) { return false; }
virtual void willBeginInputSession(WebKit::WebPage*, WebCore::Element*, WebKit::WebFrame*, bool userIsInteracting, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); }
};
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp (245173 => 245174)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp 2019-05-10 16:05:34 UTC (rev 245174)
@@ -157,9 +157,9 @@
userData = adoptRef(toImpl(userDataToPass));
}
-void InjectedBundlePageFormClient::didAssociateFormControls(WebPage* page, const Vector<RefPtr<WebCore::Element>>& elements)
+void InjectedBundlePageFormClient::didAssociateFormControls(WebPage* page, const Vector<RefPtr<WebCore::Element>>& elements, WebFrame* frame)
{
- if (!m_client.didAssociateFormControls)
+ if (!m_client.didAssociateFormControls && !m_client.didAssociateFormControlsForFrame)
return;
Vector<RefPtr<API::Object>> elementHandles;
@@ -168,7 +168,12 @@
for (const auto& element : elements)
elementHandles.uncheckedAppend(InjectedBundleNodeHandle::getOrCreate(element.get()));
- m_client.didAssociateFormControls(toAPI(page), toAPI(API::Array::create(WTFMove(elementHandles)).ptr()), m_client.base.clientInfo);
+ if (!m_client.didAssociateFormControlsForFrame) {
+ m_client.didAssociateFormControls(toAPI(page), toAPI(API::Array::create(WTFMove(elementHandles)).ptr()), m_client.base.clientInfo);
+ return;
+ }
+
+ m_client.didAssociateFormControlsForFrame(toAPI(page), toAPI(API::Array::create(WTFMove(elementHandles)).ptr()), toAPI(frame), m_client.base.clientInfo);
}
bool InjectedBundlePageFormClient::shouldNotifyOnFormChanges(WebPage* page)
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h (245173 => 245174)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h 2019-05-10 16:05:34 UTC (rev 245174)
@@ -33,7 +33,7 @@
namespace API {
template<> struct ClientTraits<WKBundlePageFormClientBase> {
- typedef std::tuple<WKBundlePageFormClientV0, WKBundlePageFormClientV1, WKBundlePageFormClientV2> Versions;
+ typedef std::tuple<WKBundlePageFormClientV0, WKBundlePageFormClientV1, WKBundlePageFormClientV2, WKBundlePageFormClientV3> Versions;
};
}
@@ -51,7 +51,7 @@
bool shouldPerformActionInTextField(WebPage*, WebCore::HTMLInputElement*, InputFieldAction, WebFrame*) override;
void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&, RefPtr<API::Object>& userData) override;
void willSendSubmitEvent(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&) override;
- void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element>>&) override;
+ void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element>>&, WebFrame*) override;
bool shouldNotifyOnFormChanges(WebPage*) override;
};
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (245173 => 245174)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2019-05-10 16:05:34 UTC (rev 245174)
@@ -847,9 +847,11 @@
#endif
-void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<Element>>& elements)
+void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<Element>>& elements, WebCore::Frame& frame)
{
- return m_page.injectedBundleFormClient().didAssociateFormControls(&m_page, elements);
+ WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
+ ASSERT(webFrame);
+ return m_page.injectedBundleFormClient().didAssociateFormControls(&m_page, elements, webFrame);
}
bool WebChromeClient::shouldNotifyOnFormChanges()
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (245173 => 245174)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2019-05-10 16:05:34 UTC (rev 245174)
@@ -206,7 +206,7 @@
void requestPointerUnlock() final;
#endif
- void didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>&) final;
+ void didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>&, WebCore::Frame&) final;
bool shouldNotifyOnFormChanges() final;
bool selectItemWritingDirectionIsNatural() final;
Modified: trunk/Tools/ChangeLog (245173 => 245174)
--- trunk/Tools/ChangeLog 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Tools/ChangeLog 2019-05-10 16:05:34 UTC (rev 245174)
@@ -1,3 +1,15 @@
+2019-05-10 Michael Catanzaro <[email protected]>
+
+ [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls
+ https://bugs.webkit.org/show_bug.cgi?id=197271
+
+ Reviewed by Youenn Fablet.
+
+ * TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp:
+ (formControlsAssociatedForFrameCallback):
+ (pageCreatedCallback):
+ (formControlsAssociatedCallback): Deleted.
+
2019-05-10 Adrian Perez de Castro <[email protected]>
[Flatpak] Use the safe PyYAML loader if available
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp (245173 => 245174)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp 2019-05-10 16:03:42 UTC (rev 245173)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp 2019-05-10 16:05:34 UTC (rev 245174)
@@ -316,9 +316,8 @@
g_assert_true(ok);
}
-static void formControlsAssociatedCallback(WebKitWebPage* webPage, GPtrArray* formElements, WebKitWebExtension* extension)
+static void formControlsAssociatedForFrameCallback(WebKitWebPage* webPage, GPtrArray* formElements, WebKitFrame* frame, WebKitWebExtension* extension)
{
- auto* frame = webkit_web_page_get_main_frame(webPage);
GString* formIdsBuilder = g_string_new(nullptr);
for (guint i = 0; i < formElements->len; ++i) {
g_assert_true(WEBKIT_DOM_IS_ELEMENT(g_ptr_array_index(formElements, i)));
@@ -413,7 +412,7 @@
g_signal_connect(webPage, "send-request", G_CALLBACK(sendRequestCallback), nullptr);
g_signal_connect(webPage, "console-message-sent", G_CALLBACK(consoleMessageSentCallback), nullptr);
g_signal_connect(webPage, "context-menu", G_CALLBACK(contextMenuCallback), nullptr);
- g_signal_connect(webPage, "form-controls-associated", G_CALLBACK(formControlsAssociatedCallback), extension);
+ g_signal_connect(webPage, "form-controls-associated-for-frame", G_CALLBACK(formControlsAssociatedForFrameCallback), extension);
g_signal_connect(webPage, "will-submit-form", G_CALLBACK(willSubmitFormCallback), extension);
}