WebKit Bugzilla
Attachment 346851 Details for
Bug 188445
: Update IDL for IntersectionObserverEntry and IntersectionObserverEntryInit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-188445-20180809142628.patch (text/plain), 8.31 KB, created by
Ali Juma
on 2018-08-09 11:26:29 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Ali Juma
Created:
2018-08-09 11:26:29 PDT
Size:
8.31 KB
patch
obsolete
>Subversion Revision: 234724 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2b746477d97a49a3c977bce6f005354a6706ba0e..0ef337b84376a224203bf99faa7e21dedcbadcde 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-08-09 Ali Juma <ajuma@chromium.org> >+ >+ Update IDL for IntersectionObserverEntry and IntersectionObserverEntryInit >+ https://bugs.webkit.org/show_bug.cgi?id=188445 >+ >+ Reviewed by Simon Fraser. >+ >+ Update IntersectionObserverEntry by making rootBounds nullable, and adding an >+ isIntersecting attribute. Make the same changes to IntersectionObserverEntryInit, >+ and also add an intersectionRatio attribute. >+ >+ Tested by intersection-observer/intersection-observer-entry-interface.html >+ >+ * page/IntersectionObserverEntry.cpp: >+ (WebCore::IntersectionObserverEntry::IntersectionObserverEntry): >+ * page/IntersectionObserverEntry.h: >+ (WebCore::IntersectionObserverEntry::isIntersecting const): >+ * page/IntersectionObserverEntry.idl: >+ > 2018-08-09 Charlie Turner <cturner@igalia.com> > > Fix copyright headers on new ISO parsing class >diff --git a/Source/WebCore/page/IntersectionObserverEntry.cpp b/Source/WebCore/page/IntersectionObserverEntry.cpp >index e3f9c3c9fc40908b6371bcaa909f0c759159c52e..a2244fe0dce7ebf078517a4da82f691b5e9a2afa 100644 >--- a/Source/WebCore/page/IntersectionObserverEntry.cpp >+++ b/Source/WebCore/page/IntersectionObserverEntry.cpp >@@ -34,14 +34,16 @@ namespace WebCore { > > IntersectionObserverEntry::IntersectionObserverEntry(const Init& init) > : m_time(init.time) >- , m_rootBounds(DOMRectReadOnly::fromRect(init.rootBounds)) > , m_boundingClientRect(DOMRectReadOnly::fromRect(init.boundingClientRect)) > , m_intersectionRect(DOMRectReadOnly::fromRect(init.intersectionRect)) >+ , m_intersectionRatio(init.intersectionRatio) > , m_target(init.target) >+ , m_isIntersecting(init.isIntersecting) > { >+ if (init.rootBounds) >+ m_rootBounds = DOMRectReadOnly::fromRect(*init.rootBounds); > } > >- > } // namespace WebCore > > #endif // ENABLE(INTERSECTION_OBSERVER) >diff --git a/Source/WebCore/page/IntersectionObserverEntry.h b/Source/WebCore/page/IntersectionObserverEntry.h >index 638d4b814dd4ddcb21dbca7b5b9abac4488bafd2..7c4c0b6ef40b4a22d22b9381610de376d1c56fc9 100644 >--- a/Source/WebCore/page/IntersectionObserverEntry.h >+++ b/Source/WebCore/page/IntersectionObserverEntry.h >@@ -43,10 +43,12 @@ public: > > struct Init { > double time; >- DOMRectInit rootBounds; >+ std::optional<DOMRectInit> rootBounds; > DOMRectInit boundingClientRect; > DOMRectInit intersectionRect; >+ double intersectionRatio; > RefPtr<Element> target; >+ bool isIntersecting; > }; > > static Ref<IntersectionObserverEntry> create(const Init& init) >@@ -60,6 +62,7 @@ public: > RefPtr<DOMRectReadOnly> intersectionRect() const { return m_intersectionRect; } > RefPtr<Element> target() const { return m_target; } > >+ bool isIntersecting() const { return m_isIntersecting; } > double intersectionRatio() const { return m_intersectionRatio; } > > private: >@@ -71,6 +74,7 @@ private: > RefPtr<DOMRectReadOnly> m_intersectionRect; > double m_intersectionRatio { 0 }; > RefPtr<Element> m_target; >+ bool m_isIntersecting { false }; > }; > > >diff --git a/Source/WebCore/page/IntersectionObserverEntry.idl b/Source/WebCore/page/IntersectionObserverEntry.idl >index 1b4338b9830940c083f3473e7fc210fd74d7c14c..47612d0a79d096ca33be534fccd48da4bfd3b73a 100644 >--- a/Source/WebCore/page/IntersectionObserverEntry.idl >+++ b/Source/WebCore/page/IntersectionObserverEntry.idl >@@ -34,9 +34,10 @@ typedef double DOMHighResTimeStamp; > EnabledAtRuntime=IntersectionObserver > ] interface IntersectionObserverEntry { > readonly attribute DOMHighResTimeStamp time; >- readonly attribute DOMRectReadOnly rootBounds; >+ readonly attribute DOMRectReadOnly? rootBounds; > readonly attribute DOMRectReadOnly boundingClientRect; > readonly attribute DOMRectReadOnly intersectionRect; >+ readonly attribute boolean isIntersecting; > readonly attribute double intersectionRatio; > readonly attribute Element target; > }; >@@ -45,8 +46,10 @@ typedef double DOMHighResTimeStamp; > Conditional=INTERSECTION_OBSERVER, > ] dictionary IntersectionObserverEntryInit { > required DOMHighResTimeStamp time; >- required DOMRectInit rootBounds; >+ required DOMRectInit? rootBounds; > required DOMRectInit boundingClientRect; > required DOMRectInit intersectionRect; >+ required boolean isIntersecting; >+ required double intersectionRatio; > required Element target; > }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index fee10630bc889900d8de763db6807c4f9a743e90..a0a3a89b98d9340eacff0e37f91b5ead40757eba 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2018-08-09 Ali Juma <ajuma@chromium.org> >+ >+ Update IDL for IntersectionObserverEntry and IntersectionObserverEntryInit >+ https://bugs.webkit.org/show_bug.cgi?id=188445 >+ >+ Reviewed by Simon Fraser. >+ >+ * intersection-observer/intersection-observer-entry-interface-expected.txt: >+ * intersection-observer/intersection-observer-entry-interface.html: >+ > 2018-08-09 Miguel Gomez <magomez@igalia.com> > > Unreviewed GTK+ gardening after r234720. >diff --git a/LayoutTests/intersection-observer/intersection-observer-entry-interface-expected.txt b/LayoutTests/intersection-observer/intersection-observer-entry-interface-expected.txt >index 25d93e2416c0eaae9a32252d2ba40196ea6dc99b..89c2bf76858a73bf96b15fb6b5cc5ae84eda3389 100644 >--- a/LayoutTests/intersection-observer/intersection-observer-entry-interface-expected.txt >+++ b/LayoutTests/intersection-observer/intersection-observer-entry-interface-expected.txt >@@ -2,7 +2,10 @@ > PASS Constructor0 > PASS ConstructorTime > PASS ConstructorRootBounds >+PASS ConstructorNullRootBounds > PASS ConstructorBoundingClientRect > PASS ConstructorIntersectionRect >-PASS ConstructorTime >+PASS ConstructorIsIntersecting >+PASS ConstructorIntersectionRatio >+PASS ConstructorTarget > >diff --git a/LayoutTests/intersection-observer/intersection-observer-entry-interface.html b/LayoutTests/intersection-observer/intersection-observer-entry-interface.html >index ac815a575bdae4d626eedbdb2d1fb9a30e093823..2ddc65c0f65603a690192c40eb0b689b1498376c 100644 >--- a/LayoutTests/intersection-observer/intersection-observer-entry-interface.html >+++ b/LayoutTests/intersection-observer/intersection-observer-entry-interface.html >@@ -15,6 +15,8 @@ > rootBounds: { x: 10, y: 12.5, width: 130, height: 140 }, > boundingClientRect: { x: 110, y: 112.7, width: 1130, height: 1140 }, > intersectionRect: { x: 210, y: 212, width: 2130, height: 2140 }, >+ isIntersecting: true, >+ intersectionRatio: 0.35, > target: document.body > }; > >@@ -30,6 +32,11 @@ > assert_equals(JSON.stringify(entry.rootBounds), '{"x":10,"y":12.5,"width":130,"height":140,"top":12.5,"right":140,"bottom":152.5,"left":10}'); > assert_class_string(entry.rootBounds, 'DOMRectReadOnly'); > },'ConstructorRootBounds'); >+ test(function() { >+ entryInit.rootBounds = null; >+ var entry = new IntersectionObserverEntry(entryInit); >+ assert_equals(entry.rootBounds, null); >+ },'ConstructorNullRootBounds'); > test(function() { > var entry = new IntersectionObserverEntry(entryInit); > assert_class_string(entry.boundingClientRect, 'DOMRectReadOnly'); >@@ -40,10 +47,18 @@ > assert_class_string(entry.intersectionRect, 'DOMRectReadOnly'); > assert_equals(JSON.stringify(entry.intersectionRect), '{"x":210,"y":212,"width":2130,"height":2140,"top":212,"right":2340,"bottom":2352,"left":210}'); > },'ConstructorIntersectionRect'); >+ test(function() { >+ var entry = new IntersectionObserverEntry(entryInit); >+ assert_true(entry.isIntersecting); >+ },'ConstructorIsIntersecting'); >+ test(function() { >+ var entry = new IntersectionObserverEntry(entryInit); >+ assert_equals(entry.intersectionRatio, 0.35); >+ },'ConstructorIntersectionRatio'); > test(function() { > var entry = new IntersectionObserverEntry(entryInit); > assert_equals(entry.target, document.body); >- },'ConstructorTime'); >+ },'ConstructorTarget'); > > </script> > </body>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188445
:
346847
| 346851