Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp

Issue 2149033003: IntersectionObserver: send notifications when objects disappear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/display-none-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
index 0667ca6c8cac1e265b30e29ec07aba64b6fe725c..36e55dad88cd4bc77683577d897866424fda3990 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
@@ -143,7 +143,8 @@ bool IntersectionObservation::computeGeometry(IntersectionGeometry& geometry) co
// effectively means "if the previous observed state was that root and target were
// intersecting, then generate a notification indicating that they are no longer
// intersecting." This happens, for example, when root or target is removed from the
- // DOM tree and not reinserted before the next frame is generated.
+ // DOM tree and not reinserted before the next frame is generated, or display:none
+ // is set on the root or target.
Element* targetElement = target();
if (!targetElement)
return false;
@@ -156,13 +157,13 @@ bool IntersectionObservation::computeGeometry(IntersectionGeometry& geometry) co
LayoutObject* rootLayoutObject = m_observer->rootLayoutObject();
if (!rootLayoutObject || !rootLayoutObject->isBoxModelObject())
- return false;
+ return true;
// TODO(szager): Support SVG
LayoutObject* targetLayoutObject = targetElement->layoutObject();
if (!targetLayoutObject)
- return false;
+ return true;
if (!targetLayoutObject->isBoxModelObject() && !targetLayoutObject->isText())
- return false;
+ return true;
if (!isContainingBlockChainDescendant(targetLayoutObject, rootLayoutObject))
return true;
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/display-none-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698