WebKit Bugzilla
Attachment 349467 Details for
Bug 189525
: [IntersectionObserver] Implement rootMargin expansion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189525-20180911175936.patch (text/plain), 5.50 KB, created by
Ali Juma
on 2018-09-11 14:59:37 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ali Juma
Created:
2018-09-11 14:59:37 PDT
Size:
5.50 KB
patch
obsolete
>Subversion Revision: 235894 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e3cf292aeb808cce101e61da495200573c73ce3f..c9d567bedf41e45c1c4eb184c842abd349deb5c6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-09-11 Ali Juma <ajuma@chromium.org> >+ >+ [IntersectionObserver] Implement rootMargin expansion >+ https://bugs.webkit.org/show_bug.cgi?id=189525 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Expand the root intersection rectangle by the observer's rootMargin when computing >+ intersections. >+ >+ Test: imported/w3c/web-platform-tests/intersection-observer/root-margin.html >+ >+ * dom/Document.cpp: >+ (WebCore::expandRootBoundsWithRootMargin): >+ (WebCore::computeIntersectionRects): >+ * page/IntersectionObserver.h: >+ (WebCore::IntersectionObserver::rootMarginBox const): >+ > 2018-09-11 Frederic Wang <fwang@igalia.com> > > Refactor filter list checking code >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index fb7fc59535a555d1c6c01e6812c80357aca4cea5..7a6defb670cd1b1554d86bd8ad1dacb25778b374 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -7485,6 +7485,19 @@ void Document::removeIntersectionObserver(IntersectionObserver& observer) > m_intersectionObservers.removeFirst(&observer); > } > >+static void expandRootBoundsWithRootMargin(FloatRect& localRootBounds, const LengthBox& rootMargin) >+{ >+ FloatBoxExtent rootMarginFloatBox( >+ floatValueForLength(rootMargin.top(), localRootBounds.height()), >+ floatValueForLength(rootMargin.right(), localRootBounds.width()), >+ floatValueForLength(rootMargin.bottom(), localRootBounds.height()), >+ floatValueForLength(rootMargin.left(), localRootBounds.width()) >+ ); >+ >+ localRootBounds.move(-rootMarginFloatBox.left(), -rootMarginFloatBox.top()); >+ localRootBounds.expand(rootMarginFloatBox.left() + rootMarginFloatBox.right(), rootMarginFloatBox.top() + rootMarginFloatBox.bottom()); >+} >+ > static void computeIntersectionRects(FrameView& frameView, IntersectionObserver& observer, Element& target, FloatRect& absTargetRect, FloatRect& absIntersectionRect, FloatRect& absRootBounds) > { > // FIXME: Implement intersection computation for the cross-document case. >@@ -7495,7 +7508,6 @@ static void computeIntersectionRects(FrameView& frameView, IntersectionObserver& > if (!targetRenderer) > return; > >- // FIXME: Expand localRootBounds using the observer's rootMargin. > FloatRect localRootBounds; > RenderBlock* rootRenderer; > if (observer.root()) { >@@ -7516,6 +7528,8 @@ static void computeIntersectionRects(FrameView& frameView, IntersectionObserver& > localRootBounds = frameView.layoutViewportRect(); > } > >+ expandRootBoundsWithRootMargin(localRootBounds, observer.rootMarginBox()); >+ > LayoutRect localTargetBounds; > if (is<RenderBox>(*targetRenderer)) > localTargetBounds = downcast<RenderBox>(targetRenderer)->borderBoundingBox(); >diff --git a/Source/WebCore/page/IntersectionObserver.h b/Source/WebCore/page/IntersectionObserver.h >index f5089e04fe92fda42a72a1fcbc41adbc823b1ea4..092c4e1f500b49124c6924ee4958e116ddcfdc61 100644 >--- a/Source/WebCore/page/IntersectionObserver.h >+++ b/Source/WebCore/page/IntersectionObserver.h >@@ -72,6 +72,7 @@ public: > > Element* root() const { return m_root; } > String rootMargin() const; >+ const LengthBox& rootMarginBox() const { return m_rootMargin; } > const Vector<double>& thresholds() const { return m_thresholds; } > const Vector<Element*> observationTargets() const { return m_observationTargets; } > >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index e60abee4189f1442afc52c598099305a20175ed1..15df9fc3c13f7dac39800b12bf92e7141615d3fb 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1 +1,12 @@ >+2018-09-11 Ali Juma <ajuma@chromium.org> >+ >+ [IntersectionObserver] Implement rootMargin expansion >+ https://bugs.webkit.org/show_bug.cgi?id=189525 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Rebasline expectation for test that now passes. >+ >+ * web-platform-tests/intersection-observer/root-margin-expected.txt: >+ > == Rolled over to ChangeLog-2018-09-11 == >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 3c36690d0b3d12166156a24876b6c496cdf9e83d..9d9ab2aba1f7d866476f73c35fb183807ba6039a 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[0].rootBounds.left expected -30 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 >+PASS First rAF. >+PASS document.scrollingElement.scrollLeft = 100 >+PASS document.scrollingElement.scrollTop = document.documentElement.clientHeight + 200 >+PASS document.scrollingElement.scrollTop = document.documentElement.clientHeight + 300 >
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 189525
:
349467
|
349548