Changeset 150398 in webkit
- Timestamp:
- May 20, 2013 7:07:48 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r150388 r150398 1 2013-05-20 Jessie Berlin <jberlin@apple.com> 2 3 Expose a way to know when forms are added to a page or when form controls are added to a form 4 in the injected bundle 5 https://bugs.webkit.org/show_bug.cgi?id=116334 6 7 Reviewed by Alexey Proskuryakov. 8 9 Add shouldNotifyOnFormChanges and didAssociateFormControls to the WKBundlePageFormClient. 10 11 * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 12 Add the new callbacks as part of version 2 of the WKBundlePageFormClient. 13 14 * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: 15 (WebKit::InjectedBundlePageFormClient::didAssociateFormControls): 16 Pass the message along to the client if the client has a handler. 17 (WebKit::InjectedBundlePageFormClient::shouldNotifyOnFormChanges): 18 Ditto. 19 * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: 20 21 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 22 (WebKit::WebChromeClient::didAssociateFormControls): 23 Tell the injected bundle form client for the page. 24 (WebKit::WebChromeClient::shouldNotifyOnFormChanges): 25 Ditto. 26 * WebProcess/WebCoreSupport/WebChromeClient.h: 27 1 28 2013-05-20 Tim Horton <timothy_horton@apple.com> 2 29 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
r150369 r150398 339 339 typedef void (*WKBundlePageWillSendSubmitEventCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, const void* clientInfo); 340 340 typedef void (*WKBundlePageDidFocusTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); 341 typedef bool (*WKBundlePageShouldNotifyOnFormChangesCallback)(WKBundlePageRef page, const void* clientInfo); 342 typedef void (*WKBundlePageDidAssociateFormControlsCallback)(WKBundlePageRef page, WKArrayRef elementHandles, const void* clientInfo); 341 343 342 344 struct WKBundlePageFormClient { … … 357 359 // version 2. 358 360 WKBundlePageDidFocusTextFieldCallback didFocusTextField; 361 WKBundlePageShouldNotifyOnFormChangesCallback shouldNotifyOnFormChanges; 362 WKBundlePageDidAssociateFormControlsCallback didAssociateFormControls; 359 363 }; 360 364 typedef struct WKBundlePageFormClient WKBundlePageFormClient; -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
r149848 r150398 27 27 #include "InjectedBundlePageFormClient.h" 28 28 29 #include "ImmutableArray.h" 29 30 #include "ImmutableDictionary.h" 30 31 #include "InjectedBundleNodeHandle.h" … … 125 126 } 126 127 128 void InjectedBundlePageFormClient::didAssociateFormControls(WebPage* page, const Vector<RefPtr<WebCore::Element>>& elements) 129 { 130 if (!m_client.didAssociateFormControls) 131 return; 132 133 size_t size = elements.size(); 134 135 Vector<RefPtr<APIObject>> elementHandles; 136 elementHandles.reserveCapacity(size); 137 138 for (size_t i = 0; i < size; ++i) 139 elementHandles.uncheckedAppend(InjectedBundleNodeHandle::getOrCreate(elements[i].get()).get()); 140 141 m_client.didAssociateFormControls(toAPI(page), toAPI(ImmutableArray::adopt(elementHandles).get()), m_client.clientInfo); 142 } 143 144 bool InjectedBundlePageFormClient::shouldNotifyOnFormChanges(WebPage* page) 145 { 146 if (!m_client.shouldNotifyOnFormChanges) 147 return false; 148 149 return m_client.shouldNotifyOnFormChanges(toAPI(page), m_client.clientInfo); 150 } 151 127 152 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
r149848 r150398 34 34 35 35 namespace WebCore { 36 class HTMLFormElement; 37 class HTMLInputElement; 38 class HTMLTextAreaElement; 36 class Element; 37 class HTMLFormElement; 38 class HTMLInputElement; 39 class HTMLTextAreaElement; 39 40 } 40 41 … … 56 57 void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&, RefPtr<APIObject>& userData); 57 58 void willSendSubmitEvent(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&); 59 void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element>>&); 60 bool shouldNotifyOnFormChanges(WebPage*); 58 61 }; 59 62 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r150307 r150398 717 717 } 718 718 719 void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>& elements) 720 { 721 return m_page->injectedBundleFormClient().didAssociateFormControls(m_page, elements); 722 } 723 724 bool WebChromeClient::shouldNotifyOnFormChanges() 725 { 726 return m_page->injectedBundleFormClient().shouldNotifyOnFormChanges(m_page); 727 } 728 719 729 bool WebChromeClient::selectItemWritingDirectionIsNatural() 720 730 { -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
r150307 r150398 171 171 virtual void formStateDidChange(const WebCore::Node*) OVERRIDE; 172 172 173 virtual void didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>&) OVERRIDE; 174 virtual bool shouldNotifyOnFormChanges() OVERRIDE; 175 173 176 virtual bool selectItemWritingDirectionIsNatural() OVERRIDE; 174 177 virtual bool selectItemAlignmentFollowsMenuWritingDirection() OVERRIDE; -
trunk/Tools/ChangeLog
r150391 r150398 1 2013-05-20 Jessie Berlin <jberlin@apple.com> 2 3 Expose a way to know when forms are added to a page or when form controls are added to a form 4 in the injected bundle 5 https://bugs.webkit.org/show_bug.cgi?id=116334 6 7 Reviewed by Alexey Proskuryakov. 8 9 Add tests for the new callbacks. 10 11 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 12 Add DidAssociateFormControls/_Bundle.cpp and associate-form-controls.html 13 14 * TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls.cpp: Added. 15 (TestWebKitAPI::nullJavaScriptCallback): 16 A "null" callback to handle the fact that WKPageRunJavaScriptInMainFrame cannot handle null 17 being passed in for the callback. 18 (TestWebKitAPI::didReceiveMessageFromInjectedBundle): 19 After receiving the message that didAssociateFormControls callback was invoked from adding 20 the form in the onload handler, tell the page to add a password field to the form, which 21 should also invoke didAssociateFormControls callback. 22 (TestWebKitAPI::setInjectedBundleClient): 23 Register to receive messages. 24 (TestWebKitAPI::TEST): 25 Load associate-form-controls.html and wait until the didAssociateFormControls callback has 26 been invoked for both adding the form and for adding a password field to the form. 27 28 * TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp: Added. 29 (TestWebKitAPI::shouldNotifyOnFormChanges): 30 Return true so the didAssociateFormControls callback is invoked. 31 (TestWebKitAPI::didAssociateFormControls): 32 Tell the UI process. 33 (TestWebKitAPI::DidAssociateFormControlsTest::DidAssociateFormControlsTest): 34 (TestWebKitAPI::DidAssociateFormControlsTest::didCreatePage): 35 Register for the shouldNotifyOnFormChanges and didAssociateFormControls callbacks. 36 37 * TestWebKitAPI/Tests/WebKit2/associate-form-controls.html: Added. 38 Add a form in response to the onload event. Add a button that will add the password field 39 for manual testing. 40 1 41 2013-05-20 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 42 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r150242 r150398 210 210 F660AA1315A619C9003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */; }; 211 211 F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */; }; 212 F6B7BE9417469209008A3445 /* DidAssociateFormControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B7BE93174691EF008A3445 /* DidAssociateFormControls.cpp */; }; 213 F6B7BE9517469212008A3445 /* DidAssociateFormControls_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B7BE92174691EF008A3445 /* DidAssociateFormControls_Bundle.cpp */; }; 214 F6B7BE9717469B96008A3445 /* associate-form-controls.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F6B7BE9617469B7E008A3445 /* associate-form-controls.html */; }; 212 215 F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */; }; 213 216 F6F49C6915545C8E0007F39D /* DOMWindowExtensionNoCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F49C6715545C8D0007F39D /* DOMWindowExtensionNoCache.cpp */; }; … … 249 252 C2CF975A16CEC7140054E99D /* JSContextBackForwardCache2.html in Copy Resources */, 250 253 1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */, 254 F6B7BE9717469B96008A3445 /* associate-form-controls.html in Copy Resources */, 251 255 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */, 252 256 B55F11BE15191A0600915916 /* Ahem.ttf in Copy Resources */, … … 512 516 F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleInitializationUserDataCallbackWins.cpp; sourceTree = "<group>"; }; 513 517 F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp; sourceTree = "<group>"; }; 518 F6B7BE92174691EF008A3445 /* DidAssociateFormControls_Bundle.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DidAssociateFormControls_Bundle.cpp; sourceTree = "<group>"; }; 519 F6B7BE93174691EF008A3445 /* DidAssociateFormControls.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DidAssociateFormControls.cpp; sourceTree = "<group>"; }; 520 F6B7BE9617469B7E008A3445 /* associate-form-controls.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "associate-form-controls.html"; sourceTree = "<group>"; }; 514 521 F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieManager.cpp; sourceTree = "<group>"; }; 515 522 F6F49C6615545C8D0007F39D /* DOMWindowExtensionNoCache_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionNoCache_Bundle.cpp; sourceTree = "<group>"; }; … … 667 674 BC246D97132F1FE100B56D7C /* CanHandleRequest_Bundle.cpp */, 668 675 F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */, 676 F6B7BE93174691EF008A3445 /* DidAssociateFormControls.cpp */, 677 F6B7BE92174691EF008A3445 /* DidAssociateFormControls_Bundle.cpp */, 669 678 BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */, 670 679 BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */, … … 777 786 children = ( 778 787 C045F9461385C2F800C0F3CD /* 18-characters.html */, 788 F6B7BE9617469B7E008A3445 /* associate-form-controls.html */, 779 789 76E182DE15475A8300F1FADD /* auto-submitting-form.html */, 780 790 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */, … … 1154 1164 76E182DA1547550100F1FADD /* WillSendSubmitEvent.cpp in Sources */, 1155 1165 A5E2027315B2181900C13E14 /* WindowlessWebViewWithMedia.mm in Sources */, 1166 F6B7BE9417469209008A3445 /* DidAssociateFormControls.cpp in Sources */, 1156 1167 BC3C4C7F14587AA60025FB62 /* WKBrowsingContextGroupTest.mm in Sources */, 1157 1168 BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */, … … 1196 1207 BC575BD9126F58E2006F0F12 /* PlatformUtilities.cpp in Sources */, 1197 1208 BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */, 1209 F6B7BE9517469212008A3445 /* DidAssociateFormControls_Bundle.cpp in Sources */, 1198 1210 C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */, 1199 1211 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.