Changeset 64862 in webkit
- Timestamp:
- Aug 6, 2010 11:54:12 AM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r64861 r64862 23 23 * WebProcess/WebPage/WebPage.h: 24 24 * WebProcess/WebProcess.h: 25 26 2010-08-05 Sam Weinig <sam@webkit.org> 27 28 Reviewed by Anders Carlsson. 29 30 Add form client for injected bundle code 31 https://bugs.webkit.org/show_bug.cgi?id=43603 32 33 * WebKit2.xcodeproj/project.pbxproj: 34 * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: 35 (WKBundlePageSetFormClient): 36 * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 37 * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: Added. 38 (WebKit::InjectedBundlePageFormClient::InjectedBundlePageFormClient): 39 (WebKit::InjectedBundlePageFormClient::initialize): 40 (WebKit::InjectedBundlePageFormClient::textFieldDidBeginEditing): 41 (WebKit::InjectedBundlePageFormClient::textFieldDidEndEditing): 42 (WebKit::InjectedBundlePageFormClient::textDidChangeInTextField): 43 (WebKit::InjectedBundlePageFormClient::textDidChangeInTextArea): 44 * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: Added. 45 * WebProcess/WebCoreSupport/WebEditorClient.cpp: 46 (WebKit::WebEditorClient::textFieldDidBeginEditing): 47 (WebKit::WebEditorClient::textFieldDidEndEditing): 48 (WebKit::WebEditorClient::textDidChangeInTextField): 49 (WebKit::WebEditorClient::textDidChangeInTextArea): 50 * WebProcess/WebPage/WebPage.cpp: 51 (WebKit::WebPage::initializeInjectedBundleFormClient): 52 * WebProcess/WebPage/WebPage.h: 53 (WebKit::WebPage::injectedBundleFormClient): 54 * win/WebKit2.vcproj: 25 55 26 56 2010-08-05 Sam Weinig <sam@webkit.org> -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r64792 r64862 156 156 BC14DF9E120B635F00826C0C /* WKBundleScriptWorld.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14DF9C120B635F00826C0C /* WKBundleScriptWorld.cpp */; }; 157 157 BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = BC14DF9D120B635F00826C0C /* WKBundleScriptWorld.h */; }; 158 BC14E109120B905E00826C0C /* InjectedBundlePageFormClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E107120B905E00826C0C /* InjectedBundlePageFormClient.cpp */; }; 159 BC14E10A120B905E00826C0C /* InjectedBundlePageFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC14E108120B905E00826C0C /* InjectedBundlePageFormClient.h */; }; 158 160 BC177465118B9FF4007D9E9A /* WKPagePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC177464118B9FF4007D9E9A /* WKPagePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 159 161 BC17753F118BABF0007D9E9A /* GenericCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = BC17753E118BABF0007D9E9A /* GenericCallback.h */; }; … … 481 483 BC14DF9C120B635F00826C0C /* WKBundleScriptWorld.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleScriptWorld.cpp; sourceTree = "<group>"; }; 482 484 BC14DF9D120B635F00826C0C /* WKBundleScriptWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleScriptWorld.h; sourceTree = "<group>"; }; 485 BC14E107120B905E00826C0C /* InjectedBundlePageFormClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageFormClient.cpp; sourceTree = "<group>"; }; 486 BC14E108120B905E00826C0C /* InjectedBundlePageFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageFormClient.h; sourceTree = "<group>"; }; 483 487 BC177464118B9FF4007D9E9A /* WKPagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPagePrivate.h; sourceTree = "<group>"; }; 484 488 BC17753E118BABF0007D9E9A /* GenericCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericCallback.h; sourceTree = "<group>"; }; … … 1138 1142 E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */, 1139 1143 E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */, 1144 BC14E107120B905E00826C0C /* InjectedBundlePageFormClient.cpp */, 1145 BC14E108120B905E00826C0C /* InjectedBundlePageFormClient.h */, 1140 1146 BCA8C6A611E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp */, 1141 1147 BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */, … … 1433 1439 BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */, 1434 1440 BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */, 1441 BC14E10A120B905E00826C0C /* InjectedBundlePageFormClient.h in Headers */, 1435 1442 ); 1436 1443 runOnlyForDeploymentPostprocessing = 0; … … 1647 1654 BC14DF78120B5B7900826C0C /* InjectedBundleScriptWorld.cpp in Sources */, 1648 1655 BC14DF9E120B635F00826C0C /* WKBundleScriptWorld.cpp in Sources */, 1656 BC14E109120B905E00826C0C /* InjectedBundlePageFormClient.cpp in Sources */, 1649 1657 ); 1650 1658 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
r64485 r64862 45 45 } 46 46 47 void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClient* wkClient) 48 { 49 if (wkClient && !wkClient->version) 50 toWK(pageRef)->initializeInjectedBundleFormClient(wkClient); 51 } 52 47 53 void WKBundlePageSetLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient* wkClient) 48 54 { -
trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
r64253 r64862 92 92 93 93 // Editor client 94 // FIXME: Objective-C API provides a WebView pointer in callbacks, what should the injected bundle API do?95 94 typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo); 96 95 typedef bool (*WKBundlePageShouldEndEditingCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo); … … 119 118 typedef struct WKBundlePageEditorClient WKBundlePageEditorClient; 120 119 120 // Form client 121 typedef void (*WKBundlePageTextFieldDidBeginEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); 122 typedef void (*WKBundlePageTextFieldDidEndEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); 123 typedef void (*WKBundlePageTextDidChangeInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); 124 typedef void (*WKBundlePageTextDidChangeInTextAreaCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlTextAreaElementHandle, WKBundleFrameRef frame, const void* clientInfo); 125 126 struct WKBundlePageFormClient { 127 int version; 128 const void * clientInfo; 129 WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing; 130 WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing; 131 WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField; 132 WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea; 133 }; 134 typedef struct WKBundlePageFormClient WKBundlePageFormClient; 135 121 136 WK_EXPORT WKTypeID WKBundlePageGetTypeID(); 122 137 123 138 WK_EXPORT void WKBundlePageSetEditorClient(WKBundlePageRef page, WKBundlePageEditorClient* client); 139 WK_EXPORT void WKBundlePageSetFormClient(WKBundlePageRef page, WKBundlePageFormClient* client); 124 140 WK_EXPORT void WKBundlePageSetLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient* client); 125 141 WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client); -
trunk/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
r64020 r64862 29 29 #include "NotImplemented.h" 30 30 31 #include "WebFrameLoaderClient.h" 31 32 #include "WebPage.h" 32 33 33 #include <WebCore/EditCommand.h> 34 #include <WebCore/Frame.h> 35 #include <WebCore/HTMLInputElement.h> 36 #include <WebCore/HTMLNames.h> 37 #include <WebCore/HTMLTextAreaElement.h> 34 38 #include <WebCore/KeyboardEvent.h> 39 #include <WebCore/UserTypingGestureIndicator.h> 35 40 36 41 using namespace WebCore; 42 using namespace HTMLNames; 37 43 38 44 namespace WebKit { … … 239 245 } 240 246 241 void WebEditorClient::textFieldDidBeginEditing(Element*) 242 { 243 notImplemented(); 244 } 245 246 void WebEditorClient::textFieldDidEndEditing(Element*) 247 { 248 notImplemented(); 249 } 250 251 void WebEditorClient::textDidChangeInTextField(Element*) 252 { 253 notImplemented(); 247 void WebEditorClient::textFieldDidBeginEditing(Element* element) 248 { 249 if (!element->hasTagName(inputTag)) 250 return; 251 252 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 253 m_page->injectedBundleFormClient().textFieldDidBeginEditing(m_page, static_cast<HTMLInputElement*>(element), webFrame); 254 } 255 256 void WebEditorClient::textFieldDidEndEditing(Element* element) 257 { 258 if (!element->hasTagName(inputTag)) 259 return; 260 261 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 262 m_page->injectedBundleFormClient().textFieldDidEndEditing(m_page, static_cast<HTMLInputElement*>(element), webFrame); 263 } 264 265 void WebEditorClient::textDidChangeInTextField(Element* element) 266 { 267 if (!element->hasTagName(inputTag)) 268 return; 269 270 if (!UserTypingGestureIndicator::processingUserTypingGesture() || UserTypingGestureIndicator::focusedElementAtGestureStart() != element) 271 return; 272 273 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 274 m_page->injectedBundleFormClient().textDidChangeInTextField(m_page, static_cast<HTMLInputElement*>(element), webFrame); 275 } 276 277 void WebEditorClient::textDidChangeInTextArea(Element* element) 278 { 279 if (!element->hasTagName(textareaTag)) 280 return; 281 282 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 283 m_page->injectedBundleFormClient().textDidChangeInTextArea(m_page, static_cast<HTMLTextAreaElement*>(element), webFrame); 254 284 } 255 285 … … 265 295 } 266 296 267 void WebEditorClient::textDidChangeInTextArea(Element*)268 {269 notImplemented();270 }271 297 272 298 #if PLATFORM(MAC) -
trunk/WebKit2/WebProcess/WebPage/WebPage.cpp
r64594 r64862 142 142 } 143 143 144 void WebPage::initializeInjectedBundleFormClient(WKBundlePageFormClient* client) 145 { 146 m_formClient.initialize(client); 147 } 148 144 149 void WebPage::initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient* client) 145 150 { … … 376 381 } 377 382 378 379 383 void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent) 380 384 { -
trunk/WebKit2/WebProcess/WebPage/WebPage.h
r64861 r64862 30 30 #include "DrawingArea.h" 31 31 #include "InjectedBundlePageEditorClient.h" 32 #include "InjectedBundlePageFormClient.h" 32 33 #include "InjectedBundlePageLoaderClient.h" 33 34 #include "InjectedBundlePageUIClient.h" … … 97 98 // -- InjectedBundle methods 98 99 void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*); 100 void initializeInjectedBundleFormClient(WKBundlePageFormClient*); 99 101 void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*); 100 102 void initializeInjectedBundleUIClient(WKBundlePageUIClient*); 101 103 102 104 InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; } 105 InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; } 103 106 InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; } 104 107 InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; } … … 156 159 157 160 InjectedBundlePageEditorClient m_editorClient; 161 InjectedBundlePageFormClient m_formClient; 158 162 InjectedBundlePageLoaderClient m_loaderClient; 159 163 InjectedBundlePageUIClient m_uiClient; -
trunk/WebKit2/win/WebKit2.vcproj
r64791 r64862 717 717 </File> 718 718 <File 719 RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageFormClient.cpp" 720 > 721 </File> 722 <File 723 RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageFormClient.h" 724 > 725 </File> 726 <File 719 727 RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageLoaderClient.cpp" 720 728 >
Note: See TracChangeset
for help on using the changeset viewer.