Implement document.elementsFromPoint
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jul 2017 20:51:26 +0000 (20:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jul 2017 20:51:26 +0000 (20:51 +0000)
commit4f914b2aa54d6d1fd625e86bd56181bd955e5bae
tree8ced3cd6497a693355bca497a1f5ad76b124bd63
parent74ae0862768c76b089a1a3c077849693a91f8d70
Implement document.elementsFromPoint
https://bugs.webkit.org/show_bug.cgi?id=153137

Patch by Ali Juma <ajuma@chromium.org> on 2017-07-26
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Add tests from upstream pull request https://github.com/w3c/web-platform-tests/pull/6568.

* web-platform-tests/cssom-view/elementsFromPoint-expected.txt: Added.
* web-platform-tests/cssom-view/elementsFromPoint-iframes-expected.txt: Added.
* web-platform-tests/cssom-view/elementsFromPoint-iframes.html: Added.
* web-platform-tests/cssom-view/elementsFromPoint-invalid-cases-expected.txt: Added.
* web-platform-tests/cssom-view/elementsFromPoint-invalid-cases.html: Added.
* web-platform-tests/cssom-view/elementsFromPoint-shadowroot-expected.txt: Added.
* web-platform-tests/cssom-view/elementsFromPoint-shadowroot.html: Added.
* web-platform-tests/cssom-view/elementsFromPoint-simple-expected.txt: Added.
* web-platform-tests/cssom-view/elementsFromPoint-simple.html: Added.
* web-platform-tests/cssom-view/elementsFromPoint-svg-expected.txt: Added.
* web-platform-tests/cssom-view/elementsFromPoint-svg.html: Added.
* web-platform-tests/cssom-view/elementsFromPoint-table-expected.txt: Added.
* web-platform-tests/cssom-view/elementsFromPoint-table.html: Added.
* web-platform-tests/cssom-view/negativeMargins-expected.txt:
* web-platform-tests/cssom-view/resources/elementsFromPoint.js: Added.
(nodeToString.prototype.else):
(nodeListToString):
(assertElementsFromPoint):
(checkElementsFromPointFourCorners):
* web-platform-tests/cssom-view/resources/iframe1.html: Added.
* web-platform-tests/cssom-view/resources/iframe2.html: Added.

Source/WebCore:

This ports Blink's implementation of elementsFromPoint, from the
following patches by Philip Rogers (pdr@chromium.org):
-https://src.chromium.org/viewvc/blink?revision=190686&view=revision
-https://src.chromium.org/viewvc/blink?revision=191240&view=revision
-https://src.chromium.org/viewvc/blink?revision=199214&view=revision

Tests: imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-iframes.html
       imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-invalid-cases.html
       imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-shadowroot.html
       imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-simple.html
       imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-svg.html
       imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-table.html

* dom/DocumentOrShadowRoot.idl:
* dom/TreeScope.cpp:
(WebCore::absolutePointIfNotClipped):
(WebCore::TreeScope::nodeFromPoint):
(WebCore::TreeScope::elementFromPoint):
(WebCore::TreeScope::elementsFromPoint):
* dom/TreeScope.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::hitTestResultAtPoint):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::nodeAtPoint):
* rendering/HitTestRequest.h:
(WebCore::HitTestRequest::HitTestRequest):
(WebCore::HitTestRequest::resultIsElementList):
(WebCore::HitTestRequest::includesAllElementsUnderPoint):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::HitTestResult):
(WebCore::HitTestResult::operator=):
(WebCore::HitTestResult::addNodeToListBasedTestResult):
(WebCore::HitTestResult::append):
(WebCore::HitTestResult::listBasedTestResult):
(WebCore::HitTestResult::mutableListBasedTestResult):
(WebCore::HitTestResult::addNodeToRectBasedTestResult): Deleted.
(WebCore::HitTestResult::rectBasedTestResult): Deleted.
(WebCore::HitTestResult::mutableRectBasedTestResult): Deleted.
* rendering/HitTestResult.h:
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::nodeAtPoint):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::nodeAtPoint):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::nodeAtPoint):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::nodeAtPoint):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::nodeAtPoint):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::hitTestCulledInline):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::hitTestContents):
(WebCore::RenderLayer::hitTestList):
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::nodeAtPoint):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::nodeAtPoint):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::nodeAtPoint):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::hitTestFlow):
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::nodeAtFloatPoint):
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::nodeAtFloatPoint):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::nodeAtPoint):
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::nodeAtFloatPoint):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::nodeAtPoint):
* testing/Internals.cpp:
(WebCore::Internals::nodesFromRect):

LayoutTests:

* TestExpectations: Unskip a test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219961 268f45cc-cd09-0410-ab3c-d52691b4dbfc
46 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-iframes-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-iframes.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-invalid-cases-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-invalid-cases.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-shadowroot-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-shadowroot.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-simple-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-simple.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-svg-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-svg.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-table-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/elementsFromPoint-table.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/negativeMargins-expected.txt
LayoutTests/imported/w3c/web-platform-tests/cssom-view/resources/elementsFromPoint.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/resources/iframe1.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/cssom-view/resources/iframe2.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/DocumentOrShadowRoot.idl
Source/WebCore/dom/TreeScope.cpp
Source/WebCore/dom/TreeScope.h
Source/WebCore/page/EventHandler.cpp
Source/WebCore/rendering/EllipsisBox.cpp
Source/WebCore/rendering/HitTestRequest.h
Source/WebCore/rendering/HitTestResult.cpp
Source/WebCore/rendering/HitTestResult.h
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
Source/WebCore/rendering/svg/RenderSVGContainer.cpp
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Source/WebCore/testing/Internals.cpp