[IntersectionObserver] Schedule intersection observation updates
authorajuma@chromium.org <ajuma@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2018 15:45:32 +0000 (15:45 +0000)
committerajuma@chromium.org <ajuma@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2018 15:45:32 +0000 (15:45 +0000)
commit20e0359322a716d24df89ec3cb8320ab3fac74c5
tree88faeeb6ab3f2a7c0bdbaa6a0a030baf91e598d0
parentb74577083d962a36d6b657f1961efeef692278df
[IntersectionObserver] Schedule intersection observation updates
https://bugs.webkit.org/show_bug.cgi?id=189007

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Rebaseline tests that now pass.

* web-platform-tests/intersection-observer/bounding-box-expected.txt:
* web-platform-tests/intersection-observer/containing-block-expected.txt:
* web-platform-tests/intersection-observer/remove-element-expected.txt:
* web-platform-tests/intersection-observer/same-document-root-expected.txt:
* web-platform-tests/intersection-observer/unclipped-root-expected.txt:

Source/WebCore:

Schedule intersection observation updates in the following situations:
1) A new observation target is added.
2) FrameView::viewportContentsChanged -- this covers changes to layout and
   to scroll positions for same-document observation. Scheduling for
   cross-document observation will be handled in a future patch.
3) Style is resolved without triggering layout -- this handles updates that
   were deferred because of a pending style recalculation.

Tested by existing tests in imported/w3c/web-platform-tests/intersection-observer.

* dom/Document.cpp:
(WebCore::Document::resolveStyle):
(WebCore::Document::updateIntersectionObservations):
(WebCore::Document::scheduleIntersectionObservationUpdate):
* dom/Document.h:
* page/FrameView.cpp:
(WebCore::FrameView::viewportContentsChanged):
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::observe):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/bounding-box-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/containing-block-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/remove-element-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-root-expected.txt
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/unclipped-root-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/IntersectionObserver.cpp