Title: [258648] trunk/Source/WebCore
Revision
258648
Author
[email protected]
Date
2020-03-18 10:55:12 -0700 (Wed, 18 Mar 2020)

Log Message

[intersection-observer] Accept a Document as an explicit root
https://bugs.webkit.org/show_bug.cgi?id=208047

Patch by Frederic Wang <[email protected]> on 2020-03-18
Reviewed by Rob Buis.

No new tests, no behavior change.

* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::create):
(WebCore::IntersectionObserver::IntersectionObserver):
* page/IntersectionObserver.h:
(WebCore::IntersectionObserver::root const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (258647 => 258648)


--- trunk/Source/WebCore/ChangeLog	2020-03-18 17:40:22 UTC (rev 258647)
+++ trunk/Source/WebCore/ChangeLog	2020-03-18 17:55:12 UTC (rev 258648)
@@ -1,3 +1,18 @@
+2020-03-18  Frederic Wang  <[email protected]>
+
+        [intersection-observer] Accept a Document as an explicit root
+        https://bugs.webkit.org/show_bug.cgi?id=208047
+
+        Reviewed by Rob Buis.
+
+        No new tests, no behavior change.
+
+        * page/IntersectionObserver.cpp:
+        (WebCore::IntersectionObserver::create):
+        (WebCore::IntersectionObserver::IntersectionObserver):
+        * page/IntersectionObserver.h:
+        (WebCore::IntersectionObserver::root const):
+
 2020-03-18  Joonghun Park  <[email protected]>
 
         Unreviewed. Remove the build warnings below since r256756

Modified: trunk/Source/WebCore/page/IntersectionObserver.cpp (258647 => 258648)


--- trunk/Source/WebCore/page/IntersectionObserver.cpp	2020-03-18 17:40:22 UTC (rev 258647)
+++ trunk/Source/WebCore/page/IntersectionObserver.cpp	2020-03-18 17:55:12 UTC (rev 258648)
@@ -86,7 +86,7 @@
 
 ExceptionOr<Ref<IntersectionObserver>> IntersectionObserver::create(Document& document, Ref<IntersectionObserverCallback>&& callback, IntersectionObserver::Init&& init)
 {
-    Node* root = nullptr;
+    ContainerNode* root = nullptr;
     if (init.root) {
         WTF::switchOn(*init.root, [&root] (RefPtr<Element> element) {
             root = element.get();
@@ -115,7 +115,7 @@
     return adoptRef(*new IntersectionObserver(document, WTFMove(callback), root, rootMarginOrException.releaseReturnValue(), WTFMove(thresholds)));
 }
 
-IntersectionObserver::IntersectionObserver(Document& document, Ref<IntersectionObserverCallback>&& callback, Node* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds)
+IntersectionObserver::IntersectionObserver(Document& document, Ref<IntersectionObserverCallback>&& callback, ContainerNode* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds)
     : ActiveDOMObject(callback->scriptExecutionContext())
     , m_root(root)
     , m_rootMargin(WTFMove(parsedRootMargin))

Modified: trunk/Source/WebCore/page/IntersectionObserver.h (258647 => 258648)


--- trunk/Source/WebCore/page/IntersectionObserver.h	2020-03-18 17:40:22 UTC (rev 258647)
+++ trunk/Source/WebCore/page/IntersectionObserver.h	2020-03-18 17:55:12 UTC (rev 258648)
@@ -41,7 +41,7 @@
 
 class Document;
 class Element;
-class Node;
+class ContainerNode;
 
 struct IntersectionObserverRegistration {
     WeakPtr<IntersectionObserver> observer;
@@ -74,7 +74,7 @@
 
     Document* trackingDocument() const { return m_root ? &m_root->document() : m_implicitRootDocument.get(); }
 
-    Node* root() const { return m_root; }
+    ContainerNode* root() const { return m_root; }
     String rootMargin() const;
     const LengthBox& rootMarginBox() const { return m_rootMargin; }
     const Vector<double>& thresholds() const { return m_thresholds; }
@@ -105,13 +105,13 @@
     void stop() override;
 
 private:
-    IntersectionObserver(Document&, Ref<IntersectionObserverCallback>&&, Node* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds);
+    IntersectionObserver(Document&, Ref<IntersectionObserverCallback>&&, ContainerNode* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds);
 
     bool removeTargetRegistration(Element&);
     void removeAllTargets();
 
     WeakPtr<Document> m_implicitRootDocument;
-    Node* m_root;
+    ContainerNode* m_root;
     LengthBox m_rootMargin;
     Vector<double> m_thresholds;
     RefPtr<IntersectionObserverCallback> m_callback;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to