Changeset 209901 in webkit
- Timestamp:
- Dec 15, 2016 7:14:52 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r209895 r209901 1 2016-12-15 Chris Dumez <cdumez@apple.com> 2 3 Make sure HTML validation bubble's state is updated after layout 4 https://bugs.webkit.org/show_bug.cgi?id=165922 5 <rdar://problem/29694730> 6 7 Reviewed by Simon Fraser. 8 9 Add several layout tests to cover this. 10 11 * fast/forms/validation-bubble-disappears-when-input-detached-expected.txt: Added. 12 * fast/forms/validation-bubble-disappears-when-input-detached.html: Added. 13 * fast/forms/validation-bubble-disappears-when-input-moved-expected.txt: Added. 14 * fast/forms/validation-bubble-disappears-when-input-moved.html: Added. 15 * fast/forms/validation-bubble-disappears-when-input-no-longer-visible-expected.txt: Added. 16 * fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html: Added. 17 1 18 2016-12-15 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-detached-expected.txt
r209900 r209901 1 Tests that the custom validation message set by JavaScript is displayed on UI side. 1 Required text input: 2 Tests that the HTML form validation bubble disappears when its associated element is detached. 2 3 3 4 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 5 5 6 PASS validationBubbleContents.message is "This is a custom validity message."7 6 PASS validationBubbleContents.message is "Fill out this field" 7 PASS validationBubbleContents.message is "" 8 8 PASS successfullyParsed is true 9 9 10 10 TEST COMPLETE 11 Required text input: 11 -
trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-detached.html
r209900 r209901 6 6 Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit"> 7 7 </form> 8 <div id="description"></div> 9 <div id="console"></div> 8 10 <script> 9 description("Tests that the custom validation message set by JavaScript is displayed on UI side.");11 description("Tests that the HTML form validation bubble disappears when its associated element is detached."); 10 12 jsTestIsAsync = true; 11 13 … … 20 22 onload = function() { 21 23 input = document.getElementById("required_text_input"); 22 input.setCustomValidity("This is a custom validity message.");23 24 submit = document.getElementById("required_text_input_submit"); 24 25 submit.click(); … … 26 27 testRunner.runUIScript(getValidationBubbleContents(), function(result) { 27 28 validationBubbleContents = JSON.parse(result).validationBubble; 28 shouldBeEqualToString("validationBubbleContents.message", " This is a custom validity message.");29 shouldBeEqualToString("validationBubbleContents.message", "Fill out this field"); 29 30 30 // Reset the validity message to the default one. 31 input.setCustomValidity(""); 32 submit.click(); 31 // Detach input element. 32 input.remove(); 33 // Force layout. 34 input.offsetTop; 33 35 34 36 testRunner.runUIScript(getValidationBubbleContents(), function(result) { 35 37 validationBubbleContents = JSON.parse(result).validationBubble; 36 shouldBeEqualToString("validationBubbleContents.message", " Fill out this field");38 shouldBeEqualToString("validationBubbleContents.message", ""); // No longer visible. 37 39 finishJSTest(); 38 40 }); -
trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-moved-expected.txt
r209900 r209901 1 Tests that the custom validation message set by JavaScript is displayed on UI side. 1 2 Required text input: 3 Tests that the HTML form validation bubble disappears when its associated element is no longer visible. 2 4 3 5 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 6 5 6 PASS validationBubbleContents.message is "This is a custom validity message."7 7 PASS validationBubbleContents.message is "Fill out this field" 8 PASS validationBubbleContents.message is "" 8 9 PASS successfullyParsed is true 9 10 10 11 TEST COMPLETE 11 Required text input: 12 -
trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-moved.html
r209900 r209901 6 6 Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit"> 7 7 </form> 8 <div id="description"></div> 9 <div id="console"></div> 8 10 <script> 9 description("Tests that the custom validation message set by JavaScript is displayed on UI side.");11 description("Tests that the HTML form validation bubble disappears when its associated element is no longer visible."); 10 12 jsTestIsAsync = true; 11 13 … … 20 22 onload = function() { 21 23 input = document.getElementById("required_text_input"); 22 input.setCustomValidity("This is a custom validity message.");23 24 submit = document.getElementById("required_text_input_submit"); 24 25 submit.click(); … … 26 27 testRunner.runUIScript(getValidationBubbleContents(), function(result) { 27 28 validationBubbleContents = JSON.parse(result).validationBubble; 28 shouldBeEqualToString("validationBubbleContents.message", " This is a custom validity message.");29 shouldBeEqualToString("validationBubbleContents.message", "Fill out this field"); 29 30 30 // Reset the validity message to the default one. 31 input.setCustomValidity(""); 32 submit.click(); 31 // Move input element. 32 document.body.prepend(document.createElement("br")); 33 // Force layout. 34 input.offsetTop; 33 35 34 36 testRunner.runUIScript(getValidationBubbleContents(), function(result) { 35 37 validationBubbleContents = JSON.parse(result).validationBubble; 36 shouldBeEqualToString("validationBubbleContents.message", " Fill out this field");38 shouldBeEqualToString("validationBubbleContents.message", ""); // No longer visible. 37 39 finishJSTest(); 38 40 }); -
trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-no-longer-visible-expected.txt
r209900 r209901 1 Tests that the custom validation message set by JavaScript is displayed on UI side. 1 Required text input: 2 Tests that the HTML form validation bubble disappears when its associated element is no longer visible. 2 3 3 4 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 5 5 6 PASS validationBubbleContents.message is "This is a custom validity message."7 6 PASS validationBubbleContents.message is "Fill out this field" 7 PASS validationBubbleContents.message is "" 8 8 PASS successfullyParsed is true 9 9 10 10 TEST COMPLETE 11 Required text input: 11 -
trunk/LayoutTests/fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html
r209900 r209901 6 6 Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit"> 7 7 </form> 8 <div id="description"></div> 9 <div id="console"></div> 8 10 <script> 9 description("Tests that the custom validation message set by JavaScript is displayed on UI side.");11 description("Tests that the HTML form validation bubble disappears when its associated element is no longer visible."); 10 12 jsTestIsAsync = true; 11 13 … … 20 22 onload = function() { 21 23 input = document.getElementById("required_text_input"); 22 input.setCustomValidity("This is a custom validity message.");23 24 submit = document.getElementById("required_text_input_submit"); 24 25 submit.click(); … … 26 27 testRunner.runUIScript(getValidationBubbleContents(), function(result) { 27 28 validationBubbleContents = JSON.parse(result).validationBubble; 28 shouldBeEqualToString("validationBubbleContents.message", " This is a custom validity message.");29 shouldBeEqualToString("validationBubbleContents.message", "Fill out this field"); 29 30 30 // Reset the validity message to the default one. 31 input.setCustomValidity(""); 32 submit.click(); 31 // Hide input element. 32 input.setAttribute("style", "display: none"); 33 // Force layout. 34 input.offsetTop; 33 35 34 36 testRunner.runUIScript(getValidationBubbleContents(), function(result) { 35 37 validationBubbleContents = JSON.parse(result).validationBubble; 36 shouldBeEqualToString("validationBubbleContents.message", " Fill out this field");38 shouldBeEqualToString("validationBubbleContents.message", ""); // No longer visible. 37 39 finishJSTest(); 38 40 }); -
trunk/LayoutTests/fast/forms/validation-custom-message-expected.txt
r208930 r209901 1 Required text input: 1 2 Tests that the custom validation message set by JavaScript is displayed on UI side. 2 3 3 4 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 5 5 6 6 PASS validationBubbleContents.message is "This is a custom validity message." … … 9 9 10 10 TEST COMPLETE 11 Required text input: 11 -
trunk/LayoutTests/fast/forms/validation-custom-message.html
r208930 r209901 6 6 Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit"> 7 7 </form> 8 <div id="description"></div> 9 <div id="console"></div> 8 10 <script> 9 11 description("Tests that the custom validation message set by JavaScript is displayed on UI side."); -
trunk/LayoutTests/fast/forms/validation-messages-expected.txt
r209620 r209901 1 Required text input: 2 Required checkbox input: 3 Required radio input: 4 Required radio input: 5 Required file input: 6 Required email input: 7 Required url input: 8 Required input with pattern: 9 Required input with minlength=100: 10 Required range with min=5: 11 Required range with max=5: 12 Required range with step=3 / min=0: 1 13 Tests the HTML form validation messages being shown on UI side. 2 14 3 15 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 5 16 6 17 PASS validationBubbleContents.message is "Fill out this field" … … 18 29 19 30 TEST COMPLETE 20 Required text input: 21 Required checkbox input: 22 Required radio input: 23 Required radio input: 24 Required file input: 25 Required email input: 26 Required url input: 27 Required input with pattern: 28 Required input with minlength=100: 29 Required range with min=5: 30 Required range with max=5: 31 Required range with step=3 / min=0: 31 -
trunk/LayoutTests/fast/forms/validation-messages.html
r209620 r209901 38 38 Required range with step=3 / min=0: <input type="number" value="10" min=0 step=3 required><input id="range_with_step_submit" type="submit"> 39 39 </form> 40 <div id="description"></div> 41 <div id="console"></div> 40 42 <script> 41 43 description("Tests the HTML form validation messages being shown on UI side."); -
trunk/LayoutTests/platform/ios-simulator-wk2/fast/forms/validation-messages-expected.txt
r209620 r209901 1 Required text input: 2 Required checkbox input: 3 Required radio input: 4 Required radio input: 5 Required file input: 6 Required email input: 7 Required url input: 8 Required input with pattern: 9 Required input with minlength=100: 10 Required range with min=5: 11 Required range with max=5: 12 Required range with step=3 / min=0: 1 13 Tests the HTML form validation messages being shown on UI side. 2 14 3 15 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 5 16 6 17 PASS validationBubbleContents.message is "Fill out this field" … … 18 29 19 30 TEST COMPLETE 20 Required text input: 21 Required checkbox input: 22 Required radio input: 23 Required radio input: 24 Required file input: 25 Required email input: 26 Required url input: 27 Required input with pattern: 28 Required input with minlength=100: 29 Required range with min=5: 30 Required range with max=5: 31 Required range with step=3 / min=0: 31 -
trunk/Source/WebCore/ChangeLog
r209900 r209901 1 2016-12-15 Chris Dumez <cdumez@apple.com> 2 3 Make sure HTML validation bubble's state is updated after layout 4 https://bugs.webkit.org/show_bug.cgi?id=165922 5 <rdar://problem/29694730> 6 7 Reviewed by Simon Fraser. 8 9 Make sure HTML validation bubble's state is updated after layout. 10 In particular, if the validation bubble's associated element has 11 moved or is no longer visible, we now hide the bubble. 12 13 Tests: fast/forms/validation-bubble-disappears-when-input-detached.html 14 fast/forms/validation-bubble-disappears-when-input-moved.html 15 fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html 16 17 * page/FrameView.cpp: 18 (WebCore::FrameView::viewportContentsChanged): 19 * page/Page.cpp: 20 (WebCore::Page::updateValidationBubbleStateIfNeeded): 21 * page/Page.h: 22 * page/ValidationMessageClient.h: 23 1 24 2016-12-15 Sam Weinig <sam@webkit.org> 2 25 -
trunk/Source/WebCore/page/FrameView.cpp
r209745 r209901 2128 2128 } 2129 2129 2130 if (auto* page = frame().page()) 2131 page->updateValidationBubbleStateIfNeeded(); 2132 2130 2133 // When the viewport contents changes (scroll, resize, style recalc, layout, ...), 2131 2134 // check if we should resume animated images or unthrottle DOM timers. -
trunk/Source/WebCore/page/Page.cpp
r209733 r209901 136 136 } 137 137 138 void Page::updateValidationBubbleStateIfNeeded() 139 { 140 if (auto* client = validationMessageClient()) 141 client->updateValidationBubbleStateIfNeeded(); 142 } 143 138 144 static void networkStateChanged(bool isOnLine) 139 145 { -
trunk/Source/WebCore/page/Page.h
r209514 r209901 216 216 PointerLockController& pointerLockController() const { return *m_pointerLockController; } 217 217 #endif 218 218 219 ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient.get(); } 220 void updateValidationBubbleStateIfNeeded(); 219 221 220 222 WEBCORE_EXPORT ScrollingCoordinator* scrollingCoordinator(); -
trunk/Source/WebCore/page/ValidationMessageClient.h
r208179 r209901 48 48 // is visible. 49 49 virtual bool isValidationMessageVisible(const Element& anchor) = 0; 50 51 virtual void updateValidationBubbleStateIfNeeded() = 0; 50 52 }; 51 53 -
trunk/Source/WebKit/mac/ChangeLog
r209895 r209901 1 2016-12-15 Chris Dumez <cdumez@apple.com> 2 3 Make sure HTML validation bubble's state is updated after layout 4 https://bugs.webkit.org/show_bug.cgi?id=165922 5 <rdar://problem/29694730> 6 7 Reviewed by Simon Fraser. 8 9 Make sure HTML validation bubble's state is updated after layout. 10 In particular, if the validation bubble's associated element has 11 moved or is no longer visible, we now hide the bubble. 12 13 * WebCoreSupport/WebValidationMessageClient.h: 14 * WebCoreSupport/WebValidationMessageClient.mm: 15 (WebValidationMessageClient::showValidationMessage): 16 (WebValidationMessageClient::hideValidationMessage): 17 (WebValidationMessageClient::updateValidationBubbleStateIfNeeded): 18 1 19 2016-12-15 Chris Dumez <cdumez@apple.com> 2 20 -
trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h
r209252 r209901 26 26 #pragma once 27 27 28 #import <WebCore/IntRect.h> 28 29 #import <WebCore/ValidationMessageClient.h> 29 30 … … 43 44 void hideValidationMessage(const WebCore::Element& anchor) final; 44 45 bool isValidationMessageVisible(const WebCore::Element& anchor) final; 46 void updateValidationBubbleStateIfNeeded() final; 45 47 46 48 private: 47 49 WebView* m_view; 48 50 const WebCore::Element* m_currentAnchor { nullptr }; 51 WebCore::IntRect m_currentAnchorRect; 49 52 }; -
trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm
r209252 r209901 49 49 50 50 m_currentAnchor = &anchor; 51 [m_view showFormValidationMessage:message withAnchorRect:anchor.clientRect()]; 51 m_currentAnchorRect = anchor.clientRect(); 52 [m_view showFormValidationMessage:message withAnchorRect:m_currentAnchorRect]; 52 53 } 53 54 … … 58 59 59 60 m_currentAnchor = nullptr; 61 m_currentAnchorRect = { }; 60 62 [m_view hideFormValidationMessage]; 61 63 } … … 65 67 return m_currentAnchor == &anchor; 66 68 } 69 70 void WebValidationMessageClient::updateValidationBubbleStateIfNeeded() 71 { 72 if (!m_currentAnchor) 73 return; 74 75 // We currently hide the validation bubble if its position is outdated instead of trying 76 // to update its position. 77 if (m_currentAnchorRect != m_currentAnchor->clientRect()) 78 hideValidationMessage(*m_currentAnchor); 79 } -
trunk/Source/WebKit2/ChangeLog
r209898 r209901 1 2016-12-15 Chris Dumez <cdumez@apple.com> 2 3 Make sure HTML validation bubble's state is updated after layout 4 https://bugs.webkit.org/show_bug.cgi?id=165922 5 <rdar://problem/29694730> 6 7 Reviewed by Simon Fraser. 8 9 Make sure HTML validation bubble's state is updated after layout. 10 In particular, if the validation bubble's associated element has 11 moved or is no longer visible, we now hide the bubble. 12 13 * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp: 14 (WebKit::WebValidationMessageClient::showValidationMessage): 15 (WebKit::WebValidationMessageClient::hideValidationMessage): 16 (WebKit::WebValidationMessageClient::updateValidationBubbleStateIfNeeded): 17 * WebProcess/WebCoreSupport/WebValidationMessageClient.h: 18 1 19 2016-12-15 Alex Christensen <achristensen@webkit.org> 2 20 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp
r208361 r209901 53 53 54 54 m_currentAnchor = &anchor; 55 m_page.send(Messages::WebPageProxy::ShowValidationMessage(anchor.clientRect(), message)); 55 m_currentAnchorRect = anchor.clientRect(); 56 m_page.send(Messages::WebPageProxy::ShowValidationMessage(m_currentAnchorRect, message)); 56 57 } 57 58 … … 62 63 63 64 m_currentAnchor = nullptr; 65 m_currentAnchorRect = { }; 64 66 m_page.send(Messages::WebPageProxy::HideValidationMessage()); 65 67 } … … 70 72 } 71 73 74 void WebValidationMessageClient::updateValidationBubbleStateIfNeeded() 75 { 76 if (!m_currentAnchor) 77 return; 78 79 // We currently hide the validation bubble if its position is outdated instead of trying 80 // to update its position. 81 if (m_currentAnchorRect != m_currentAnchor->clientRect()) 82 hideValidationMessage(*m_currentAnchor); 83 } 84 72 85 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h
r208361 r209901 42 42 void hideValidationMessage(const WebCore::Element& anchor) final; 43 43 bool isValidationMessageVisible(const WebCore::Element& anchor) final; 44 void updateValidationBubbleStateIfNeeded() final; 44 45 45 46 private: 46 47 WebPage& m_page; 47 48 const WebCore::Element* m_currentAnchor { nullptr }; 49 WebCore::IntRect m_currentAnchorRect; 48 50 }; 49 51
Note: See TracChangeset
for help on using the changeset viewer.