[IntersectionObserver] Regression: No initial observation when nothing else triggers rendering
https://bugs.webkit.org/show_bug.cgi?id=197891
Reviewed by Simon Fraser.
Source/WebCore:
Schedule a rendering update whenever a new IntersectionObserver target is added.
Test: intersection-observer/initial-observation.html
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::observe):
LayoutTests:
Add a test where other timers that can schedule rendering updates are disabled,
in order to verify that IntersectionObserver is scheduling rendering updates
itself.
* intersection-observer/initial-observation.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ab3bd9d..a8108e7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2019-05-16 Ali Juma <ajuma@chromium.org>
+
+ [IntersectionObserver] Regression: No initial observation when nothing else triggers rendering
+ https://bugs.webkit.org/show_bug.cgi?id=197891
+
+ Reviewed by Simon Fraser.
+
+ Add a test where other timers that can schedule rendering updates are disabled,
+ in order to verify that IntersectionObserver is scheduling rendering updates
+ itself.
+
+ * intersection-observer/initial-observation.html: Added.
+
2019-05-15 Devin Rousso <drousso@apple.com>
Web Inspector: user gesture toggle should also force user interaction flag
diff --git a/LayoutTests/intersection-observer/initial-observation-expected.txt b/LayoutTests/intersection-observer/initial-observation-expected.txt
new file mode 100644
index 0000000..b6bd13f
--- /dev/null
+++ b/LayoutTests/intersection-observer/initial-observation-expected.txt
@@ -0,0 +1,3 @@
+
+PASS An initial observation is fired even when nothing else triggers rendering
+
diff --git a/LayoutTests/intersection-observer/initial-observation.html b/LayoutTests/intersection-observer/initial-observation.html
new file mode 100644
index 0000000..6292047
--- /dev/null
+++ b/LayoutTests/intersection-observer/initial-observation.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+
+<script>
+if (window.internals) {
+ // Disable timers that trigger delayed flushes, since these will make
+ // this test pass spuriously, even if IntersectionObserver never
+ // schedules any rendering updates.
+ internals.setSpeculativeTilingDelayDisabledForTesting(true);
+ internals.disableTileSizeUpdateDelay();
+}
+
+window.onload = function() {
+async_test((t) => {
+ var observer = new IntersectionObserver(t.step_func_done(() => {
+ observer.disconnect();
+ }));
+ requestAnimationFrame(() => {
+ requestAnimationFrame(() => {
+ setTimeout(() => {
+ observer.observe(document.getElementById("target"));
+ }, 0);
+ });
+ });
+}, "An initial observation is fired even when nothing else triggers rendering");
+};
+</script>
+
+<style>
+#target {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+</style>
+
+<div id="target"></div>
+
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 1757f4f..0bd242b 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2019-05-16 Ali Juma <ajuma@chromium.org>
+
+ [IntersectionObserver] Regression: No initial observation when nothing else triggers rendering
+ https://bugs.webkit.org/show_bug.cgi?id=197891
+
+ Reviewed by Simon Fraser.
+
+ Schedule a rendering update whenever a new IntersectionObserver target is added.
+
+ Test: intersection-observer/initial-observation.html
+
+ * page/IntersectionObserver.cpp:
+ (WebCore::IntersectionObserver::observe):
+
2019-05-16 Carlos Garcia Campos <cgarcia@igalia.com>
[FreeType] Some character sequences with a variation selector are not rendered
diff --git a/Source/WebCore/page/IntersectionObserver.cpp b/Source/WebCore/page/IntersectionObserver.cpp
index 1836278..669b86f 100644
--- a/Source/WebCore/page/IntersectionObserver.cpp
+++ b/Source/WebCore/page/IntersectionObserver.cpp
@@ -158,6 +158,7 @@
auto* document = trackingDocument();
if (!hadObservationTargets)
document->addIntersectionObserver(*this);
+ document->scheduleRenderingUpdate();
}
void IntersectionObserver::unobserve(Element& target)