Changeset 237737 in webkit


Ignore:
Timestamp:
Nov 2, 2018 9:55:13 AM (5 years ago)
Author:
ajuma@chromium.org
Message:

Allow cross-document intersection observing
https://bugs.webkit.org/show_bug.cgi?id=165746

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Update expectations for tests that now pass.

  • web-platform-tests/intersection-observer/client-rect-expected.txt:
  • web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt:
  • web-platform-tests/intersection-observer/iframe-no-root-expected.txt:
  • web-platform-tests/intersection-observer/timestamp-expected.txt:

Source/WebCore:

Add logic to compute the intersection between the viewport and an element in a
subframe.

Add a FloatRect version of ScrollView::rootViewToContents, and FloatRect versions
of the methods it calls.

Test: http/tests/intersection-observer/intermediate-frame-changes.html
Also covered by rebased tests in imported/w3c/web-platform-tests/intersection-observer.

  • dom/Document.cpp:

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

  • page/FrameView.cpp:

(WebCore::FrameView::viewportContentsChanged):
(WebCore::FrameView::convertFromContainingViewToRenderer const):
(WebCore::FrameView::convertFromContainingView const):

  • page/FrameView.h:
  • platform/ScrollView.cpp:

(WebCore::ScrollView::viewToContents const):
(WebCore::ScrollView::contentsToView const):
(WebCore::ScrollView::rootViewToContents const):

  • platform/ScrollView.h:
  • platform/Widget.cpp:

(WebCore::Widget::convertFromRootView const):
(WebCore::Widget::convertFromContainingView const):

  • platform/Widget.h:

LayoutTests:

Add a test that cross-document intersection observations are triggered when an intermediate frame
scrolls. Skip the test on WK1 platforms where IntersectionObserver is not supported.

Add platform-specific baselines for tests involving iframe scrolling, which isn't supported on iOS.

  • http/tests/intersection-observer/intermediate-frame-changes-expected.txt: Added.
  • http/tests/intersection-observer/intermediate-frame-changes.html: Added.
  • http/tests/intersection-observer/resources/intermediate-frame.html: Added.
  • http/tests/intersection-observer/resources/nested-frame.html: Added.
  • platform/ios/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt.
  • platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt.
  • platform/mac-wk1/TestExpectations:
  • platform/win/TestExpectations:
  • platform/wincairo/TestExpectations:
Location:
trunk
Files:
7 added
17 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r237733 r237737  
     12018-11-02  Ali Juma  <ajuma@chromium.org>
     2
     3        Allow cross-document intersection observing
     4        https://bugs.webkit.org/show_bug.cgi?id=165746
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add a test that cross-document intersection observations are triggered when an intermediate frame
     9        scrolls. Skip the test on WK1 platforms where IntersectionObserver is not supported.
     10
     11        Add platform-specific baselines for tests involving iframe scrolling, which isn't supported on iOS.
     12
     13        * http/tests/intersection-observer/intermediate-frame-changes-expected.txt: Added.
     14        * http/tests/intersection-observer/intermediate-frame-changes.html: Added.
     15        * http/tests/intersection-observer/resources/intermediate-frame.html: Added.
     16        * http/tests/intersection-observer/resources/nested-frame.html: Added.
     17        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt.
     18        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt.
     19        * platform/mac-wk1/TestExpectations:
     20        * platform/win/TestExpectations:
     21        * platform/wincairo/TestExpectations:
     22
    1232018-11-02  Per Arne Vollan  <pvollan@apple.com>
    224
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r237702 r237737  
     12018-11-02  Ali Juma  <ajuma@chromium.org>
     2
     3        Allow cross-document intersection observing
     4        https://bugs.webkit.org/show_bug.cgi?id=165746
     5
     6        Reviewed by Simon Fraser.
     7
     8        Update expectations for tests that now pass.
     9
     10        * web-platform-tests/intersection-observer/client-rect-expected.txt:
     11        * web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt:
     12        * web-platform-tests/intersection-observer/iframe-no-root-expected.txt:
     13        * web-platform-tests/intersection-observer/timestamp-expected.txt:
     14
    1152018-11-01  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/client-rect-expected.txt

    r235014 r237737  
    11
    22PASS IntersectionObserverEntry.boundingClientRect should match target.boundingClientRect()
    3 FAIL First rAF should generate notification. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0
     3PASS First rAF should generate notification.
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe-expected.txt

    r235014 r237737  
    44PASS First rAF
    55PASS topDocument.scrollingElement.scrollTop = 200
    6 FAIL iframeDocument.scrollingElement.scrollTop = 250 assert_equals: expected 1 but got 0
    7 FAIL topDocument.scrollingElement.scrollTop = 100 assert_equals: expected 1 but got 0
     6PASS iframeDocument.scrollingElement.scrollTop = 250
     7PASS topDocument.scrollingElement.scrollTop = 100
    88
  • trunk/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt

    r235014 r237737  
    22
    33PASS Observer with the implicit root; target in a same-origin iframe.
    4 FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0
     4PASS First rAF.
    55PASS document.scrollingElement.scrollTop = 200
    6 FAIL iframe.contentDocument.scrollingElement.scrollTop = 250 assert_equals: entries.length expected 2 but got 1
    7 FAIL document.scrollingElement.scrollTop = 100 assert_equals: entries.length expected 3 but got 1
     6PASS iframe.contentDocument.scrollingElement.scrollTop = 250
     7PASS document.scrollingElement.scrollTop = 100
    88
  • trunk/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/timestamp-expected.txt

    r235014 r237737  
    33PASS Check that timestamps correspond to the to execution context that created the observer.
    44PASS First rAF after iframe is loaded.
    5 FAIL Generate notifications. undefined is not an object (evaluating 'topWindowEntries[1].time')
     5PASS Generate notifications.
    66
  • trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt

    r237735 r237737  
    22
    33PASS Observer with the implicit root; target in a same-origin iframe.
    4 FAIL First rAF. assert_equals: entries[0].boundingClientRect.left expected 8 but got 0
     4PASS First rAF.
    55PASS document.scrollingElement.scrollTop = 200
    66FAIL iframe.contentDocument.scrollingElement.scrollTop = 250 assert_equals: entries.length expected 2 but got 1
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r237698 r237737  
    532532
    533533# Not supported on WK1
     534http/tests/intersection-observer [ Skip ]
    534535imported/w3c/web-platform-tests/intersection-observer [ Skip ]
    535536intersection-observer [ Skip ]
  • trunk/LayoutTests/platform/win/TestExpectations

    r237733 r237737  
    134134# IntersectionObserver is off by default
    135135webkit.org/b/188613 intersection-observer [ Skip ]
     136webkit.org/b/188613 http/tests/intersection-observer [ Skip ]
    136137
    137138# TODO Should be moved to platform/mac <rdar://5621425>
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r237701 r237737  
    14641464# IntersectionObserver is off by default
    14651465webkit.org/b/188613 intersection-observer [ Skip ]
     1466webkit.org/b/188613 http/tests/intersection-observer [ Skip ]
    14661467
    14671468[ Debug ] css2.1/20110323/replaced-intrinsic-ratio-001.htm [ Pass Failure ]
  • trunk/Source/WebCore/ChangeLog

    r237732 r237737  
     12018-11-02  Ali Juma  <ajuma@chromium.org>
     2
     3        Allow cross-document intersection observing
     4        https://bugs.webkit.org/show_bug.cgi?id=165746
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add logic to compute the intersection between the viewport and an element in a
     9        subframe.
     10
     11        Add a FloatRect version of ScrollView::rootViewToContents, and FloatRect versions
     12        of the methods it calls.
     13
     14        Test: http/tests/intersection-observer/intermediate-frame-changes.html
     15        Also covered by rebased tests in imported/w3c/web-platform-tests/intersection-observer.
     16
     17        * dom/Document.cpp:
     18        (WebCore::computeClippedRectInRootContentsSpace):
     19        (WebCore::computeIntersectionState):
     20        (WebCore::Document::updateIntersectionObservations):
     21        * page/FrameView.cpp:
     22        (WebCore::FrameView::viewportContentsChanged):
     23        (WebCore::FrameView::convertFromContainingViewToRenderer const):
     24        (WebCore::FrameView::convertFromContainingView const):
     25        * page/FrameView.h:
     26        * platform/ScrollView.cpp:
     27        (WebCore::ScrollView::viewToContents const):
     28        (WebCore::ScrollView::contentsToView const):
     29        (WebCore::ScrollView::rootViewToContents const):
     30        * platform/ScrollView.h:
     31        * platform/Widget.cpp:
     32        (WebCore::Widget::convertFromRootView const):
     33        (WebCore::Widget::convertFromContainingView const):
     34        * platform/Widget.h:
     35
    1362018-11-02  Rob Buis  <rbuis@igalia.com>
    237
  • trunk/Source/WebCore/dom/Document.cpp

    r237677 r237737  
    76047604}
    76057605
     7606static std::optional<LayoutRect> computeClippedRectInRootContentsSpace(const LayoutRect& rect, const RenderElement* renderer)
     7607{
     7608    OptionSet<RenderObject::VisibleRectContextOption> visibleRectOptions = { RenderObject::VisibleRectContextOption::UseEdgeInclusiveIntersection, RenderObject::VisibleRectContextOption::ApplyCompositedClips, RenderObject::VisibleRectContextOption::ApplyCompositedContainerScrolls };
     7609    std::optional<LayoutRect> rectInFrameAbsoluteSpace = renderer->computeVisibleRectInContainer(rect, &renderer->view(),  {false /* hasPositionFixedDescendant */, false /* dirtyRectIsFlipped */, visibleRectOptions });
     7610    if (!rectInFrameAbsoluteSpace || renderer->frame().isMainFrame())
     7611        return rectInFrameAbsoluteSpace;
     7612
     7613    bool intersects = rectInFrameAbsoluteSpace->edgeInclusiveIntersect(renderer->view().frameView().layoutViewportRect());
     7614    if (!intersects)
     7615        return std::nullopt;
     7616
     7617    LayoutRect rectInFrameViewSpace(renderer->view().frameView().contentsToView(snappedIntRect(*rectInFrameAbsoluteSpace)));
     7618    auto* ownerRenderer = renderer->frame().ownerRenderer();
     7619    if (!ownerRenderer)
     7620        return std::nullopt;
     7621
     7622    rectInFrameViewSpace.moveBy(ownerRenderer->contentBoxLocation());
     7623    return computeClippedRectInRootContentsSpace(rectInFrameViewSpace, ownerRenderer);
     7624}
     7625
    76067626struct IntersectionObservationState {
    76077627    FloatRect absoluteTargetRect;
     
    76117631};
    76127632
    7613 static std::optional<IntersectionObservationState> computeIntersectionState(FrameView& frameView, const IntersectionObserver& observer, Element& target)
    7614 {
    7615     // FIXME: Implement intersection computation for the cross-document case.
    7616     if (observer.trackingDocument() != &target.document())
    7617         return std::nullopt;
    7618 
     7633static std::optional<IntersectionObservationState> computeIntersectionState(FrameView& frameView, const IntersectionObserver& observer, Element& target, bool applyRootMargin)
     7634{
    76197635    auto* targetRenderer = target.renderer();
    76207636    if (!targetRenderer)
     
    76247640    RenderBlock* rootRenderer;
    76257641    if (observer.root()) {
     7642        if (observer.trackingDocument() != &target.document())
     7643            return std::nullopt;
     7644
    76267645        if (!observer.root()->renderer() || !is<RenderBlock>(observer.root()->renderer()))
    76277646            return std::nullopt;
     
    76377656    } else {
    76387657        ASSERT(frameView.frame().isMainFrame());
     7658        // FIXME: Handle the case of an implicit-root observer that has a target in a different frame tree.
     7659        if (&targetRenderer->frame().mainFrame() != &frameView.frame())
     7660            return std::nullopt;
    76397661        rootRenderer = frameView.renderView();
    76407662        localRootBounds = frameView.layoutViewportRect();
    76417663    }
    76427664
    7643     expandRootBoundsWithRootMargin(localRootBounds, observer.rootMarginBox());
     7665    if (applyRootMargin)
     7666        expandRootBoundsWithRootMargin(localRootBounds, observer.rootMarginBox());
    76447667
    76457668    LayoutRect localTargetBounds;
     
    76517674        localTargetBounds = downcast<RenderLineBreak>(targetRenderer)->linesBoundingBox();
    76527675
    7653     OptionSet<RenderObject::VisibleRectContextOption> visibleRectOptions = { RenderObject::VisibleRectContextOption::UseEdgeInclusiveIntersection, RenderObject::VisibleRectContextOption::ApplyCompositedClips, RenderObject::VisibleRectContextOption::ApplyCompositedContainerScrolls };
    7654     std::optional<LayoutRect> rootLocalTargetRect = targetRenderer->computeVisibleRectInContainer(localTargetBounds, rootRenderer, { false /* hasPositionFixedDescendant */, false /* dirtyRectIsFlipped */, visibleRectOptions });
     7676    std::optional<LayoutRect> rootLocalTargetRect;
     7677    if (observer.root()) {
     7678        OptionSet<RenderObject::VisibleRectContextOption> visibleRectOptions = { RenderObject::VisibleRectContextOption::UseEdgeInclusiveIntersection, RenderObject::VisibleRectContextOption::ApplyCompositedClips, RenderObject::VisibleRectContextOption::ApplyCompositedContainerScrolls };
     7679        rootLocalTargetRect = targetRenderer->computeVisibleRectInContainer(localTargetBounds, rootRenderer, { false /* hasPositionFixedDescendant */, false /* dirtyRectIsFlipped */, visibleRectOptions });
     7680    } else
     7681        rootLocalTargetRect = computeClippedRectInRootContentsSpace(localTargetBounds, targetRenderer);
     7682
    76557683    FloatRect rootLocalIntersectionRect = localRootBounds;
    76567684
     
    76587686    intersectionState.isIntersecting = rootLocalTargetRect && rootLocalIntersectionRect.edgeInclusiveIntersect(*rootLocalTargetRect);
    76597687
    7660     if (intersectionState.isIntersecting)
    7661         intersectionState.absoluteIntersectionRect = rootRenderer->localToAbsoluteQuad(rootLocalIntersectionRect).boundingBox();
     7688    if (intersectionState.isIntersecting) {
     7689        FloatRect rootAbsoluteIntersectionRect = rootRenderer->localToAbsoluteQuad(rootLocalIntersectionRect).boundingBox();
     7690        if (&targetRenderer->frame() == &rootRenderer->frame())
     7691            intersectionState.absoluteIntersectionRect = rootAbsoluteIntersectionRect;
     7692        else {
     7693            FloatRect rootViewIntersectionRect = frameView.delegatesScrolling() ? rootAbsoluteIntersectionRect : frameView.contentsToView(rootAbsoluteIntersectionRect);
     7694            intersectionState.absoluteIntersectionRect = targetRenderer->view().frameView().rootViewToContents(rootViewIntersectionRect);
     7695        }
     7696    }
    76627697
    76637698    intersectionState.absoluteTargetRect = targetRenderer->localToAbsoluteQuad(FloatRect(localTargetBounds)).boundingBox();
     
    76917726            auto& registration = targetRegistrations[index];
    76927727
    7693             auto intersectionState = computeIntersectionState(*frameView, *observer, *target);
     7728            bool isSameOriginObservation = &target->document() == this || target->document().securityOrigin().canAccess(securityOrigin());
     7729            auto intersectionState = computeIntersectionState(*frameView, *observer, *target, isSameOriginObservation);
    76947730
    76957731            float intersectionRatio = 0;
     
    77097745            }
    77107746
    7711 
    77127747            if (!registration.previousThresholdIndex || thresholdIndex != registration.previousThresholdIndex) {
    77137748                FloatRect targetBoundingClientRect;
     
    77157750                FloatRect clientRootBounds;
    77167751                if (intersectionState) {
    7717                     targetBoundingClientRect = frameView->absoluteToClientRect(intersectionState->absoluteTargetRect);
     7752                    auto* targetFrameView = target->document().view();
     7753                    targetBoundingClientRect = targetFrameView->absoluteToClientRect(intersectionState->absoluteTargetRect);
    77187754                    clientRootBounds = frameView->absoluteToClientRect(intersectionState->absoluteRootBounds);
    77197755                    if (intersectionState->isIntersecting)
    7720                         clientIntersectionRect = frameView->absoluteToClientRect(intersectionState->absoluteIntersectionRect);
     7756                        clientIntersectionRect = targetFrameView->absoluteToClientRect(intersectionState->absoluteIntersectionRect);
    77217757                }
    77227758
    7723                 // FIXME: Once cross-document observation is implemented, only report root bounds if the target document and
    7724                 // the root document are similar-origin.
    7725                 std::optional<DOMRectInit> reportedRootBounds = DOMRectInit({
    7726                     clientRootBounds.x(),
    7727                     clientRootBounds.y(),
    7728                     clientRootBounds.width(),
    7729                     clientRootBounds.height()
    7730                 });
     7759                std::optional<DOMRectInit> reportedRootBounds;
     7760                if (isSameOriginObservation) {
     7761                    reportedRootBounds = DOMRectInit({
     7762                        clientRootBounds.x(),
     7763                        clientRootBounds.y(),
     7764                        clientRootBounds.width(),
     7765                        clientRootBounds.height()
     7766                    });
     7767                }
    77317768
    77327769                observer->appendQueuedEntry(IntersectionObserverEntry::create({
  • trunk/Source/WebCore/page/FrameView.cpp

    r237468 r237737  
    20102010#if ENABLE(INTERSECTION_OBSERVER)
    20112011    if (auto* document = frame().document()) {
    2012         if (document->numberOfIntersectionObservers()) {
    2013             if (auto* page = frame().page())
     2012        if (auto* page = frame().page()) {
     2013            if (document->numberOfIntersectionObservers())
    20142014                page->addDocumentNeedingIntersectionObservationUpdate(*document);
     2015            if (!frame().isMainFrame()) {
     2016                if (auto* mainDocument = frame().mainFrame().document()) {
     2017                    if (mainDocument->numberOfIntersectionObservers())
     2018                        page->addDocumentNeedingIntersectionObservationUpdate(*mainDocument);
     2019                }
     2020            }
    20152021        }
    20162022    }
     
    45554561}
    45564562
     4563FloatRect FrameView::convertFromContainingViewToRenderer(const RenderElement* renderer, const FloatRect& viewRect) const
     4564{
     4565    FloatRect rect = viewRect;
     4566
     4567    // Convert from FrameView coords into page ("absolute") coordinates.
     4568    if (!delegatesScrolling())
     4569        rect = viewToContents(rect);
     4570
     4571    return (renderer->absoluteToLocalQuad(rect)).boundingBox();
     4572}
     4573
    45574574IntPoint FrameView::convertFromRendererToContainingView(const RenderElement* renderer, const IntPoint& rendererPoint) const
    45584575{
     
    46204637}
    46214638
     4639FloatRect FrameView::convertFromContainingView(const FloatRect& parentRect) const
     4640{
     4641    if (const ScrollView* parentScrollView = parent()) {
     4642        if (is<FrameView>(*parentScrollView)) {
     4643            const FrameView& parentView = downcast<FrameView>(*parentScrollView);
     4644
     4645            // Get our renderer in the parent view
     4646            RenderWidget* renderer = frame().ownerRenderer();
     4647            if (!renderer)
     4648                return parentRect;
     4649
     4650            auto rect = parentView.convertFromContainingViewToRenderer(renderer, parentRect);
     4651            rect.moveBy(-renderer->contentBoxLocation());
     4652            return rect;
     4653        }
     4654
     4655        return Widget::convertFromContainingView(parentRect);
     4656    }
     4657
     4658    return parentRect;
     4659}
     4660
    46224661IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const
    46234662{
  • trunk/Source/WebCore/page/FrameView.h

    r237466 r237737  
    460460    WEBCORE_EXPORT IntRect convertFromRendererToContainingView(const RenderElement*, const IntRect&) const;
    461461    WEBCORE_EXPORT IntRect convertFromContainingViewToRenderer(const RenderElement*, const IntRect&) const;
     462    WEBCORE_EXPORT FloatRect convertFromContainingViewToRenderer(const RenderElement*, const FloatRect&) const;
    462463    WEBCORE_EXPORT IntPoint convertFromRendererToContainingView(const RenderElement*, const IntPoint&) const;
    463464    WEBCORE_EXPORT IntPoint convertFromContainingViewToRenderer(const RenderElement*, const IntPoint&) const;
     
    466467    IntRect convertToContainingView(const IntRect&) const final;
    467468    IntRect convertFromContainingView(const IntRect&) const final;
     469    FloatRect convertFromContainingView(const FloatRect&) const final;
    468470    IntPoint convertToContainingView(const IntPoint&) const final;
    469471    IntPoint convertFromContainingView(const IntPoint&) const final;
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r237266 r237737  
    830830}
    831831
     832FloatRect ScrollView::viewToContents(FloatRect rect) const
     833{
     834    rect.moveBy(documentScrollPositionRelativeToViewOrigin());
     835    return rect;
     836}
     837
    832838IntRect ScrollView::contentsToView(IntRect rect) const
     839{
     840    rect.moveBy(-documentScrollPositionRelativeToViewOrigin());
     841    return rect;
     842}
     843
     844FloatRect ScrollView::contentsToView(FloatRect rect) const
    833845{
    834846    rect.moveBy(-documentScrollPositionRelativeToViewOrigin());
     
    876888
    877889IntRect ScrollView::rootViewToContents(const IntRect& rootViewRect) const
     890{
     891    if (delegatesScrolling())
     892        return convertFromRootView(rootViewRect);
     893
     894    return viewToContents(convertFromRootView(rootViewRect));
     895}
     896
     897FloatRect ScrollView::rootViewToContents(const FloatRect& rootViewRect) const
    878898{
    879899    if (delegatesScrolling())
  • trunk/Source/WebCore/platform/ScrollView.h

    r237266 r237737  
    284284    WEBCORE_EXPORT IntRect rootViewToContents(const IntRect&) const;
    285285    WEBCORE_EXPORT IntRect contentsToRootView(const IntRect&) const;
     286    WEBCORE_EXPORT FloatRect rootViewToContents(const FloatRect&) const;
    286287
    287288    IntPoint viewToContents(const IntPoint&) const;
     
    290291    IntRect viewToContents(IntRect) const;
    291292    IntRect contentsToView(IntRect) const;
     293
     294    FloatRect viewToContents(FloatRect) const;
     295    FloatRect contentsToView(FloatRect) const;
    292296
    293297    IntPoint contentsToContainingViewContents(const IntPoint&) const;
  • trunk/Source/WebCore/platform/Widget.cpp

    r232613 r237737  
    7777}
    7878
     79FloatRect Widget::convertFromRootView(const FloatRect& rootRect) const
     80{
     81    if (const ScrollView* parentScrollView = parent()) {
     82        FloatRect parentRect = parentScrollView->convertFromRootView(rootRect);
     83        return convertFromContainingView(parentRect);
     84    }
     85    return rootRect;
     86}
     87
    7988IntRect Widget::convertToRootView(const IntRect& localRect) const
    8089{
     
    183192}
    184193
     194FloatRect Widget::convertFromContainingView(const FloatRect& parentRect) const
     195{
     196    return convertFromContainingView(IntRect(parentRect));
     197}
     198
    185199IntPoint Widget::convertToContainingView(const IntPoint& localPoint) const
    186200{
  • trunk/Source/WebCore/platform/Widget.h

    r237266 r237737  
    151151    IntRect convertFromRootView(const IntRect&) const;
    152152
     153    FloatRect convertFromRootView(const FloatRect&) const;
     154
    153155    IntPoint convertToRootView(const IntPoint&) const;
    154156    IntPoint convertFromRootView(const IntPoint&) const;
     
    185187    WEBCORE_EXPORT virtual IntRect convertToContainingView(const IntRect&) const;
    186188    WEBCORE_EXPORT virtual IntRect convertFromContainingView(const IntRect&) const;
     189    WEBCORE_EXPORT virtual FloatRect convertFromContainingView(const FloatRect&) const;
    187190    WEBCORE_EXPORT virtual IntPoint convertToContainingView(const IntPoint&) const;
    188191    WEBCORE_EXPORT virtual IntPoint convertFromContainingView(const IntPoint&) const;
Note: See TracChangeset for help on using the changeset viewer.