Changeset 249006 in webkit
- Timestamp:
- Aug 22, 2019, 8:09:48 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/editing/selection/ios/do-not-show-selection-in-empty-borderless-subframe-expected.txt (added)
-
LayoutTests/editing/selection/ios/do-not-show-selection-in-empty-borderless-subframe.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayer.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Platform/spi/ios/UIKitSPI.h (modified) (1 diff)
-
Source/WebKit/UIProcess/PageClient.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/PageClientImplIOS.h (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/WebPage.cpp (modified) (4 diffs)
-
Source/WebKit/WebProcess/WebPage/WebPage.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249001 r249006 1 2019-08-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Typing Korean in title field after typing in the body inserts extraneous characters on blog.naver.com 4 https://bugs.webkit.org/show_bug.cgi?id=201023 5 <rdar://problem/54294794> 6 7 Reviewed by Ryosuke Niwa. 8 9 Add a new layout test to verify that we suppress text interactions when focusing an editable element inside an 10 empty, borderless subframe. 11 12 * editing/selection/ios/do-not-show-selection-in-empty-borderless-subframe-expected.txt: Added. 13 * editing/selection/ios/do-not-show-selection-in-empty-borderless-subframe.html: Added. 14 1 15 2019-08-22 Youenn Fablet <youenn@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r249002 r249006 1 2019-08-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Typing Korean in title field after typing in the body inserts extraneous characters on blog.naver.com 4 https://bugs.webkit.org/show_bug.cgi?id=201023 5 <rdar://problem/54294794> 6 7 Reviewed by Ryosuke Niwa. 8 9 Ensures that we recognize the blog editor on blog.naver.com to be a hidden editable area. This website places 10 focus inside an editable body element of a subframe that is completely empty (width: 0 and border: 0). See the 11 WebKit ChangeLog for more details. 12 13 Test: editing/selection/ios/do-not-show-selection-in-empty-borderless-subframe.html 14 15 * rendering/RenderLayer.cpp: 16 (WebCore::RenderLayer::calculateClipRects const): 17 1 18 2019-08-22 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r248977 r249006 6819 6819 return false; 6820 6820 6821 if (is<HTMLFrameOwnerElement>(layer.renderer().element()) && layer.visibleSize().isEmpty()) 6822 return true; 6823 6821 6824 LayoutRect layerBounds; 6822 6825 ClipRect backgroundRect; -
trunk/Source/WebKit/ChangeLog
r249001 r249006 1 2019-08-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Typing Korean in title field after typing in the body inserts extraneous characters on blog.naver.com 4 https://bugs.webkit.org/show_bug.cgi?id=201023 5 <rdar://problem/54294794> 6 7 Reviewed by Ryosuke Niwa. 8 9 After r242833, we began to avoid sending redundant ElementDidFocus updates in the case where a focused element 10 was blurred and refocused within the same runloop. This was done to prevent the input view from flickering due 11 to input view reloading, as well as scrolling to reveal the focused element, when tapping to change selection on 12 Microsoft Word online. 13 14 However, on blog.naver.com, these ElementDidFocus messages were necessary in order to ensure that the platform 15 input context changes when moving between the title and body fields, or when tapping to change selection. This 16 is because blog.naver.com uses a hidden contenteditable area under a subframe (see WebCore ChangeLog for more 17 detail here). While text is never directly inserted into this hidden contenteditable, the events are observed 18 and used to "play back" editing in the main visible content area. 19 20 Thus, when moving between the title and body fields (or when changing selection within either), the only hint we 21 get is that the hidden editable element is blurred and immediately refocused. Since we no longer send 22 ElementDidFocus updates in this scenario, UIKeyboardImpl and kbd are not aware that the page has effectively 23 changed input contexts. 24 25 Combined with the fact that Korean IME on iOS may insert additional text given the document context (i.e. text 26 that the input manager, kbd, thinks we've previously inserted), this means that when typing several characters 27 into the body field on naver and then switching to edit the title, initial keystrokes may insert unexpected 28 text in the title field. 29 30 To fix this, we add some hooks to notify the UI process when an element that was blurred has been immediately 31 refocused. Upon receiving this message, the UI process then tells UIKeyboardImpl to re-retrieve its input 32 context, which calls into -requestAutocorrectionContextWithCompletionHandler: in WKContentView. While notorious 33 for being synchronous IPC, this is mitigated by (1) being limiting to only instances where we have a hidden 34 editable area, and (2) being limited by a batching mechanism in the web process, such that if the focused 35 element is blurred, refocused, re-blurred, and refocused many times in the same runloop, we'll only send a 36 single UpdateInputContextAfterBlurringAndRefocusingElement message (as opposed to the many ElementDidFocus 37 messages we would've sent in previous releases). 38 39 * Platform/spi/ios/UIKitSPI.h: 40 * UIProcess/PageClient.h: 41 * UIProcess/WebPageProxy.h: 42 * UIProcess/WebPageProxy.messages.in: 43 44 Add a new mechanism to update the platform input context (on iOS, UIKeyboardImpl's document state) when focus 45 moves away from and immediately returns to a hidden editable element. 46 47 * UIProcess/ios/PageClientImplIOS.h: 48 * UIProcess/ios/PageClientImplIOS.mm: 49 (WebKit::PageClientImpl::updateInputContextAfterBlurringAndRefocusingElement): 50 * UIProcess/ios/WKContentViewInteraction.h: 51 * UIProcess/ios/WKContentViewInteraction.mm: 52 (-[WKContentView _updateInputContextAfterBlurringAndRefocusingElement]): 53 54 Tell the active UIKeyboardImpl to refetch document state from the WKContentView. While this does result in a new 55 autocorrection context request (which, unfortunately, triggers synchronous IPC to the web process), this request 56 would've still happened anyways in the case where we would previously have sent an ElementDidFocus message. 57 58 * UIProcess/ios/WebPageProxyIOS.mm: 59 (WebKit::WebPageProxy::updateInputContextAfterBlurringAndRefocusingElement): 60 * WebProcess/WebPage/WebPage.cpp: 61 (WebKit::WebPage::elementDidFocus): 62 63 In the case where we avoid sending a full ElementDidFocus message to the UI process due to refocusing the same 64 element, we should still notify the UI process so that it can synchronize state between the application process 65 and kbd. See above for more details. 66 67 (WebKit::WebPage::elementDidBlur): 68 (WebKit::WebPage::updateInputContextAfterBlurringAndRefocusingElementIfNeeded): 69 * WebProcess/WebPage/WebPage.h: 70 * WebProcess/WebPage/ios/WebPageIOS.mm: 71 (WebKit::WebPage::updateInputContextAfterBlurringAndRefocusingElementIfNeeded): 72 1 73 2019-08-22 Youenn Fablet <youenn@apple.com> 2 74 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r248535 r249006 271 271 @interface UIKeyboardImpl : UIView <UIKeyboardCandidateListDelegate> 272 272 - (BOOL)smartInsertDeleteIsEnabled; 273 - (void)updateForChangedSelection; 273 274 @end 274 275 -
trunk/Source/WebKit/UIProcess/PageClient.h
r248762 r249006 387 387 388 388 virtual void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, API::Object* userData) = 0; 389 virtual void updateInputContextAfterBlurringAndRefocusingElement() = 0; 389 390 virtual void elementDidBlur() = 0; 390 391 virtual void focusedElementDidChangeInputMode(WebCore::InputMode) = 0; -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r248847 r249006 1945 1945 void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, const UserData&); 1946 1946 void elementDidBlur(); 1947 void updateInputContextAfterBlurringAndRefocusingElement(); 1947 1948 void focusedElementDidChangeInputMode(WebCore::InputMode); 1948 1949 void didReleaseAllTouchPoints(); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r248847 r249006 409 409 ElementDidFocus(struct WebKit::FocusedElementInformation information, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, WebKit::UserData userData) 410 410 ElementDidBlur() 411 UpdateInputContextAfterBlurringAndRefocusingElement() 411 412 FocusedElementDidChangeInputMode(enum:uint8_t WebCore::InputMode mode) 412 413 ScrollingNodeScrollWillStartScroll() -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h
r247866 r249006 150 150 151 151 void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, API::Object* userData) override; 152 void updateInputContextAfterBlurringAndRefocusingElement() final; 152 153 void elementDidBlur() override; 153 154 void focusedElementDidChangeInputMode(WebCore::InputMode) override; -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
r248828 r249006 559 559 } 560 560 561 void PageClientImpl::updateInputContextAfterBlurringAndRefocusingElement() 562 { 563 [m_contentView _updateInputContextAfterBlurringAndRefocusingElement]; 564 } 565 561 566 bool PageClientImpl::isFocusingElement() 562 567 { -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r248733 r249006 460 460 - (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale; 461 461 - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode activityStateChanges:(OptionSet<WebCore::ActivityState::Flag>)activityStateChanges userObject:(NSObject <NSSecureCoding> *)userObject; 462 - (void)_updateInputContextAfterBlurringAndRefocusingElement; 462 463 - (void)_elementDidBlur; 463 464 - (void)_hideContextMenuHintContainer; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r248900 r249006 5493 5493 } 5494 5494 5495 - (void)_updateInputContextAfterBlurringAndRefocusingElement 5496 { 5497 if (!hasFocusedElement(_focusedElementInformation) || !_suppressSelectionAssistantReasons) 5498 return; 5499 5500 [UIKeyboardImpl.activeInstance updateForChangedSelection]; 5501 } 5502 5495 5503 - (BOOL)shouldIgnoreKeyboardWillHideNotification 5496 5504 { -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r248846 r249006 905 905 } 906 906 907 void WebPageProxy::updateInputContextAfterBlurringAndRefocusingElement() 908 { 909 pageClient().updateInputContextAfterBlurringAndRefocusingElement(); 910 } 911 907 912 void WebPageProxy::elementDidFocus(const FocusedElementInformation& information, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, const UserData& userData) 908 913 { -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r248901 r249006 5470 5470 { 5471 5471 if (!shouldDispatchUpdateAfterFocusingElement(element)) { 5472 updateInputContextAfterBlurringAndRefocusingElementIfNeeded(element); 5472 5473 m_focusedElement = &element; 5473 5474 m_recentlyBlurredElement = nullptr; … … 5477 5478 if (is<HTMLSelectElement>(element) || isTextFormControlOrEditableContent(element)) { 5478 5479 m_focusedElement = &element; 5480 m_hasPendingInputContextUpdateAfterBlurringAndRefocusingElement = false; 5479 5481 5480 5482 #if PLATFORM(IOS_FAMILY) … … 5518 5520 protectedThis->m_recentlyBlurredElement = nullptr; 5519 5521 }); 5522 m_hasPendingInputContextUpdateAfterBlurringAndRefocusingElement = false; 5520 5523 } 5521 5524 } … … 6694 6697 } 6695 6698 6699 void WebPage::updateInputContextAfterBlurringAndRefocusingElementIfNeeded(Element&) 6700 { 6701 } 6702 6696 6703 #endif // !PLATFORM(IOS_FAMILY) 6697 6704 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r248974 r249006 607 607 void focusedElementDidChangeInputMode(WebCore::Element&, WebCore::InputMode); 608 608 void resetFocusedElementForFrame(WebFrame*); 609 void updateInputContextAfterBlurringAndRefocusingElementIfNeeded(WebCore::Element&); 609 610 610 611 void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&); … … 1827 1828 RefPtr<WebCore::Element> m_focusedElement; 1828 1829 RefPtr<WebCore::Element> m_recentlyBlurredElement; 1830 bool m_hasPendingInputContextUpdateAfterBlurringAndRefocusingElement { false }; 1829 1831 bool m_hasPendingEditorStateUpdate { false }; 1830 1832 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r248928 r249006 1170 1170 } 1171 1171 1172 void WebPage::updateInputContextAfterBlurringAndRefocusingElementIfNeeded(Element& element) 1173 { 1174 if (m_recentlyBlurredElement != &element || !m_isShowingInputViewForFocusedElement) 1175 return; 1176 1177 m_hasPendingInputContextUpdateAfterBlurringAndRefocusingElement = true; 1178 callOnMainThread([this, protectedThis = makeRefPtr(this)] { 1179 if (m_hasPendingInputContextUpdateAfterBlurringAndRefocusingElement) 1180 send(Messages::WebPageProxy::UpdateInputContextAfterBlurringAndRefocusingElement()); 1181 m_hasPendingInputContextUpdateAfterBlurringAndRefocusingElement = false; 1182 }); 1183 } 1184 1172 1185 void WebPage::blurFocusedElement() 1173 1186 {
Note:
See TracChangeset
for help on using the changeset viewer.