Changeset 209780 in webkit


Ignore:
Timestamp:
Dec 13, 2016 3:22:03 PM (7 years ago)
Author:
rniwa@webkit.org
Message:

:hover rule causes a single tap to not activate a slotted anchor element
https://bugs.webkit.org/show_bug.cgi?id=165551

Reviewed by Antti Koivisto.

Source/WebCore:

Fixed a bug in ancestorRespondingToClickEvents that we were traversing the ancestor nodes without taking
shadow roots and slots into account. This prevented tapping on a text node assigned to a slot inside
an anchor element to activate the hyperlink on iOS.

This bug was supposed to be fixed in r206605, and it was still broken on iOS due to the bug in
ancestorRespondingToClickEvents. It is now tested by click-text-inside-linked-slot.html.

Tests: fast/shadow-dom/click-on-slotted-anchor-with-hover.html

fast/shadow-dom/click-text-inside-linked-slot.html

  • page/ios/FrameIOS.mm:

(WebCore::ancestorRespondingToClickEvents):
(WebCore::Frame::qualifyingNodeAtViewportLocation):

LayoutTests:

Added a test for tapping on an anchor element assigned to a slot, which has been fixed in r209065.

Also added a new helper JS wrapepr, UIHelper, defined inside LayoutTests/resources/js-helper.js
to provide an abstraction around EventSender and UIScriptController.

Fixed click-text-inside-linked-slot.html on iOS using UIHelper.

  • fast/shadow-dom/click-on-slotted-anchor-with-hover-expected.txt: Added.
  • fast/shadow-dom/click-on-slotted-anchor-with-hover.html: Added.
  • fast/shadow-dom/click-text-inside-linked-slot.html:
  • platform/ios-simulator/fast/shadow-dom/click-text-inside-linked-slot-expected.txt: Added.
  • resources/ui-helper.js: Added.

(window.UIHelper.isIOS):
(window.UIHelper.activateAt.return.new.Promise):
(window.UIHelper.activateAt):
(window.UIHelper.wait):
(window.UIHelper):

  • platform/ios-simulator-wk2/TestExpectations: Skip the test in the open source iOS's WebKit2.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r209777 r209780  
     12016-12-13  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        :hover rule causes a single tap to not activate a slotted anchor element
     4        https://bugs.webkit.org/show_bug.cgi?id=165551
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Added a test for tapping on an anchor element assigned to a slot, which has been fixed in r209065.
     9
     10        Also added a new helper JS wrapepr, UIHelper, defined inside LayoutTests/resources/js-helper.js
     11        to provide an abstraction around EventSender and UIScriptController.
     12
     13        Fixed click-text-inside-linked-slot.html on iOS using UIHelper.
     14
     15        * fast/shadow-dom/click-on-slotted-anchor-with-hover-expected.txt: Added.
     16        * fast/shadow-dom/click-on-slotted-anchor-with-hover.html: Added.
     17        * fast/shadow-dom/click-text-inside-linked-slot.html:
     18        * platform/ios-simulator/fast/shadow-dom/click-text-inside-linked-slot-expected.txt: Added.
     19        * resources/ui-helper.js: Added.
     20        (window.UIHelper.isIOS):
     21        (window.UIHelper.activateAt.return.new.Promise):
     22        (window.UIHelper.activateAt):
     23        (window.UIHelper.wait):
     24        (window.UIHelper):
     25        * platform/ios-simulator-wk2/TestExpectations: Skip the test in the open source iOS's WebKit2.
     26
    1272016-12-13  Dave Hyatt  <hyatt@apple.com>
    228
  • trunk/LayoutTests/fast/shadow-dom/click-text-inside-linked-slot.html

    r206605 r209780  
    44<p>This tests clicking on a Text node assigned to a slot inside an anchor element. The link should be activated.<br>
    55To manually test, click "here" below and you should see "PASS" and the mouse cursor should indicate it's a hyperlink, not text:</p>
     6<script src="../../resources/ui-helper.js"></script>
    67<script>
    78
     
    2526    document.getElementById('activation').textContent = 'FAIL';
    2627    document.write('<div>Cursor: <span id="cursor">FAIL<span></div>');
    27     eventSender.mouseMoveTo(shadowHost.offsetLeft + 5, shadowHost.offsetTop + 5);
    28     eventSender.mouseDown();
    29     eventSender.mouseUp();
     28    UIHelper.wait(UIHelper.activateAt(shadowHost.offsetLeft + 5, shadowHost.offsetTop + 5));
    3029}
    3130
  • trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations

    r209770 r209780  
    17781778imported/blink/editing/selection/selectstart-event-crash.html [ Skip ]
    17791779fast/dom/Window/post-message-user-action.html [ Skip ]
     1780fast/shadow-dom/click-on-slotted-anchor-with-hover.html [ Skip ]
    17801781fast/shadow-dom/click-text-inside-linked-slot.html [ Skip ]
    17811782fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html
  • trunk/Source/WebCore/ChangeLog

    r209777 r209780  
     12016-12-13  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        :hover rule causes a single tap to not activate a slotted anchor element
     4        https://bugs.webkit.org/show_bug.cgi?id=165551
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Fixed a bug in ancestorRespondingToClickEvents that we were traversing the ancestor nodes without taking
     9        shadow roots and slots into account. This prevented tapping on a text node assigned to a slot inside
     10        an anchor element to activate the hyperlink on iOS.
     11
     12        This bug was supposed to be fixed in r206605, and it was still broken on iOS due to the bug in
     13        ancestorRespondingToClickEvents. It is now tested by click-text-inside-linked-slot.html.
     14
     15        Tests: fast/shadow-dom/click-on-slotted-anchor-with-hover.html
     16               fast/shadow-dom/click-text-inside-linked-slot.html
     17
     18        * page/ios/FrameIOS.mm:
     19        (WebCore::ancestorRespondingToClickEvents):
     20        (WebCore::Frame::qualifyingNodeAtViewportLocation):
     21
    1222016-12-13  Dave Hyatt  <hyatt@apple.com>
    223
  • trunk/Source/WebCore/page/ios/FrameIOS.mm

    r209683 r209780  
    6060#import "RenderView.h"
    6161#import "RenderedDocumentMarker.h"
     62#import "ShadowRoot.h"
    6263#import "TextBoundaries.h"
    6364#import "TextIterator.h"
     
    259260
    260261    Node* pointerCursorNode = nullptr;
    261     for (Node* node = hitTestResult.innerNode(); node && node != terminationNode; node = node->parentNode()) {
    262         ASSERT(!node->isInShadowTree());
     262    for (Node* node = hitTestResult.innerNode(); node && node != terminationNode; node = node->parentInComposedTree()) {
     263        ASSERT(!node->isInShadowTree() || node->containingShadowRoot()->mode() != ShadowRootMode::UserAgent);
    263264
    264265        // We only accept pointer nodes before reaching the body tag.
     
    406407
    407408        while (candidate && !candidate->isElementNode())
    408             candidate = candidate->parentNode();
     409            candidate = candidate->parentInComposedTree();
    409410
    410411        if (candidate)
Note: See TracChangeset for help on using the changeset viewer.