Changeset 191954 in webkit


Ignore:
Timestamp:
Nov 3, 2015 9:15:38 AM (8 years ago)
Author:
Wenson Hsieh
Message:

Tapping *below* some <input>s can focus them in Mobile Safari
https://bugs.webkit.org/show_bug.cgi?id=146244
<rdar://problem/21509310>

Reviewed by Darin Adler.

Source/WebCore:

Removes iOS-specific logic in positionForPointRespectingEditingBoundaries that was causing us to focus inputs by
tapping on the document element. We believe this logic, which causes VisiblePosition finding to recurse from a non-
editable element to an editable child, is not necessary to focus editable elements underneath non-editable elements,
since hit-testing will already have selected the contentEditable element prior to searching for a suitable
VisiblePosition. Further investigation shows that this logic was added to fix <rdar://problem/5545799>, in which the
first character in a Notes document could not be selected. However, I have not been able to reproduce this bug after
removing this logic.

As a result of this change, we can also enable a WK1 test, editing/selection/click-outside-editable-div.html, that
had also been marked as failing due to positionForPointRespectingEditingBoundaries recursing into a contentEditable
div.

Test: fast/events/ios/clicking-document-should-not-trigger-focus.html

  • rendering/RenderBlock.cpp:

(WebCore::positionForPointRespectingEditingBoundaries): Deleted.

LayoutTests:

Enables a now-passing WK1 editing test (editing/selection/click-outside-editable-div.html) and also add a new
WK2 test that verifies an input node won't be focused by clicking anywhere in the document outside of the body.

  • fast/events/ios/clicking-document-should-not-trigger-focus-expected.txt: Added.
  • fast/events/ios/clicking-document-should-not-trigger-focus.html: Added.
  • platform/ios-simulator-wk1/TestExpectations: No longer disable editing/selection/click-outside-editable-div.html.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r191953 r191954  
     12015-11-02  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Tapping *below* some <input>s can focus them in Mobile Safari
     4        https://bugs.webkit.org/show_bug.cgi?id=146244
     5        <rdar://problem/21509310>
     6
     7        Reviewed by Darin Adler.
     8
     9        Enables a now-passing WK1 editing test (editing/selection/click-outside-editable-div.html) and also add a new
     10        WK2 test that verifies an input node won't be focused by clicking anywhere in the document outside of the body.
     11
     12        * fast/events/ios/clicking-document-should-not-trigger-focus-expected.txt: Added.
     13        * fast/events/ios/clicking-document-should-not-trigger-focus.html: Added.
     14        * platform/ios-simulator-wk1/TestExpectations: No longer disable editing/selection/click-outside-editable-div.html.
     15
    1162015-11-03  Myles C. Maxfield  <mmaxfield@apple.com>
    217
  • trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations

    r190659 r191954  
    299299editing/selection/caret-mode-paragraph-keys-navigation.html [ Failure ]
    300300editing/selection/click-in-focusable-link-should-not-clear-selection.html [ Failure ]
    301 editing/selection/click-outside-editable-div.html [ Failure ]
    302301editing/selection/collapse-selection-in-bidi.html [ Failure ]
    303302editing/selection/context-menu-on-text.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r191953 r191954  
     12015-11-02  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Tapping *below* some <input>s can focus them in Mobile Safari
     4        https://bugs.webkit.org/show_bug.cgi?id=146244
     5        <rdar://problem/21509310>
     6
     7        Reviewed by Darin Adler.
     8
     9        Removes iOS-specific logic in positionForPointRespectingEditingBoundaries that was causing us to focus inputs by
     10        tapping on the document element. We believe this logic, which causes VisiblePosition finding to recurse from a non-
     11        editable element to an editable child, is not necessary to focus editable elements underneath non-editable elements,
     12        since hit-testing will already have selected the contentEditable element prior to searching for a suitable
     13        VisiblePosition. Further investigation shows that this logic was added to fix <rdar://problem/5545799>, in which the
     14        first character in a Notes document could not be selected. However, I have not been able to reproduce this bug after
     15        removing this logic.
     16
     17        As a result of this change, we can also enable a WK1 test, editing/selection/click-outside-editable-div.html, that
     18        had also been marked as failing due to positionForPointRespectingEditingBoundaries recursing into a contentEditable
     19        div.
     20
     21        Test: fast/events/ios/clicking-document-should-not-trigger-focus.html
     22
     23        * rendering/RenderBlock.cpp:
     24        (WebCore::positionForPointRespectingEditingBoundaries): Deleted.
     25
    1262015-11-03  Myles C. Maxfield  <mmaxfield@apple.com>
    227
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r191915 r191954  
    25572557    if (isEditingBoundary(ancestor, child))
    25582558        return child.positionForPoint(pointInChildCoordinates, nullptr);
    2559    
    2560 #if PLATFORM(IOS)
    2561     // On iOS we want to constrain VisiblePositions to the editable region closest to the input position, so
    2562     // we will allow descent from non-editable to editable content.
    2563     // FIXME: This constraining must be done at a higher level once we implement contentEditable. For now, if something
    2564     // is editable, the whole document will be.
    2565     if (childElement->isContentEditable() && !ancestor->element()->isContentEditable())
    2566         return child.positionForPoint(pointInChildCoordinates, nullptr);
    2567 #endif
    25682559
    25692560    // Otherwise return before or after the child, depending on if the click was to the logical left or logical right of the child
Note: See TracChangeset for help on using the changeset viewer.