Changeset 268866 in webkit
- Timestamp:
- Oct 22, 2020, 8:55:54 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/forms/ios/input-peripherals-with-validation-message-expected.txt (added)
-
LayoutTests/fast/forms/ios/input-peripherals-with-validation-message.html (added)
-
LayoutTests/resources/ui-helper.js (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLFormControlElement.cpp (modified) (3 diffs)
-
Source/WebCore/html/HTMLFormControlElement.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/FocusedElementInformation.cpp (modified) (2 diffs)
-
Source/WebKit/Shared/FocusedElementInformation.h (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (2 diffs)
-
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r268865 r268866 1 2020-10-22 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS] Prevent presentation of input peripherals when focusing form controls with a validation message 4 https://bugs.webkit.org/show_bug.cgi?id=218004 5 <rdar://problem/70507678> 6 7 Reviewed by Wenson Hsieh. 8 9 Added a test which verifies that focusing on a date input as a result 10 of presenting a validation message, successfully presents the message, 11 and does not present a context menu. The test also ensures that controls 12 that present a keyboard, such as text inputs, present both the message 13 and the keyboard. 14 15 * fast/forms/ios/input-peripherals-with-validation-message-expected.txt: Added. 16 * fast/forms/ios/input-peripherals-with-validation-message.html: Added. 17 * resources/ui-helper.js: 18 (window.UIHelper.isShowingPopover): 19 1 20 2020-10-22 Peng Liu <peng.liu6@apple.com> 2 21 -
trunk/LayoutTests/resources/ui-helper.js
r268847 r268866 578 578 return new Promise(resolve => { 579 579 testRunner.runUIScript("uiController.isShowingKeyboard", result => resolve(result === "true")); 580 }); 581 } 582 583 static isShowingPopover() 584 { 585 return new Promise(resolve => { 586 testRunner.runUIScript("uiController.isShowingPopover", result => resolve(result === "true")); 580 587 }); 581 588 } -
trunk/Source/WebCore/ChangeLog
r268865 r268866 1 2020-10-22 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS] Prevent presentation of input peripherals when focusing form controls with a validation message 4 https://bugs.webkit.org/show_bug.cgi?id=218004 5 <rdar://problem/70507678> 6 7 Reviewed by Wenson Hsieh. 8 9 Added isFocusingWithValidationMessage() to HTMLFormControlElement so 10 that the state can be encoded in FocusedElementInformation and sent to 11 the UIProcess. 12 13 See WebKit Changelog for more information. 14 15 Test: fast/forms/ios/input-peripherals-with-validation-message.html 16 17 * html/HTMLFormControlElement.cpp: 18 (WebCore::HTMLFormControlElement::isFocusingWithValidationMessage const): 19 (WebCore::HTMLFormControlElement::focusAndShowValidationMessage): 20 * html/HTMLFormControlElement.h: 21 1 22 2020-10-22 Peng Liu <peng.liu6@apple.com> 2 23 -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r264332 r268866 50 50 #include <wtf/IsoMallocInlines.h> 51 51 #include <wtf/Ref.h> 52 #include <wtf/SetForScope.h> 52 53 #include <wtf/Vector.h> 53 54 … … 497 498 } 498 499 500 bool HTMLFormControlElement::isFocusingWithValidationMessage() const 501 { 502 return m_isFocusingWithValidationMessage; 503 } 504 499 505 bool HTMLFormControlElement::isShowingValidationMessage() const 500 506 { … … 530 536 void HTMLFormControlElement::focusAndShowValidationMessage() 531 537 { 538 SetForScope<bool> isFocusingWithValidationMessageScope(m_isFocusingWithValidationMessage, true); 539 532 540 // Calling focus() will scroll the element into view. 533 541 focus(); -
trunk/Source/WebCore/html/HTMLFormControlElement.h
r257188 r268866 107 107 void focusAndShowValidationMessage(); 108 108 bool isShowingValidationMessage() const; 109 WEBCORE_EXPORT bool isFocusingWithValidationMessage() const; 109 110 // This must be called when a validation constraint or control value is changed. 110 111 void updateValidity(); … … 181 182 182 183 std::unique_ptr<ValidationMessage> m_validationMessage; 184 bool m_isFocusingWithValidationMessage { false }; 185 183 186 unsigned m_disabled : 1; 184 187 unsigned m_isReadOnly : 1; -
trunk/Source/WebKit/ChangeLog
r268858 r268866 1 2020-10-22 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS] Prevent presentation of input peripherals when focusing form controls with a validation message 4 https://bugs.webkit.org/show_bug.cgi?id=218004 5 <rdar://problem/70507678> 6 7 Reviewed by Wenson Hsieh. 8 9 Interactive form validation can result in the presentation of a 10 validation message bubble near the first form control that has invalid 11 data. Prior to displaying the message, the invalid control is focused. 12 On iOS, this also has the effect of also presenting a virtual keyboard 13 or another custom input peripheral, such as a context menu for date 14 inputs. 15 16 Attempting to present both the validation message and custom input 17 peripheral can leave the view in an inconsistent state. For example, 18 <select> popovers have a strange flashing behavior when presented 19 alongside a validation message, and context menus can fail to present 20 entirely. 21 22 In order to address these issues, we should never attempt to present 23 both a validation message and an input peripheral. Instead, we can 24 prevent the presentation of input peripherals when the focused control 25 is presenting a validation message. This behavior matches macOS. Note 26 that we still present the keyboard for controls that have a keyboard 27 view, since the keyboard area does overlap the area where a validation 28 message is presented. 29 30 * Shared/FocusedElementInformation.cpp: 31 (WebKit::FocusedElementInformation::encode const): 32 (WebKit::FocusedElementInformation::decode): 33 * Shared/FocusedElementInformation.h: 34 35 Added isFocusingWithValidationMessage to the struct, so that the UIProcess 36 knows that the element gained focus due to the presentation of a 37 validation message. 38 39 * UIProcess/ios/WKContentViewInteraction.mm: 40 (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): 41 42 Prevent an input view from being shown if the control does not present 43 a keyboard and was focused with a validation message. 44 45 (-[WKContentView _elementDidBlur]): 46 * WebProcess/WebPage/ios/WebPageIOS.mm: 47 (WebKit::WebPage::getFocusedElementInformation): 48 1 49 2020-10-22 Carlos Garcia Campos <cgarcia@igalia.com> 2 50 -
trunk/Source/WebKit/Shared/FocusedElementInformation.cpp
r266342 r268866 111 111 encoder << shouldAvoidScrollingWhenFocusedContentIsVisible; 112 112 encoder << shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation; 113 encoder << isFocusingWithValidationMessage; 113 114 } 114 115 … … 247 248 return false; 248 249 250 if (!decoder.decode(result.isFocusingWithValidationMessage)) 251 return false; 252 249 253 return true; 250 254 } -
trunk/Source/WebKit/Shared/FocusedElementInformation.h
r266342 r268866 145 145 bool shouldAvoidScrollingWhenFocusedContentIsVisible { false }; 146 146 bool shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation { false }; 147 bool isFocusingWithValidationMessage { false }; 147 148 148 149 FocusedElementIdentifier focusedElementIdentifier { 0 }; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r268182 r268866 5941 5941 }(); 5942 5942 5943 // Do not present input peripherals if a validation message is being displayed. 5944 if (information.isFocusingWithValidationMessage && !_isFocusingElementWithKeyboard) 5945 shouldShowInputView = NO; 5946 5943 5947 if (blurPreviousNode) { 5944 5948 // Defer view updates until the end of this function to avoid a noticeable flash when switching focus … … 6073 6077 _focusedElementInformation.shouldAvoidScrollingWhenFocusedContentIsVisible = false; 6074 6078 _focusedElementInformation.shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation = false; 6079 _focusedElementInformation.isFocusingWithValidationMessage = false; 6075 6080 _inputPeripheral = nil; 6076 6081 _focusRequiresStrongPasswordAssistance = NO; -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r268635 r268866 3053 3053 information.isSpellCheckingEnabled = downcast<HTMLElement>(*focusedElement).spellcheck(); 3054 3054 3055 if (is<HTMLFormControlElement>(focusedElement)) 3056 information.isFocusingWithValidationMessage = downcast<HTMLFormControlElement>(*focusedElement).isFocusingWithValidationMessage(); 3057 3055 3058 information.minimumScaleFactor = minimumPageScaleFactor(); 3056 3059 information.maximumScaleFactor = maximumPageScaleFactor();
Note:
See TracChangeset
for help on using the changeset viewer.