[IntersectionObserver] Fire an initial dummy notification
authorajuma@chromium.org <ajuma@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Aug 2018 23:45:07 +0000 (23:45 +0000)
committerajuma@chromium.org <ajuma@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Aug 2018 23:45:07 +0000 (23:45 +0000)
commit0e5edc06b55b43c379d3694d2adbc41addd99a13
tree30ee570e51ee11d0bcdc4277a3e75f8b62b86581
parentcfaf0e880e3d3d17d79dc0954194c676b47b13e7
[IntersectionObserver] Fire an initial dummy notification
https://bugs.webkit.org/show_bug.cgi?id=188670

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Rebaseline tests now that an initial notification is fired.

* web-platform-tests/intersection-observer/bounding-box-expected.txt:
* web-platform-tests/intersection-observer/client-rect-expected.txt:
* web-platform-tests/intersection-observer/containing-block-expected.txt:
* web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt:
* web-platform-tests/intersection-observer/disconnect-expected.txt:
* web-platform-tests/intersection-observer/display-none-expected.txt:
* web-platform-tests/intersection-observer/edge-inclusive-intersection-expected.txt:
* web-platform-tests/intersection-observer/iframe-no-root-expected.txt:
* web-platform-tests/intersection-observer/inline-client-rect-expected.txt:
* web-platform-tests/intersection-observer/isIntersecting-change-events-expected.txt:
* web-platform-tests/intersection-observer/multiple-targets-expected.txt:
* web-platform-tests/intersection-observer/multiple-thresholds-expected.txt:
* web-platform-tests/intersection-observer/observer-without-js-reference-expected.txt:
* web-platform-tests/intersection-observer/remove-element-expected.txt:
* web-platform-tests/intersection-observer/root-margin-expected.txt:
* web-platform-tests/intersection-observer/same-document-no-root-expected.txt:
* web-platform-tests/intersection-observer/same-document-root-expected.txt:
* web-platform-tests/intersection-observer/same-document-zero-size-target-expected.txt:
* web-platform-tests/intersection-observer/shadow-content-expected.txt:
* web-platform-tests/intersection-observer/text-target-expected.txt:
* web-platform-tests/intersection-observer/timestamp-expected.txt:
* web-platform-tests/intersection-observer/unclipped-root-expected.txt:
* web-platform-tests/intersection-observer/zero-area-element-hidden-expected.txt:
* web-platform-tests/intersection-observer/zero-area-element-visible-expected.txt:

Source/WebCore:

Add logic to track ongoing intersection observations. Create an IntersectionObserverRegistration
and fire a single dummy notification for each one.

Test: intersection-observer/root-element-moved.html
Also tested by existing tests in imported/w3c/web-platform-tests/intersection-observer.

* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::addIntersectionObserver):
(WebCore::Document::removeIntersectionObserver):
(WebCore::Document::updateIntersectionObservations):
(WebCore::Document::notifyIntersectionObserversTimerFired):
* dom/Document.h:
(WebCore::Document::numberOfIntersectionObservers const):
* dom/Element.cpp:
(WebCore::Element::didMoveToNewDocument):
(WebCore::Element::disconnectFromIntersectionObservers):
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::create):
(WebCore::IntersectionObserver::IntersectionObserver):
(WebCore::IntersectionObserver::~IntersectionObserver):
(WebCore::IntersectionObserver::observe):
(WebCore::IntersectionObserver::unobserve):
(WebCore::IntersectionObserver::disconnect):
(WebCore::IntersectionObserver::takeRecords):
(WebCore::IntersectionObserver::targetDestroyed):
(WebCore::IntersectionObserver::removeTargetRegistration):
(WebCore::IntersectionObserver::removeAllTargets):
(WebCore::IntersectionObserver::rootDestroyed):
(WebCore::IntersectionObserver::appendQueuedEntry):
(WebCore::IntersectionObserver::notify):
* page/IntersectionObserver.h:
(WebCore::IntersectionObserver::trackingDocument):
(WebCore::IntersectionObserver:: const):
(WebCore::IntersectionObserver::hasObservationTargets const):
* page/IntersectionObserver.idl:
* testing/Internals.cpp:
(WebCore::Internals::numberOfIntersectionObservers const):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* intersection-observer/root-element-deleted.html: Add additional assertions.
* intersection-observer/root-element-moved-expected.txt: Added.
* intersection-observer/root-element-moved.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235014 268f45cc-cd09-0410-ab3c-d52691b4dbfc
39 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/bounding-box-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/client-rect-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/containing-block-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/disconnect-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/display-none-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/edge-inclusive-intersection-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/inline-client-rect-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/isIntersecting-change-events-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-targets-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-thresholds-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/observer-without-js-reference-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/remove-element-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/root-margin-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-no-root-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-root-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-zero-size-target-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/shadow-content-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/text-target-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/timestamp-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/unclipped-root-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-hidden-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-visible-expected.txt
LayoutTests/intersection-observer/root-element-deleted.html
LayoutTests/intersection-observer/root-element-moved-expected.txt [new file with mode: 0644]
LayoutTests/intersection-observer/root-element-moved.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/page/IntersectionObserver.cpp
Source/WebCore/page/IntersectionObserver.h
Source/WebCore/page/IntersectionObserver.idl
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl