WebKit Bugzilla
Attachment 347289 Details for
Bug 188670
: [IntersectionObserver] Fire an initial dummy notification
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188670-20180816153540.patch (text/plain), 54.69 KB, created by
Ali Juma
on 2018-08-16 12:35:41 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ali Juma
Created:
2018-08-16 12:35:41 PDT
Size:
54.69 KB
patch
obsolete
>Subversion Revision: 234899 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 27f4473e083b0914a9b8f32d142349f981f3daf1..bb32b51f17831b12e7355798edb6274354cfd474 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,51 @@ >+2018-08-16 Ali Juma <ajuma@chromium.org> >+ >+ [IntersectionObserver] Fire an initial dummy notification >+ https://bugs.webkit.org/show_bug.cgi?id=188670 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add logic to track ongoing intersection observations. Create an IntersectionObserverRegistration >+ and fire a single dummy notification for each one. >+ >+ Test: intersection-observer/root-element-moved.html >+ Also tested by existing tests in imported/w3c/web-platform-tests/intersection-observer. >+ >+ * dom/Document.cpp: >+ (WebCore::Document::~Document): >+ (WebCore::Document::activateIntersectionObserver): >+ (WebCore::Document::deactivateIntersectionObserver): >+ (WebCore::Document::addViewportIntersectionObserver): >+ (WebCore::Document::removeViewportIntersectionObserver): >+ (WebCore::Document::updateIntersectionObservations): >+ (WebCore::Document::notifyIntersectionObserversTimerFired): >+ * dom/Document.h: >+ (WebCore::Document::numberOfActiveIntersectionObservers const): >+ * dom/Element.cpp: >+ (WebCore::Element::didMoveToNewDocument): >+ (WebCore::Element::disconnectFromIntersectionObservers): >+ * page/IntersectionObserver.cpp: >+ (WebCore::IntersectionObserver::create): >+ (WebCore::IntersectionObserver::IntersectionObserver): >+ (WebCore::IntersectionObserver::~IntersectionObserver): >+ (WebCore::IntersectionObserver::observe): >+ (WebCore::IntersectionObserver::unobserve): >+ (WebCore::IntersectionObserver::disconnect): >+ (WebCore::IntersectionObserver::takeRecords): >+ (WebCore::IntersectionObserver::removeObservationTarget): >+ (WebCore::IntersectionObserver::implicitRootDocumentDestroyed): >+ (WebCore::IntersectionObserver::appendQueuedEntry): >+ (WebCore::IntersectionObserver::notify): >+ * page/IntersectionObserver.h: >+ (WebCore::IntersectionObserver::trackingDocument): >+ (WebCore::IntersectionObserver:: const): >+ (WebCore::IntersectionObserver::hasObservationTargets const): >+ * page/IntersectionObserver.idl: >+ * testing/Internals.cpp: >+ (WebCore::Internals::numberOfActiveIntersectionObservers const): >+ * testing/Internals.h: >+ * testing/Internals.idl: >+ > 2018-08-15 Aditya Keerthi <akeerthi@apple.com> > > [Datalist] Add button to TextFieldInputs with a datalist >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index df39f4da574add66115d20da7ca54f534aed69ce..9615be8bcd36ed49e421592a98af1fbb0abc742e 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -109,6 +109,7 @@ > #include "ImageBitmapRenderingContext.h" > #include "ImageLoader.h" > #include "InspectorInstrumentation.h" >+#include "IntersectionObserver.h" > #include "JSCustomElementInterface.h" > #include "JSDOMPromiseDeferred.h" > #include "JSLazyEventListener.h" >@@ -503,6 +504,9 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig > , m_constantPropertyMap(std::make_unique<ConstantPropertyMap>(*this)) > , m_documentClasses(documentClasses) > , m_eventQueue(*this) >+#if ENABLE(INTERSECTION_OBSERVER) >+ , m_intersectionObserversNotifyTimer(*this, &Document::notifyIntersectionObserversTimerFired) >+#endif > , m_loadEventDelayTimer(*this, &Document::loadEventDelayTimerFired) > #if PLATFORM(IOS) > #if ENABLE(DEVICE_ORIENTATION) >@@ -639,7 +643,13 @@ Document::~Document() > if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists()) > platformMediaSessionManager->stopAllMediaPlaybackForDocument(this); > #endif >- >+ >+#if ENABLE(INTERSECTION_OBSERVER) >+ for (auto* observer : m_viewportIntersectionObservers) >+ observer->implicitRootDocumentDestroyed(); >+ m_viewportIntersectionObservers.clear(); >+#endif >+ > // We must call clearRareData() here since a Document class inherits TreeScope > // as well as Node. See a comment on TreeScope.h for the reason. > if (hasRareData()) >@@ -7413,6 +7423,74 @@ void Document::removeViewportDependentPicture(HTMLPictureElement& picture) > m_viewportDependentPictures.remove(&picture); > } > >+#if ENABLE(INTERSECTION_OBSERVER) >+void Document::activateIntersectionObserver(IntersectionObserver& observer) >+{ >+ m_activeIntersectionObservers.add(&observer); >+} >+ >+bool Document::deactivateIntersectionObserver(IntersectionObserver& observer) >+{ >+ return m_activeIntersectionObservers.remove(&observer); >+} >+ >+void Document::addViewportIntersectionObserver(IntersectionObserver& observer) >+{ >+ m_viewportIntersectionObservers.add(&observer); >+} >+ >+void Document::removeViewportIntersectionObserver(IntersectionObserver& observer) >+{ >+ m_viewportIntersectionObservers.remove(&observer); >+} >+ >+void Document::updateIntersectionObservations() >+{ >+ bool needNotify = false; >+ for (auto* observer : m_activeIntersectionObservers) { >+ for (auto* target : observer->observationTargets()) { >+ auto& targetRegistrations = target->intersectionObserverData()->registrations; >+ auto index = targetRegistrations.findMatching([observer](auto& registration) { >+ return registration.observer.get() == observer; >+ }); >+ ASSERT(index != notFound); >+ auto& registration = targetRegistrations[index]; >+ >+ // FIXME: Compute intersection of target and observer's root. >+ size_t thresholdIndex = 0; >+ double timestamp = 0; >+ std::optional<DOMRectInit> rootBounds; >+ DOMRectInit targetBoundingClientRect; >+ DOMRectInit intersectionRect; >+ double intersectionRatio = 0; >+ bool isIntersecting = false; >+ if (thresholdIndex != registration.previousThresholdIndex) { >+ observer->appendQueuedEntry(IntersectionObserverEntry::create({ >+ timestamp, >+ rootBounds, >+ targetBoundingClientRect, >+ intersectionRect, >+ intersectionRatio, >+ target, >+ isIntersecting, >+ })); >+ needNotify = true; >+ registration.previousThresholdIndex = thresholdIndex; >+ } >+ } >+ } >+ >+ if (needNotify) >+ m_intersectionObserversNotifyTimer.startOneShot(0_s); >+} >+ >+void Document::notifyIntersectionObserversTimerFired() >+{ >+ for (auto* observer : m_activeIntersectionObservers) >+ observer->notify(); >+} >+#endif >+ > const AtomicString& Document::dir() const > { > auto* documentElement = this->documentElement(); >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index 2e3afc20b059a8b6b964b89b9b595f4b071c18c1..86b2375defb53d5ea459d1fe7c7b354d3d8a7253 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -235,6 +235,10 @@ class MediaSession; > class HTMLAttachmentElement; > #endif > >+#if ENABLE(INTERSECTION_OBSERVER) >+class IntersectionObserver; >+#endif >+ > namespace Style { > class Scope; > }; >@@ -1359,6 +1363,15 @@ public: > void addViewportDependentPicture(HTMLPictureElement&); > void removeViewportDependentPicture(HTMLPictureElement&); > >+#if ENABLE(INTERSECTION_OBSERVER) >+ void activateIntersectionObserver(IntersectionObserver&); >+ bool deactivateIntersectionObserver(IntersectionObserver&); >+ unsigned numberOfActiveIntersectionObservers() const { return m_activeIntersectionObservers.size(); } >+ void addViewportIntersectionObserver(IntersectionObserver&); >+ void removeViewportIntersectionObserver(IntersectionObserver&); >+ void updateIntersectionObservations(); >+#endif >+ > #if ENABLE(MEDIA_STREAM) > void setHasCaptureMediaStreamTrack() { m_hasHadCaptureMediaStreamTrack = true; } > bool hasHadCaptureMediaStreamTrack() const { return m_hasHadCaptureMediaStreamTrack; } >@@ -1575,6 +1588,10 @@ private: > > void checkViewportDependentPictures(); > >+#if ENABLE(INTERSECTION_OBSERVER) >+ void notifyIntersectionObserversTimerFired(); >+#endif >+ > #if USE(QUICK_LOOK) > bool shouldEnforceQuickLookSandbox() const; > void applyQuickLookSandbox(); >@@ -1757,6 +1774,12 @@ private: > > HashSet<HTMLPictureElement*> m_viewportDependentPictures; > >+#if ENABLE(INTERSECTION_OBSERVER) >+ HashSet<IntersectionObserver*> m_activeIntersectionObservers; >+ HashSet<IntersectionObserver*> m_viewportIntersectionObservers; >+ Timer m_intersectionObserversNotifyTimer; >+#endif >+ > Timer m_loadEventDelayTimer; > > ViewportArguments m_viewportArguments; >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index b47c8932587bb190f8222bad8bf583f59e90b770..8074594840c8205eb59dceca8cfcd5583102a0b4 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -1648,6 +1648,15 @@ void Element::didMoveToNewDocument(Document& oldDocument, Document& newDocument) > > if (UNLIKELY(isDefinedCustomElement())) > CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded(*this, oldDocument, newDocument); >+ >+#if ENABLE(INTERSECTION_OBSERVER) >+ if (auto* observerData = intersectionObserverData()) { >+ for (auto* observer : observerData->observers) { >+ if (oldDocument.deactivateIntersectionObserver(*observer)) >+ newDocument.activateIntersectionObserver(*observer); >+ } >+ } >+#endif > } > > bool Element::hasAttributes() const >@@ -3244,6 +3253,10 @@ void Element::disconnectFromIntersectionObservers() > if (!observerData) > return; > >+ for (auto& registration : observerData->registrations) >+ registration.observer->removeObservationTarget(*this); >+ observerData->registrations.clear(); >+ > for (auto* observer : observerData->observers) > observer->rootDestroyed(); > observerData->observers.clear(); >diff --git a/Source/WebCore/page/IntersectionObserver.cpp b/Source/WebCore/page/IntersectionObserver.cpp >index 44f346da143560ee4f3510f3dba365d52c4b43de..7b0c3debbabb4035c9e33f9d44a983e174457e24 100644 >--- a/Source/WebCore/page/IntersectionObserver.cpp >+++ b/Source/WebCore/page/IntersectionObserver.cpp >@@ -81,7 +81,7 @@ static ExceptionOr<LengthBox> parseRootMargin(String& rootMargin) > return LengthBox(WTFMove(margins[0]), WTFMove(margins[1]), WTFMove(margins[2]), WTFMove(margins[3])); > } > >-ExceptionOr<Ref<IntersectionObserver>> IntersectionObserver::create(Ref<IntersectionObserverCallback>&& callback, IntersectionObserver::Init&& init) >+ExceptionOr<Ref<IntersectionObserver>> IntersectionObserver::create(Document& document, Ref<IntersectionObserverCallback>&& callback, IntersectionObserver::Init&& init) > { > auto rootMarginOrException = parseRootMargin(init.rootMargin); > if (rootMarginOrException.hasException()) >@@ -100,11 +100,12 @@ ExceptionOr<Ref<IntersectionObserver>> IntersectionObserver::create(Ref<Intersec > return Exception { RangeError, "Failed to construct 'IntersectionObserver': all thresholds must lie in the range [0.0, 1.0]." }; > } > >- return adoptRef(*new IntersectionObserver(WTFMove(callback), init.root, rootMarginOrException.releaseReturnValue(), WTFMove(thresholds))); >+ return adoptRef(*new IntersectionObserver(document, WTFMove(callback), init.root, rootMarginOrException.releaseReturnValue(), WTFMove(thresholds))); > } > >-IntersectionObserver::IntersectionObserver(Ref<IntersectionObserverCallback>&& callback, Element* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds) >- : m_root(root) >+IntersectionObserver::IntersectionObserver(Document& document, Ref<IntersectionObserverCallback>&& callback, Element* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds) >+ : m_implicitRootDocument(nullptr) >+ , m_root(root) > , m_rootMargin(WTFMove(parsedRootMargin)) > , m_thresholds(WTFMove(thresholds)) > , m_callback(WTFMove(callback)) >@@ -112,13 +113,19 @@ IntersectionObserver::IntersectionObserver(Ref<IntersectionObserverCallback>&& c > if (m_root) { > auto& observerData = m_root->ensureIntersectionObserverData(); > observerData.observers.append(this); >+ } else if (auto* frame = document.frame()) { >+ m_implicitRootDocument = frame->mainFrame().document(); >+ m_implicitRootDocument->addViewportIntersectionObserver(*this); > } > } > > IntersectionObserver::~IntersectionObserver() > { >+ disconnect(); > if (m_root) > m_root->intersectionObserverData()->observers.removeFirst(this); >+ else if (m_implicitRootDocument) >+ m_implicitRootDocument->removeViewportIntersectionObserver(*this); > } > > String IntersectionObserver::rootMargin() const >@@ -138,21 +145,57 @@ String IntersectionObserver::rootMargin() const > return stringBuilder.toString(); > } > >-void IntersectionObserver::observe(Element&) >+void IntersectionObserver::observe(Element& target) > { >+ if (!trackingDocument() || m_observationTargets.contains(&target)) >+ return; >+ >+ auto& observerData = target.ensureIntersectionObserverData(); >+ auto& registrations = observerData.registrations; >+ >+ // Set previousThresholdIndex to a sentinel value that ensures the first computed threshold >+ // index will be different, triggering an initial notification. >+ registrations.append({ this, std::numeric_limits<size_t>::max() }); >+ >+ m_observationTargets.append(&target); >+ auto* document = trackingDocument(); >+ document->activateIntersectionObserver(*this); >+ document->postTask([document] (ScriptExecutionContext&) mutable { >+ document->updateIntersectionObservations(); >+ }); > } > >-void IntersectionObserver::unobserve(Element&) >+void IntersectionObserver::unobserve(Element& target) > { >+ if (!removeObservationTarget(target)) >+ return; >+ >+ auto& registrations = target.intersectionObserverData()->registrations; >+ bool removed = registrations.removeFirstMatching([this](auto& registration) { >+ return registration.observer.get() == this; >+ }); >+ ASSERT_UNUSED(removed, removed); > } > > void IntersectionObserver::disconnect() > { >+ for (auto* target : m_observationTargets) >+ unobserve(*target); > } > >-Vector<RefPtr<IntersectionObserverEntry>> IntersectionObserver::takeRecords() >+Vector<Ref<IntersectionObserverEntry>> IntersectionObserver::takeRecords() > { >- return { }; >+ return WTFMove(m_queuedEntries); >+} >+ >+bool IntersectionObserver::removeObservationTarget(Element& element) >+{ >+ bool removed = m_observationTargets.removeFirst(&element); >+ if (removed && !hasObservationTargets()) { >+ if (auto* document = trackingDocument()) >+ document->deactivateIntersectionObserver(*this); >+ } >+ return removed; > } > > void IntersectionObserver::rootDestroyed() >@@ -162,6 +205,26 @@ void IntersectionObserver::rootDestroyed() > m_root = nullptr; > } > >+void IntersectionObserver::implicitRootDocumentDestroyed() >+{ >+ ASSERT(m_implicitRootDocument); >+ disconnect(); >+ m_implicitRootDocument = nullptr; >+} >+ >+void IntersectionObserver::appendQueuedEntry(Ref<IntersectionObserverEntry>&& entry) >+{ >+ m_queuedEntries.append(WTFMove(entry)); >+} >+ >+void IntersectionObserver::notify() >+{ >+ if (m_queuedEntries.isEmpty() || !m_callback->canInvokeCallback()) >+ return; >+ >+ m_callback->handleEvent(takeRecords(), *this); >+} >+ > } // namespace WebCore > > #endif // ENABLE(INTERSECTION_OBSERVER) >diff --git a/Source/WebCore/page/IntersectionObserver.h b/Source/WebCore/page/IntersectionObserver.h >index 7aac21832094d863ef768f92df75bfaf3a5ab3b7..11923aa6995409861af744cdf3c5b6db2b6e4c06 100644 >--- a/Source/WebCore/page/IntersectionObserver.h >+++ b/Source/WebCore/page/IntersectionObserver.h >@@ -36,15 +36,22 @@ > > namespace WebCore { > >+class Document; > class Element; > >+struct IntersectionObserverRegistration { >+ RefPtr<IntersectionObserver> observer; >+ size_t previousThresholdIndex { 0 }; >+}; >+ > struct IntersectionObserverData { > // IntersectionObservers for which the element that owns this IntersectionObserverData is the root. > // The IntersectionObservers are owned by JavaScript wrappers and by IntersectionObserverRegistrations > // for each target currently being observed. > Vector<IntersectionObserver*> observers; > >- // FIXME: Create and track IntersectionObserverRegistrations. >+ // IntersectionObserverRegistrations for which the element that owns this IntersectionObserverData is the target. >+ Vector<IntersectionObserverRegistration> registrations; > }; > > class IntersectionObserver : public RefCounted<IntersectionObserver> { >@@ -55,29 +62,41 @@ public: > Variant<double, Vector<double>> threshold; > }; > >- static ExceptionOr<Ref<IntersectionObserver>> create(Ref<IntersectionObserverCallback>&&, Init&&); >+ static ExceptionOr<Ref<IntersectionObserver>> create(Document&, Ref<IntersectionObserverCallback>&&, Init&&); > > ~IntersectionObserver(); > >+ Document* trackingDocument() { return m_root ? &m_root->document() : m_implicitRootDocument; } >+ > Element* root() const { return m_root; } > String rootMargin() const; > const Vector<double>& thresholds() const { return m_thresholds; } >+ const Vector<Element*> observationTargets() const { return m_observationTargets; } > > void observe(Element&); > void unobserve(Element&); > void disconnect(); > >- Vector<RefPtr<IntersectionObserverEntry>> takeRecords(); >+ Vector<Ref<IntersectionObserverEntry>> takeRecords(); > >+ bool removeObservationTarget(Element&); >+ bool hasObservationTargets() const { return m_observationTargets.size(); } > void rootDestroyed(); >+ void implicitRootDocumentDestroyed(); >+ >+ void appendQueuedEntry(Ref<IntersectionObserverEntry>&&); >+ void notify(); > > private: >- IntersectionObserver(Ref<IntersectionObserverCallback>&&, Element* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds); >- >+ IntersectionObserver(Document&, Ref<IntersectionObserverCallback>&&, Element* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds); >+ >+ Document* m_implicitRootDocument; > Element* m_root; > LengthBox m_rootMargin; > Vector<double> m_thresholds; > Ref<IntersectionObserverCallback> m_callback; >+ Vector<Element*> m_observationTargets; >+ Vector<Ref<IntersectionObserverEntry>> m_queuedEntries; > }; > > >diff --git a/Source/WebCore/page/IntersectionObserver.idl b/Source/WebCore/page/IntersectionObserver.idl >index e6dbabf6c0204e910978507a476e111e8de74b15..f78772af74ec53d9109582365aac1c2f5c2fc852 100644 >--- a/Source/WebCore/page/IntersectionObserver.idl >+++ b/Source/WebCore/page/IntersectionObserver.idl >@@ -27,6 +27,7 @@ > > [ > Conditional=INTERSECTION_OBSERVER, >+ ConstructorCallWith=Document, > ConstructorMayThrowException, > Constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options), > ImplementationLacksVTable, >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 13b7b707e2738e33f810ce49ccd5a1af0bd72745..6bd77334e9163703e5e3eddaf97f59c7b8b374dd 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -2310,6 +2310,13 @@ unsigned Internals::referencingNodeCount(const Document& document) const > return document.referencingNodeCount(); > } > >+#if ENABLE(INTERSECTION_OBSERVER) >+unsigned Internals::numberOfActiveIntersectionObservers(const Document& document) const >+{ >+ return document.numberOfActiveIntersectionObservers(); >+} >+#endif >+ > uint64_t Internals::documentIdentifier(const Document& document) const > { > return document.identifier().toUInt64(); >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index d0d2879ce6f6737945d57379147b6376d344646f..e5ead6297ec265bd15d5a3bbbd672e318dbffc17 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -364,6 +364,10 @@ public: > unsigned numberOfLiveDocuments() const; > unsigned referencingNodeCount(const Document&) const; > >+#if ENABLE(INTERSECTION_OBSERVER) >+ unsigned numberOfActiveIntersectionObservers(const Document&) const; >+#endif >+ > uint64_t documentIdentifier(const Document&) const; > bool isDocumentAlive(uint64_t documentIdentifier) const; > >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index 01148b98d9b0f8bfb454a7d7411a6f6f64c8820f..1ddadec135df8c41a62272aeb14fa11c4c9379e2 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -359,6 +359,7 @@ enum CompositingPolicy { > unsigned long numberOfLiveNodes(); > unsigned long numberOfLiveDocuments(); > unsigned long referencingNodeCount(Document document); >+ [Conditional=INTERSECTION_OBSERVER] unsigned long numberOfActiveIntersectionObservers(Document document); > WindowProxy? openDummyInspectorFrontend(DOMString url); > void closeDummyInspectorFrontend(); > [MayThrowException] void setInspectorIsUnderTest(boolean isUnderTest); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index de4b2bd150301ea5769fcc36e34615b4b3a1b5f1..0f4f53641b706c6207812e7a32652c072c792a98 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2018-08-16 Ali Juma <ajuma@chromium.org> >+ >+ [IntersectionObserver] Fire an initial dummy notification >+ https://bugs.webkit.org/show_bug.cgi?id=188670 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * intersection-observer/root-element-deleted.html: Add additional assertions. >+ * intersection-observer/root-element-moved-expected.txt: Added. >+ * intersection-observer/root-element-moved.html: Added. >+ > 2018-08-15 Ali Juma <ajuma@chromium.org> > > Disable IntersectionObserver tests on Windows for now >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index baaad25387312dd8793116139233197a800f8b8f..33b9f8174f697083082958a2232533dae4220eef 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,37 @@ >+2018-08-16 Ali Juma <ajuma@chromium.org> >+ >+ [IntersectionObserver] Fire an initial dummy notification >+ https://bugs.webkit.org/show_bug.cgi?id=188670 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Rebaseline tests now that an initial notification is fired. >+ >+ * web-platform-tests/intersection-observer/bounding-box-expected.txt: >+ * web-platform-tests/intersection-observer/client-rect-expected.txt: >+ * web-platform-tests/intersection-observer/containing-block-expected.txt: >+ * web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt: >+ * web-platform-tests/intersection-observer/disconnect-expected.txt: >+ * web-platform-tests/intersection-observer/display-none-expected.txt: >+ * web-platform-tests/intersection-observer/edge-inclusive-intersection-expected.txt: >+ * web-platform-tests/intersection-observer/iframe-no-root-expected.txt: >+ * web-platform-tests/intersection-observer/inline-client-rect-expected.txt: >+ * web-platform-tests/intersection-observer/isIntersecting-change-events-expected.txt: >+ * web-platform-tests/intersection-observer/multiple-targets-expected.txt: >+ * web-platform-tests/intersection-observer/multiple-thresholds-expected.txt: >+ * web-platform-tests/intersection-observer/observer-without-js-reference-expected.txt: >+ * web-platform-tests/intersection-observer/remove-element-expected.txt: >+ * web-platform-tests/intersection-observer/root-margin-expected.txt: >+ * web-platform-tests/intersection-observer/same-document-no-root-expected.txt: >+ * web-platform-tests/intersection-observer/same-document-root-expected.txt: >+ * web-platform-tests/intersection-observer/same-document-zero-size-target-expected.txt: >+ * web-platform-tests/intersection-observer/shadow-content-expected.txt: >+ * web-platform-tests/intersection-observer/text-target-expected.txt: >+ * web-platform-tests/intersection-observer/timestamp-expected.txt: >+ * web-platform-tests/intersection-observer/unclipped-root-expected.txt: >+ * web-platform-tests/intersection-observer/zero-area-element-hidden-expected.txt: >+ * web-platform-tests/intersection-observer/zero-area-element-visible-expected.txt: >+ > 2018-08-14 Ryosuke Niwa <rniwa@webkit.org> > > connectedCallback is invoked by the HTML parser after child nodes had been inserted >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/bounding-box-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/bounding-box-expected.txt >index 50762b64c80febecffaae98d9c467d7d3f61ef62..2a30215c484e4cb70824d011678ce29347e90430 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/bounding-box-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/bounding-box-expected.txt >@@ -1,5 +1,5 @@ > > PASS Test that the target's border bounding box is used to calculate intersection. >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL target.style.transform = 'translateY(195px)' assert_equals: entries.length expected 2 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 25 but got 0 >+FAIL target.style.transform = 'translateY(195px)' assert_equals: entries.length expected 2 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/client-rect-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/client-rect-expected.txt >index 08fc2c4b449f4d5d0dcdc3f707a41a956a0d229b..2d27f6723e91910dae87a72c02eed9441ce5ddd7 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/client-rect-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/client-rect-expected.txt >@@ -1,4 +1,4 @@ > > PASS IntersectionObserverEntry.boundingClientRect should match target.boundingClientRect() >-FAIL First rAF should generate notification. assert_equals: One notification. expected 1 but got 0 >+FAIL First rAF should generate notification. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/containing-block-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/containing-block-expected.txt >index 9eeb18e5977332c4fc9d3ca358624fe67fc00d5a..73be024490b156e37b0d2e8d1cae773b10669cf7 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/containing-block-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/containing-block-expected.txt >@@ -1,7 +1,7 @@ > > PASS IntersectionObserver should only report intersections if root is a containing block ancestor of target. >-FAIL In containing block and intersecting. assert_equals: entries.length expected 1 but got 0 >-FAIL In containing block and not intersecting. assert_equals: entries.length expected 2 but got 0 >-FAIL Not in containing block and intersecting. assert_equals: entries.length expected 2 but got 0 >-FAIL Not in containing block and not intersecting. assert_equals: entries.length expected 2 but got 0 >+FAIL In containing block and intersecting. assert_equals: entries[0].boundingClientRect.left expected 58 but got 0 >+FAIL In containing block and not intersecting. assert_equals: entries.length expected 2 but got 1 >+FAIL Not in containing block and intersecting. assert_equals: entries.length expected 2 but got 1 >+FAIL Not in containing block and not intersecting. assert_equals: entries.length expected 2 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt >index f26709bc5cf3bdc7301c085bb53ff65063d71a44..95c52cb6102a3de268d6da56be50b98e496bfd1e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt >@@ -1,7 +1,7 @@ > > > PASS Intersection observer test with no explicit root and target in a cross-origin iframe. >-FAIL First rAF assert_equals: expected 1 but got 0 >+PASS First rAF > PASS topDocument.scrollingElement.scrollTop = 200 > FAIL iframeDocument.scrollingElement.scrollTop = 250 assert_equals: expected 1 but got 0 > FAIL topDocument.scrollingElement.scrollTop = 100 assert_equals: expected 1 but got 0 >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/disconnect-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/disconnect-expected.txt >index 41df6e7a70bb1a50cc1773f24ae80fe0d9e6eeeb..f88c12c28008e77d08aac8cb06c97a9caa6e6c2f 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/disconnect-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/disconnect-expected.txt >@@ -1,5 +1,5 @@ > > PASS IntersectionObserver should not deliver pending notifications after disconnect(). >-FAIL First rAF. assert_equals: Initial notification. expected 1 but got 0 >-FAIL observer.disconnect() assert_equals: No new notifications. expected 1 but got 0 >+PASS First rAF. >+PASS observer.disconnect() > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/display-none-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/display-none-expected.txt >index 372a41fd75e1464241ce6c1babc83cbbcfcd386d..967db203b6440755e4092a55b39b9a15fb87233f 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/display-none-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/display-none-expected.txt >@@ -1,6 +1,6 @@ > > PASS IntersectionObserver should send a not-intersecting notification for a target that gets display:none. >-FAIL Intersecting notification after first rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL Not-intersecting notification after setting display:none on target. assert_equals: entries.length expected 2 but got 0 >-FAIL Intersecting notification after removing display:none on target. assert_equals: entries.length expected 3 but got 0 >+FAIL Intersecting notification after first rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 >+FAIL Not-intersecting notification after setting display:none on target. assert_equals: entries.length expected 2 but got 1 >+FAIL Intersecting notification after removing display:none on target. assert_equals: entries.length expected 3 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/edge-inclusive-intersection-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/edge-inclusive-intersection-expected.txt >index 6fd199f7d53f050299d4f8fe08eb294a50167a5a..c8595b0cba5a722fe506d676f06ee5127306b51f 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/edge-inclusive-intersection-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/edge-inclusive-intersection-expected.txt >@@ -1,7 +1,7 @@ > > PASS IntersectionObserver should detect and report edge-adjacent and zero-area intersections. >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL Set transform=translateY(200px) on target. assert_equals: entries.length expected 2 but got 0 >-FAIL Set transform=translateY(201px) on target. assert_equals: entries.length expected 3 but got 0 >-FAIL Set transform=translateY(185px) on target. assert_equals: entries.length expected 4 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 >+FAIL Set transform=translateY(200px) on target. assert_equals: entries.length expected 2 but got 1 >+FAIL Set transform=translateY(201px) on target. assert_equals: entries.length expected 3 but got 1 >+FAIL Set transform=translateY(185px) on target. assert_equals: entries.length expected 4 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt >index 9137bee6b5d4e8de631354876333fbe9b04b624c..5daefcc5b8819ed05ca9c597592552462ce7b5ab 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt >@@ -1,8 +1,8 @@ > > > PASS Observer with the implicit root; target in a same-origin iframe. >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL document.scrollingElement.scrollTop = 200 assert_equals: entries.length == 1 expected 1 but got 0 >-FAIL iframe.contentDocument.scrollingElement.scrollTop = 250 assert_equals: entries.length expected 2 but got 0 >-FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 >+PASS document.scrollingElement.scrollTop = 200 >+FAIL iframe.contentDocument.scrollingElement.scrollTop = 250 assert_equals: entries.length expected 2 but got 1 >+FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/inline-client-rect-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/inline-client-rect-expected.txt >index 1ccadf05989d0299c05cd80d1f04bcccd1b0908c..eda47367bbaef463fe3833ec57bf090f2d4bb416 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/inline-client-rect-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/inline-client-rect-expected.txt >@@ -1,6 +1,6 @@ > 1 2 3 4 5 > > PASS Inline target >-FAIL First rAF assert_equals: entries.length expected 1 but got 0 >-FAIL scroller.scrollLeft = 90 assert_equals: entries.length expected 2 but got 0 >+FAIL First rAF assert_equals: entries[0].boundingClientRect.left expected 320 but got 0 >+FAIL scroller.scrollLeft = 90 assert_equals: entries.length expected 2 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/isIntersecting-change-events-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/isIntersecting-change-events-expected.txt >index 07d48f20195ec7acbbb54800c160092a91850b6b..666955928ce3700720d0bf91989d2b8a3306b9ab 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/isIntersecting-change-events-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/isIntersecting-change-events-expected.txt >@@ -1,4 +1,4 @@ > > PASS isIntersecting changes should trigger notifications. >-FAIL Rects in initial notifications should report initial positions. assert_equals: Has 3 initial notifications. expected 3 but got 0 >+FAIL Rects in initial notifications should report initial positions. assert_equals: Check 1st entry rect.right expected 100 but got 0 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-targets-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-targets-expected.txt >index 4d1482ccb46a3dc4e686dff5e8a7bfac5f7bf20f..acebac2fcfaa0a7914a240196983002e36aea429 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-targets-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-targets-expected.txt >@@ -1,7 +1,7 @@ > > PASS One observer with multiple targets. >-FAIL First rAF. assert_equals: Three initial notifications. expected 3 but got 0 >-FAIL document.scrollingElement.scrollTop = 150 assert_equals: Four notifications. expected 4 but got 0 >-FAIL document.scrollingElement.scrollTop = 10000 assert_equals: Six notifications. expected 6 but got 0 >-FAIL document.scrollingElement.scrollTop = 0 assert_equals: Nine notifications. expected 9 but got 0 >+PASS First rAF. >+FAIL document.scrollingElement.scrollTop = 150 assert_equals: Four notifications. expected 4 but got 3 >+FAIL document.scrollingElement.scrollTop = 10000 assert_equals: Six notifications. expected 6 but got 3 >+FAIL document.scrollingElement.scrollTop = 0 assert_equals: Nine notifications. expected 9 but got 3 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-thresholds-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-thresholds-expected.txt >index f4a66f808e5edb8949d7da8dc1778557b66f71e6..305679f80c737e5c7a4a46361bb13c61a92626d2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-thresholds-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-thresholds-expected.txt >@@ -1,11 +1,11 @@ > > PASS Observer with multiple thresholds. >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL document.scrollingElement.scrollTop = 120 assert_equals: entries.length expected 2 but got 0 >-FAIL document.scrollingElement.scrollTop = 160 assert_equals: entries.length expected 3 but got 0 >-FAIL document.scrollingElement.scrollTop = 200 assert_equals: entries.length expected 4 but got 0 >-FAIL document.scrollingElement.scrollTop = 240 assert_equals: entries.length expected 5 but got 0 >-FAIL document.scrollingElement.scrollTop = window.innerHeight + 140 assert_equals: entries.length expected 6 but got 0 >-FAIL document.scrollingElement.scrollTop = window.innerHeight + 160 assert_equals: entries.length expected 7 but got 0 >-FAIL document.scrollingElement.scrollTop = window.innerHeight + 200 assert_equals: entries.length expected 8 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 >+FAIL document.scrollingElement.scrollTop = 120 assert_equals: entries.length expected 2 but got 1 >+FAIL document.scrollingElement.scrollTop = 160 assert_equals: entries.length expected 3 but got 1 >+FAIL document.scrollingElement.scrollTop = 200 assert_equals: entries.length expected 4 but got 1 >+FAIL document.scrollingElement.scrollTop = 240 assert_equals: entries.length expected 5 but got 1 >+FAIL document.scrollingElement.scrollTop = window.innerHeight + 140 assert_equals: entries.length expected 6 but got 1 >+FAIL document.scrollingElement.scrollTop = window.innerHeight + 160 assert_equals: entries.length expected 7 but got 1 >+FAIL document.scrollingElement.scrollTop = window.innerHeight + 200 assert_equals: entries.length expected 8 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/observer-without-js-reference-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/observer-without-js-reference-expected.txt >index 4935ea6151cb330dcd9153acbc5d27a61405a6d2..2e7607f314b8750926650b3043bc218a479bbbe4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/observer-without-js-reference-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/observer-without-js-reference-expected.txt >@@ -1,5 +1,5 @@ > > PASS IntersectionObserver that is unreachable in js should still generate notifications. >-FAIL First rAF assert_equals: One notification. expected 1 but got 0 >-FAIL document.scrollingElement.scrollTop = 300 assert_equals: Two notifications. expected 2 but got 0 >+PASS First rAF >+FAIL document.scrollingElement.scrollTop = 300 assert_equals: Two notifications. expected 2 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/remove-element-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/remove-element-expected.txt >index dd4186c082586cc61f2b778d19940b4ad41647ef..fc1b4a2bcbaaf9b113d8ac7a87fd52dddc517435 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/remove-element-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/remove-element-expected.txt >@@ -1,8 +1,8 @@ > > PASS Verify that not-intersecting notifications are sent when a target is removed from the DOM tree. >-FAIL First rAF assert_equals: entries.length expected 1 but got 0 >-FAIL root.scrollTop = 150 assert_equals: entries.length expected 2 but got 0 >-FAIL root.removeChild(target). assert_equals: entries.length expected 3 but got 0 >-FAIL root.insertBefore(target, trailingSpace). assert_equals: entries.length expected 3 but got 0 >-FAIL root.scrollTop = 150 after reinserting target. assert_equals: entries.length expected 4 but got 0 >+FAIL First rAF assert_equals: entries[0].boundingClientRect.left expected 11 but got 0 >+FAIL root.scrollTop = 150 assert_equals: entries.length expected 2 but got 1 >+FAIL root.removeChild(target). assert_equals: entries.length expected 3 but got 1 >+FAIL root.insertBefore(target, trailingSpace). assert_equals: entries.length expected 3 but got 1 >+FAIL root.scrollTop = 150 after reinserting target. assert_equals: entries.length expected 4 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/root-margin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/root-margin-expected.txt >index 5d1e48f94ed374cfc4b44cadfc69138d104e1482..f396e95425428428bef7a7aa0984d220bf303767 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/root-margin-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/root-margin-expected.txt >@@ -1,8 +1,8 @@ > > > PASS Root margin tests >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL document.scrollingElement.scrollLeft = 100 assert_equals: entries.length expected 2 but got 0 >-FAIL document.scrollingElement.scrollTop = document.documentElement.clientHeight + 200 assert_equals: entries.length expected 2 but got 0 >-FAIL document.scrollingElement.scrollTop = document.documentElement.clientHeight + 300 assert_equals: entries.length expected 3 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 972 but got 0 >+FAIL document.scrollingElement.scrollLeft = 100 assert_equals: entries.length expected 2 but got 1 >+FAIL document.scrollingElement.scrollTop = document.documentElement.clientHeight + 200 assert_equals: entries.length expected 2 but got 1 >+FAIL document.scrollingElement.scrollTop = document.documentElement.clientHeight + 300 assert_equals: entries.length expected 3 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-no-root-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-no-root-expected.txt >index 30c7a88cd81649ae47b792a005e53893402d4532..7bdff406a781f6db4064c53288967c137470b0c5 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-no-root-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-no-root-expected.txt >@@ -1,6 +1,6 @@ > > PASS IntersectionObserver in a single document using the implicit root. >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL document.scrollingElement.scrollTop = 300 assert_equals: entries.length expected 2 but got 0 >-FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 >+FAIL document.scrollingElement.scrollTop = 300 assert_equals: entries.length expected 2 but got 1 >+FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-root-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-root-expected.txt >index 6a18d4d560fa6a385eb8b4dc7ba59be252e5202a..1cc69784199d7d690874064eb17348fb138e00cb 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-root-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-root-expected.txt >@@ -1,9 +1,9 @@ > > PASS IntersectionObserver in a single document with explicit root. >-FAIL First rAF assert_equals: entries.length expected 1 but got 0 >-FAIL document.scrollingElement.scrollTop = window.innerHeight. assert_equals: No notifications after scrolling frame. expected 1 but got 0 >-FAIL root.scrollTop = 150 with root scrolled into view. assert_equals: entries.length expected 2 but got 0 >-FAIL document.scrollingElement.scrollTop = 0. assert_equals: entries.length expected 2 but got 0 >-FAIL root.scrollTop = 0 assert_equals: entries.length expected 3 but got 0 >-FAIL root.scrollTop = 150 with root scrolled out of view. assert_equals: entries.length expected 4 but got 0 >+FAIL First rAF assert_equals: entries[0].boundingClientRect.left expected 11 but got 0 >+PASS document.scrollingElement.scrollTop = window.innerHeight. >+FAIL root.scrollTop = 150 with root scrolled into view. assert_equals: entries.length expected 2 but got 1 >+FAIL document.scrollingElement.scrollTop = 0. assert_equals: entries.length expected 2 but got 1 >+FAIL root.scrollTop = 0 assert_equals: entries.length expected 3 but got 1 >+FAIL root.scrollTop = 150 with root scrolled out of view. assert_equals: entries.length expected 4 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-zero-size-target-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-zero-size-target-expected.txt >index 40b11a681301511df142629b7f6f01d72645c99f..a6f547028c95bcc60a830d635befedf577d89632 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-zero-size-target-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-zero-size-target-expected.txt >@@ -1,6 +1,6 @@ > > PASS Observing a zero-area target. >-FAIL First rAF assert_equals: entries.length expected 1 but got 0 >-FAIL document.scrollingElement.scrollTop = 300 assert_equals: entries.length expected 2 but got 0 >-FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 0 >+FAIL First rAF assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 >+FAIL document.scrollingElement.scrollTop = 300 assert_equals: entries.length expected 2 but got 1 >+FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/shadow-content-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/shadow-content-expected.txt >index bd0179886430c5287a3f8d1499f22d6640446e4f..c7395777f9af1251f1bd3dd908282d7dff7f8ae9 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/shadow-content-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/shadow-content-expected.txt >@@ -1,4 +1,4 @@ > > PASS Observing a target inside shadow DOM. >-FAIL First rAF after creating shadow DOM. assert_equals: entries.length expected 1 but got 0 >+FAIL First rAF after creating shadow DOM. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/text-target-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/text-target-expected.txt >index a713ec2acf269c98d1140abfe444e87f446b6a86..6d7b211fa2eb2e8dbe247fc85e3cb0f8df5dc961 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/text-target-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/text-target-expected.txt >@@ -1,7 +1,7 @@ > > > PASS IntersectionObserver observing a br element. >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL document.scrollingElement.scrollTop = 300 assert_equals: entries.length expected 2 but got 0 >-FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 >+FAIL document.scrollingElement.scrollTop = 300 assert_equals: entries.length expected 2 but got 1 >+FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/timestamp-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/timestamp-expected.txt >index c8e113505b187ab19d006507aec96bfa8b56a692..fd25cbf86806828bdfdc854d67e9f5ba2cc4e1b1 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/timestamp-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/timestamp-expected.txt >@@ -1,6 +1,6 @@ > > > PASS Check that timestamps correspond to the to execution context that created the observer. >-FAIL First rAF after iframe is loaded. assert_equals: One notification to top window observer. expected 1 but got 0 >+PASS First rAF after iframe is loaded. > FAIL Generate notifications. undefined is not an object (evaluating 'topWindowEntries[1].time') > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/unclipped-root-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/unclipped-root-expected.txt >index eabc5778c39717e2fe5ef82f3960213759eebb79..af52e04b8bb6a4967cdaae8496def8b0f756320b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/unclipped-root-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/unclipped-root-expected.txt >@@ -1,5 +1,5 @@ > > PASS Test that border bounding box is used to calculate intersection with a non-scrolling root. >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >-FAIL target.style.transform = 'translateY(195px)' assert_equals: entries.length expected 2 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 15 but got 0 >+FAIL target.style.transform = 'translateY(195px)' assert_equals: entries.length expected 2 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-hidden-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-hidden-expected.txt >index 2507ee2bf3746e5898b1df36db3f85214b5d4551..28aa4902b1099488e9bca089552c3bcb7976b22e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-hidden-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-hidden-expected.txt >@@ -1,4 +1,4 @@ > > PASS A zero-area hidden target should not be intersecting. >-FAIL First rAF. assert_equals: entries.length expected 1 but got 0 >+FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-visible-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-visible-expected.txt >index d4ba44456f76740b7e16d11667efebaad8ce358a..c118fdf66d058fe5762aa05ec0bf7250c9180de4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-visible-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/zero-area-element-visible-expected.txt >@@ -1,4 +1,4 @@ > > PASS Ensure that a zero-area target intersecting root generates a notification with intersectionRatio == 1 >-FAIL First rAF should generate a notification. assert_equals: One notification. expected 1 but got 0 >+FAIL First rAF should generate a notification. assert_equals: intersectionRatio == 1 expected 1 but got 0 > >diff --git a/LayoutTests/intersection-observer/root-element-deleted.html b/LayoutTests/intersection-observer/root-element-deleted.html >index 114d9ac502b4f7e9cfc610d18e9e4e29de4b8da6..d39395555d4933541db0923829d2c63db5447939 100644 >--- a/LayoutTests/intersection-observer/root-element-deleted.html >+++ b/LayoutTests/intersection-observer/root-element-deleted.html >@@ -15,12 +15,14 @@ > var target = document.getElementById('target'); > assert_equals(observer.root, root, 'Observer starts out with non-null root'); > observer.observe(target); >+ assert_equals(internals.numberOfActiveIntersectionObservers(document), 1); > root.parentNode.removeChild(root); > root = null; > target = null; > requestAnimationFrame(t.step_func_done(function() { > GCController.collect(); > assert_equals(observer.root, null, 'Observer has null root after root element is destroyed'); >+ assert_equals(internals.numberOfActiveIntersectionObservers(document), 0); > })); > }, "IntersectionObserver doesn't keep unreachable root alive"); > </script> >diff --git a/LayoutTests/intersection-observer/root-element-moved-expected.txt b/LayoutTests/intersection-observer/root-element-moved-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6552be4143b4acb992be76f540315d6652dc40b0 >--- /dev/null >+++ b/LayoutTests/intersection-observer/root-element-moved-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Document's active intersection observers get updated >+ >diff --git a/LayoutTests/intersection-observer/root-element-moved.html b/LayoutTests/intersection-observer/root-element-moved.html >new file mode 100644 >index 0000000000000000000000000000000000000000..541afe85b30aa1f4a970755214f6ad28d30ac5e4 >--- /dev/null >+++ b/LayoutTests/intersection-observer/root-element-moved.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ enableIntersectionObserver=true ] --> >+<head> >+<script src="../resources/testharness.js"></script> >+<script src="../resources/testharnessreport.js"></script> >+<body> >+ >+<div id="root" style="position:absolute"> >+ <div id="target" style="width: 100px; height: 100px; background-color: green"></div> >+</div> >+ >+<script> >+ var observer; >+ var root = document.getElementById('root'); >+ var target = document.getElementById('target'); >+ test(function() { >+ observer = new IntersectionObserver(function() {}, { root: document.getElementById('root') });; >+ assert_equals(observer.root, root); >+ observer.observe(target); >+ assert_equals(internals.numberOfActiveIntersectionObservers(document), 1); >+ document.body.appendChild(target); >+ var newDoc = document.implementation.createHTMLDocument('New document'); >+ newDoc.body.appendChild(root); >+ assert_equals(internals.numberOfActiveIntersectionObservers(document), 0); >+ assert_equals(internals.numberOfActiveIntersectionObservers(newDoc), 1); >+ document.body.appendChild(root); >+ assert_equals(internals.numberOfActiveIntersectionObservers(document), 1); >+ assert_equals(internals.numberOfActiveIntersectionObservers(newDoc), 0); >+ },"Document's active intersection observers get updated"); >+</script> >+</body> >+</html>
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 188670
:
347287
|
347289
|
347389
|
347441
|
347451