⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271433 in webkit


Ignore:
Timestamp:
Jan 12, 2021, 11:24:08 PM (6 years ago)
Author:
cathiechen
Message:

The rootBounds of IntersectionObserverEntry is not correct when {root:document}
https://bugs.webkit.org/show_bug.cgi?id=219495

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

  • web-platform-tests/intersection-observer/same-document-with-document-root-expected.txt:

Source/WebCore:

When {root:document}, rootBounds should be the root intersection rectangle which is the document's viewport,
per [1]. The coordinator of rootBounds should be layoutViewportRect, for root intersection rectangle is not affected by pinch zoom [2].

[1] https://www.w3.org/TR/intersection-observer/#dom-intersectionobserverentry-rootbounds
[2] https://w3c.github.io/IntersectionObserver/#intersectionobserver-root-intersection-rectangle

  • dom/Document.cpp:

(WebCore::computeIntersectionState):
(WebCore::Document::updateIntersectionObservations):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r271395 r271433  
     12021-01-12  Cathie Chen  <cathiechen@igalia.com>
     2
     3        The rootBounds of IntersectionObserverEntry is not correct when {root:document}
     4        https://bugs.webkit.org/show_bug.cgi?id=219495
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/intersection-observer/same-document-with-document-root-expected.txt:
     9
    1102021-01-12  Manuel Rego Casasnovas  <rego@igalia.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/same-document-with-document-root-expected.txt

    r271234 r271433  
    22PASS IntersectionObserver in a single document using document as root.
    33PASS First rAF.
    4 FAIL document.scrollingElement.scrollTop = 300 assert_equals: entries.length expected 2 but got 1
     4PASS document.scrollingElement.scrollTop = 300
    55
  • trunk/Source/WebCore/ChangeLog

    r271425 r271433  
     12021-01-12  Cathie Chen  <cathiechen@igalia.com>
     2
     3        The rootBounds of IntersectionObserverEntry is not correct when {root:document}
     4        https://bugs.webkit.org/show_bug.cgi?id=219495
     5
     6        Reviewed by Darin Adler.
     7
     8        When {root:document}, rootBounds should be the root intersection rectangle which is the document's viewport,
     9        per [1]. The coordinator of rootBounds should be layoutViewportRect, for root intersection rectangle is not affected by pinch zoom [2].
     10
     11        [1] https://www.w3.org/TR/intersection-observer/#dom-intersectionobserverentry-rootbounds
     12        [2] https://w3c.github.io/IntersectionObserver/#intersectionobserver-root-intersection-rectangle
     13
     14        * dom/Document.cpp:
     15        (WebCore::computeIntersectionState):
     16        (WebCore::Document::updateIntersectionObservations):
     17
    1182021-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
    219
  • trunk/Source/WebCore/dom/Document.cpp

    r271418 r271433  
    77237723            return WTF::nullopt;
    77247724
    7725         if (rootRenderer->hasOverflowClip())
     7725        if (observer.root() == &target.document())
     7726            localRootBounds = frameView.layoutViewportRect();
     7727        else if (rootRenderer->hasOverflowClip())
    77267728            localRootBounds = rootRenderer->contentBoxRect();
    77277729        else
     
    78327834                    auto* targetFrameView = target->document().view();
    78337835                    targetBoundingClientRect = targetFrameView->absoluteToClientRect(intersectionState->absoluteTargetRect, target->renderer()->style().effectiveZoom());
    7834                     auto* rootRenderer = observer->root() ? observer->root()->renderer() : frameView->renderView();
    7835                     clientRootBounds = frameView->absoluteToClientRect(intersectionState->absoluteRootBounds, rootRenderer->style().effectiveZoom());
     7836                    clientRootBounds = frameView->absoluteToLayoutViewportRect(intersectionState->absoluteRootBounds);
    78367837                    if (intersectionState->isIntersecting)
    78377838                        clientIntersectionRect = targetFrameView->absoluteToClientRect(intersectionState->absoluteIntersectionRect, target->renderer()->style().effectiveZoom());
Note: See TracChangeset for help on using the changeset viewer.