Changeset 219551 in webkit


Ignore:
Timestamp:
Jul 16, 2017 7:10:42 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

DisallowUserAgentShadowContent moves out of non-UA shadow roots
https://bugs.webkit.org/show_bug.cgi?id=165647

Patch by Ali Juma <ajuma@chromium.org> on 2017-07-16
Reviewed by Ryosuke Niwa.

Source/WebCore:

Make rect-based hit-testing include nodes in non-UA shadow trees when the
HitTestRequest has type DisallowUserAgentShadowContent.

Test: fast/dom/nodesFromRect/nodesFromRect-shadow.html

  • rendering/HitTestResult.cpp:

(WebCore::HitTestResult::addNodeToRectBasedTestResult):

  • testing/Internals.cpp:

(WebCore::Internals::nodesFromRect):

  • testing/Internals.h:

LayoutTests:

  • fast/dom/nodesFromRect/nodesFromRect-shadow-expected.txt: Added.
  • fast/dom/nodesFromRect/nodesFromRect-shadow.html: Added.
  • fast/dom/nodesFromRect/resources/nodesFromRect.js:

(check):
(checkShadowContent):
(nodesFromRectAsString):

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r219549 r219551  
     12017-07-16  Ali Juma  <ajuma@chromium.org>
     2
     3        DisallowUserAgentShadowContent moves out of non-UA shadow roots
     4        https://bugs.webkit.org/show_bug.cgi?id=165647
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/dom/nodesFromRect/nodesFromRect-shadow-expected.txt: Added.
     9        * fast/dom/nodesFromRect/nodesFromRect-shadow.html: Added.
     10        * fast/dom/nodesFromRect/resources/nodesFromRect.js:
     11        (check):
     12        (checkShadowContent):
     13        (nodesFromRectAsString):
     14
    1152017-07-16  Antoine Quint  <graouts@apple.com>
    216
  • trunk/LayoutTests/fast/dom/nodesFromRect/resources/nodesFromRect.js

    r145364 r219551  
    4343    doc = document;
    4444
    45   var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, false /* allow shadow content */, false /* allow child-frame content */);
     45  var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, false /* allow user-agent shadow content */, false /* allow child-frame content */);
    4646  if (!nodes)
    4747    return;
     
    7979    doc = document;
    8080
    81   var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, true /* allowShadowContent */, false /* allow child-frame content */);
     81  var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, true /* allowUserAgentShadowContent */, false /* allow child-frame content */);
    8282  if (!nodes)
    8383    return;
     
    146146function nodesFromRectAsString(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding)
    147147{
    148     var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, false /* allow shadow content */, true /* allow child-frame content */);
     148    var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, false /* allow user-agent shadow content */, true /* allow child-frame content */);
    149149    if (!nodes)
    150150        return "";
  • trunk/Source/WebCore/ChangeLog

    r219549 r219551  
     12017-07-16  Ali Juma  <ajuma@chromium.org>
     2
     3        DisallowUserAgentShadowContent moves out of non-UA shadow roots
     4        https://bugs.webkit.org/show_bug.cgi?id=165647
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Make rect-based hit-testing include nodes in non-UA shadow trees when the
     9        HitTestRequest has type DisallowUserAgentShadowContent.
     10
     11        Test: fast/dom/nodesFromRect/nodesFromRect-shadow.html
     12
     13        * rendering/HitTestResult.cpp:
     14        (WebCore::HitTestResult::addNodeToRectBasedTestResult):
     15        * testing/Internals.cpp:
     16        (WebCore::Internals::nodesFromRect):
     17        * testing/Internals.h:
     18
    1192017-07-16  Antoine Quint  <graouts@apple.com>
    220
  • trunk/Source/WebCore/rendering/HitTestResult.cpp

    r219237 r219551  
    668668        return true;
    669669
    670     // FIXME: This moves out of a author shadow tree.
    671     if (request.disallowsUserAgentShadowContent())
     670    if (request.disallowsUserAgentShadowContent() && node->isInUserAgentShadowTree())
    672671        node = node->document().ancestorNodeInThisScope(node);
    673672
     
    689688        return true;
    690689
    691     // FIXME: This moves out of a author shadow tree.
    692     if (request.disallowsUserAgentShadowContent())
     690    if (request.disallowsUserAgentShadowContent() && node->isInUserAgentShadowTree())
    693691        node = node->document().ancestorNodeInThisScope(node);
    694692
  • trunk/Source/WebCore/testing/Internals.cpp

    r219419 r219551  
    18361836// different document, and could just make the call through another Internals
    18371837// instance instead.
    1838 ExceptionOr<RefPtr<NodeList>> Internals::nodesFromRect(Document& document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const
     1838ExceptionOr<RefPtr<NodeList>> Internals::nodesFromRect(Document& document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowUserAgentShadowContent, bool allowChildFrameContent) const
    18391839{
    18401840    if (!document.frame() || !document.frame()->view())
     
    18551855    if (ignoreClipping)
    18561856        hitType |= HitTestRequest::IgnoreClipping;
    1857     if (!allowShadowContent)
     1857    if (!allowUserAgentShadowContent)
    18581858        hitType |= HitTestRequest::DisallowUserAgentShadowContent;
    18591859    if (allowChildFrameContent)
  • trunk/Source/WebCore/testing/Internals.h

    r219419 r219551  
    250250    ExceptionOr<Ref<DOMRectList>> passiveTouchEventListenerRects();
    251251
    252     ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const;
     252    ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowUserAgentShadowContent, bool allowChildFrameContent) const;
    253253
    254254    String parserMetaData(JSC::JSValue = JSC::JSValue::JSUndefined);
Note: See TracChangeset for help on using the changeset viewer.