Changeset 249296 in webkit


Ignore:
Timestamp:
Aug 29, 2019 3:17:46 PM (5 years ago)
Author:
Wenson Hsieh
Message:

[iOS 13] Caret does not appear in text field if the body element is translated completely out of the viewport
https://bugs.webkit.org/show_bug.cgi?id=201287
<rdar://problem/54780864>

Reviewed by Tim Horton.

Source/WebKit:

During EditorState computation, we use the hidden editable element heuristic to determine whether we should
begin suppressing selection gestures and UI. Currently, we use the editable root of the selection range to
determine where in the layer tree we should start our ascent, in search of a completely transparent or
completely clipped container.

However, in the case where the selection is inside a focused text field, this causes us to walk up the layer
tree starting at the RenderLayer corresponding to the text field's inner contenteditable div, which is different
than the text field's enclosing RenderLayer in the case where the containing block is transformed, such that no
part of it is within the visible viewport. This scenario is exercised by the below test case, in which the caret
after transforming the body horizontally by -100vw is hidden due to a false positive in the hidden editable area
heuristic.

Fix this by starting the layer tree ascent from the enclosing layer of the text form control if applicable,
instead of the inner editable area under the shadow root of the form control.

Test: editing/selection/ios/show-selection-in-transformed-container.html

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::platformEditorState const):

LayoutTests:

Add a new layout test that covers this scenario. See WebKit ChangeLog for additional detail.

  • editing/selection/ios/show-selection-in-transformed-container-expected.txt: Added.
  • editing/selection/ios/show-selection-in-transformed-container.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249293 r249296  
     12019-08-29  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS 13] Caret does not appear in text field if the body element is translated completely out of the viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=201287
     5        <rdar://problem/54780864>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add a new layout test that covers this scenario. See WebKit ChangeLog for additional detail.
     10
     11        * editing/selection/ios/show-selection-in-transformed-container-expected.txt: Added.
     12        * editing/selection/ios/show-selection-in-transformed-container.html: Added.
     13
    1142019-08-29  Ryosuke Niwa  <rniwa@webkit.org>
    215
  • trunk/Source/WebKit/ChangeLog

    r249287 r249296  
     12019-08-29  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS 13] Caret does not appear in text field if the body element is translated completely out of the viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=201287
     5        <rdar://problem/54780864>
     6
     7        Reviewed by Tim Horton.
     8
     9        During EditorState computation, we use the hidden editable element heuristic to determine whether we should
     10        begin suppressing selection gestures and UI. Currently, we use the editable root of the selection range to
     11        determine where in the layer tree we should start our ascent, in search of a completely transparent or
     12        completely clipped container.
     13
     14        However, in the case where the selection is inside a focused text field, this causes us to walk up the layer
     15        tree starting at the RenderLayer corresponding to the text field's inner contenteditable div, which is different
     16        than the text field's enclosing RenderLayer in the case where the containing block is transformed, such that no
     17        part of it is within the visible viewport. This scenario is exercised by the below test case, in which the caret
     18        after transforming the body horizontally by -100vw is hidden due to a false positive in the hidden editable area
     19        heuristic.
     20
     21        Fix this by starting the layer tree ascent from the enclosing layer of the text form control if applicable,
     22        instead of the inner editable area under the shadow root of the form control.
     23
     24        Test: editing/selection/ios/show-selection-in-transformed-container.html
     25
     26        * WebProcess/WebPage/ios/WebPageIOS.mm:
     27        (WebKit::WebPage::platformEditorState const):
     28
    1292019-08-29  Youenn Fablet  <youenn@apple.com>
    230
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r249230 r249296  
    274274        }
    275275        if (result.isContentEditable) {
    276             if (auto container = makeRefPtr(selection.rootEditableElement()))
    277                 postLayoutData.editableRootIsTransparentOrFullyClipped = isTransparentOrFullyClipped(*container);
     276            if (auto editableRootOrFormControl = makeRefPtr(selection.rootEditableElement())) {
     277                if (is<HTMLTextFormControlElement>(editableRootOrFormControl->shadowHost()))
     278                    editableRootOrFormControl = editableRootOrFormControl->shadowHost();
     279                postLayoutData.editableRootIsTransparentOrFullyClipped = isTransparentOrFullyClipped(*editableRootOrFormControl);
     280            }
    278281        }
    279282        computeEditableRootHasContentAndPlainText(selection, postLayoutData);
Note: See TracChangeset for help on using the changeset viewer.