Changeset 128394 in webkit
- Timestamp:
- Sep 12, 2012 6:02:29 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r128390 r128394 1 2012-09-12 Kent Tamura <tkent@chromium.org> 2 3 Introduce ValidationMessageClient 4 https://bugs.webkit.org/show_bug.cgi?id=96238 5 6 Reviewed by Hajime Morita. 7 8 ValidationMessageClient interface is responsible to operate validation 9 message UI for interactive form validation. If a Page object has a 10 ValidtionMessageClient, ValidationMessae class uses 11 ValidtionMessageClient instead of Shadow DOM. 12 13 No new tests because of no behavior changes. 14 15 * GNUmakefile.list.am: Add ValidtionMessageClient.h. 16 * Target.pri: ditto. 17 * WebCore.gypi: ditto. 18 * WebCore.xcodeproj/project.pbxproj: ditto. 19 20 * html/ValidationMessage.cpp: 21 (WebCore::ValidationMessage::~ValidationMessage): 22 Hide a validation message via ValidationMessageClient if it is available. 23 (WebCore::ValidationMessage::validationMessageClient): 24 A helper function to get Page::validationMessageClient. 25 (WebCore::ValidationMessage::updateValidationMessage): 26 Adding title attribute is not neeeded if ValidationMessageClient is 27 used. It shoudl be handled in a ValidtionMessageClient implementation. 28 (WebCore::ValidationMessage::setMessage): 29 Show a validation message via ValidationMessageClient if it is available. 30 (WebCore::ValidationMessage::setMessageDOMAndStartTimer): 31 Add an assertion that ValidationMessageClient should not be available. 32 (WebCore::ValidationMessage::buildBubbleTree): ditto. 33 (WebCore::ValidationMessage::requestToHideMessage): 34 Hide a validation message via ValidationMessageClient if it is available. 35 (WebCore::ValidationMessage::shadowTreeContains): 36 Always returns false if ValidationMessageClient is available, it means no Shadow DOM. 37 (WebCore::ValidationMessage::deleteBubbleTree): 38 Add an assertion that ValidationMessageClient should not be available. 39 (WebCore::ValidationMessage::isVisible): 40 Ask ValidationMessageClient for visibility if it is available. 41 * html/ValidationMessage.h: 42 (WebCore): Add a comment. 43 (ValidationMessage): Add validtionMessageClient member function. 44 45 * page/Page.cpp: 46 (WebCore::Page::Page): Initialize m_validationMessageClient. 47 (WebCore::Page::PageClients::PageClients): 48 Initialize validationMessageClient member with 0. 49 So, existing code makes Page::m_validationMessageClient 0. 50 * page/Page.h: 51 (PageClients): Add validationMessageClient member. 52 (WebCore::Page::validationMessageClient): 53 Added. Accessor for m_validationMessageClient. 54 (Page): Add m_validationMessageClient. 55 56 * page/Settings.h: 57 (Settings): Updated the comment for setInteractiveFormValidationEnabled. 58 59 * page/ValidationMessageClient.h: Added. 60 1 61 2012-09-12 Dmitry Titov <dimich@chromium.org> 2 62 -
trunk/Source/WebCore/GNUmakefile.list.am
r128249 r128394 4070 4070 Source/WebCore/page/UserStyleSheet.h \ 4071 4071 Source/WebCore/page/UserStyleSheetTypes.h \ 4072 Source/WebCore/page/ValidationMessageClient.h \ 4072 4073 Source/WebCore/page/WebCoreKeyboardUIMode.h \ 4073 4074 Source/WebCore/page/WebKitAnimation.h \ -
trunk/Source/WebCore/Target.pri
r128174 r128394 2013 2013 page/SpeechInputResultList.h \ 2014 2014 page/TouchAdjustment.h \ 2015 page/ValidationMessageClient.h \ 2015 2016 page/WebKitAnimation.h \ 2016 2017 page/WebKitAnimationList.h \ -
trunk/Source/WebCore/WebCore.gypi
r128374 r128394 262 262 'page/UserStyleSheet.h', 263 263 'page/UserStyleSheetTypes.h', 264 'page/ValidationMessageClient.h', 264 265 'page/WebCoreKeyboardUIMode.h', 265 266 'page/WindowFeatures.h', -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r128249 r128394 6230 6230 F508246F1548D96200A119AB /* MockPagePopupDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = F508246D1548D96200A119AB /* MockPagePopupDriver.h */; }; 6231 6231 F5122C901547FA1B0028A93B /* PagePopupDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */; }; 6232 F513A3EA15FF4841001526DB /* ValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F513A3E915FF4841001526DB /* ValidationMessageClient.h */; }; 6232 6233 F5142C69123F12B000F5BD4C /* LocalizedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = F5142C68123F12B000F5BD4C /* LocalizedNumber.h */; }; 6233 6234 F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */; }; … … 13619 13620 F508246D1548D96200A119AB /* MockPagePopupDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockPagePopupDriver.h; path = testing/MockPagePopupDriver.h; sourceTree = SOURCE_ROOT; }; 13620 13621 F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagePopupDriver.h; sourceTree = "<group>"; }; 13622 F513A3E915FF4841001526DB /* ValidationMessageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValidationMessageClient.h; sourceTree = "<group>"; }; 13621 13623 F5142C68123F12B000F5BD4C /* LocalizedNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedNumber.h; sourceTree = "<group>"; }; 13622 13624 F523D23B02DE4396018635CA /* HTMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDocument.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 15911 15913 BC8BF150105813BF00A40A07 /* UserStyleSheet.h */, 15912 15914 BC8BF1591058141800A40A07 /* UserStyleSheetTypes.h */, 15915 F513A3E915FF4841001526DB /* ValidationMessageClient.h */, 15913 15916 BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */, 15914 15917 319E69AC13299BBD004AC91A /* WebKitAnimation.cpp */, … … 25377 25380 2E3BBF081162DA1100B9409A /* UUID.h in Headers */, 25378 25381 F5A154281279534D00D0B0C0 /* ValidationMessage.h in Headers */, 25382 F513A3EA15FF4841001526DB /* ValidationMessageClient.h in Headers */, 25379 25383 15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */, 25380 25384 FD3160AF12B026F700C1A359 /* VectorMath.h in Headers */, -
trunk/Source/WebCore/html/ValidationMessage.cpp
r128254 r128394 47 47 #include "StyleResolver.h" 48 48 #include "Text.h" 49 #include "ValidationMessageClient.h" 49 50 #include <wtf/PassOwnPtr.h> 50 51 … … 61 62 ValidationMessage::~ValidationMessage() 62 63 { 64 if (ValidationMessageClient* client = validationMessageClient()) { 65 client->hideValidationMessage(*m_element); 66 return; 67 } 68 63 69 deleteBubbleTree(); 64 70 } … … 69 75 } 70 76 77 ValidationMessageClient* ValidationMessage::validationMessageClient() const 78 { 79 if (Page* page = m_element->document()->page()) 80 return page->validationMessageClient(); 81 return 0; 82 } 83 71 84 void ValidationMessage::updateValidationMessage(const String& message) 72 85 { 73 86 String updatedMessage = message; 74 // HTML5 specification doesn't ask UA to show the title attribute value 75 // with the validationMessage. However, this behavior is same as Opera 76 // and the specification describes such behavior as an example. 77 const AtomicString& title = m_element->fastGetAttribute(titleAttr); 78 if (!updatedMessage.isEmpty() && !title.isEmpty()) { 79 updatedMessage.append('\n'); 80 updatedMessage.append(title); 87 if (!validationMessageClient()) { 88 // HTML5 specification doesn't ask UA to show the title attribute value 89 // with the validationMessage. However, this behavior is same as Opera 90 // and the specification describes such behavior as an example. 91 const AtomicString& title = m_element->fastGetAttribute(titleAttr); 92 if (!updatedMessage.isEmpty() && !title.isEmpty()) { 93 updatedMessage.append('\n'); 94 updatedMessage.append(title); 95 } 81 96 } 82 97 … … 90 105 void ValidationMessage::setMessage(const String& message) 91 106 { 107 if (ValidationMessageClient* client = validationMessageClient()) { 108 client->showValidationMessage(*m_element, message); 109 return; 110 } 111 92 112 // Don't modify the DOM tree in this context. 93 113 // If so, an assertion in Node::isFocusable() fails. … … 103 123 void ValidationMessage::setMessageDOMAndStartTimer(Timer<ValidationMessage>*) 104 124 { 125 ASSERT(!validationMessageClient()); 105 126 ASSERT(m_messageHeading); 106 127 ASSERT(m_messageBody); … … 154 175 void ValidationMessage::buildBubbleTree(Timer<ValidationMessage>*) 155 176 { 177 ASSERT(!validationMessageClient()); 156 178 ShadowRoot* shadowRoot = m_element->ensureUserAgentShadowRoot(); 157 179 … … 200 222 void ValidationMessage::requestToHideMessage() 201 223 { 224 if (ValidationMessageClient* client = validationMessageClient()) { 225 client->hideValidationMessage(*m_element); 226 return; 227 } 228 202 229 // We must not modify the DOM tree in this context by the same reason as setMessage(). 203 230 m_timer = adoptPtr(new Timer<ValidationMessage>(this, &ValidationMessage::deleteBubbleTree)); … … 207 234 bool ValidationMessage::shadowTreeContains(Node* node) const 208 235 { 209 if ( !m_bubble)236 if (validationMessageClient() || !m_bubble) 210 237 return false; 211 238 return m_bubble->treeScope() == node->treeScope(); … … 214 241 void ValidationMessage::deleteBubbleTree(Timer<ValidationMessage>*) 215 242 { 243 ASSERT(!validationMessageClient()); 216 244 if (m_bubble) { 217 245 m_messageHeading = 0; … … 225 253 bool ValidationMessage::isVisible() const 226 254 { 255 if (ValidationMessageClient* client = validationMessageClient()) 256 return client->isValidationMessageVisible(*m_element); 227 257 return !m_message.isEmpty(); 228 258 } -
trunk/Source/WebCore/html/ValidationMessage.h
r128254 r128394 43 43 class HTMLFormControlElement; 44 44 class Node; 45 class ValidationMessageClient; 45 46 47 // FIXME: We should remove the code for !validationMessageClient() when all 48 // ports supporting interactive validation switch to ValidationMessageClient. 46 49 class ValidationMessage { 47 50 WTF_MAKE_NONCOPYABLE(ValidationMessage); … … 56 59 private: 57 60 ValidationMessage(HTMLFormControlElement*); 61 ValidationMessageClient* validationMessageClient() const; 58 62 void setMessage(const String&); 59 63 void setMessageDOMAndStartTimer(Timer<ValidationMessage>* = 0); -
trunk/Source/WebCore/page/Page.cpp
r128134 r128394 134 134 , m_theme(RenderTheme::themeForPage(this)) 135 135 , m_editorClient(pageClients.editorClient) 136 , m_validationMessageClient(pageClients.validationMessageClient) 136 137 , m_frameCount(0) 137 138 , m_openedByDOM(false) … … 1228 1229 , dragClient(0) 1229 1230 , inspectorClient(0) 1231 , validationMessageClient(0) 1230 1232 { 1231 1233 } -
trunk/Source/WebCore/page/Page.h
r128134 r128394 86 86 class Settings; 87 87 class StorageNamespace; 88 class ValidationMessageClient; 88 89 89 90 typedef uint64_t LinkHash; … … 125 126 InspectorClient* inspectorClient; 126 127 RefPtr<BackForwardList> backForwardClient; 128 ValidationMessageClient* validationMessageClient; 127 129 }; 128 130 … … 187 189 PointerLockController* pointerLockController() const { return m_pointerLockController.get(); } 188 190 #endif 191 ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient; } 189 192 190 193 ScrollingCoordinator* scrollingCoordinator(); … … 383 386 384 387 EditorClient* m_editorClient; 388 ValidationMessageClient* m_validationMessageClient; 385 389 386 390 int m_frameCount; -
trunk/Source/WebCore/page/Settings.h
r127956 r128394 461 461 bool quantizedMemoryInfoEnabled() const { return m_quantizedMemoryInfoEnabled; } 462 462 463 // This setting will be removed when an HTML5 compatibility issue is 464 // resolved and WebKit implementation of interactive validation is 465 // completed. See http://webkit.org/b/40520, http://webkit.org/b/40747, 466 // and http://webkit.org/b/40908 463 // This feature requires an implementation of ValidationMessageClient. 467 464 void setInteractiveFormValidationEnabled(bool flag) { m_interactiveFormValidation = flag; } 468 465 bool interactiveFormValidationEnabled() const { return m_interactiveFormValidation; }
Note: See TracChangeset
for help on using the changeset viewer.