Changeset 225554 in webkit


Ignore:
Timestamp:
Dec 5, 2017 3:30:48 PM (6 years ago)
Author:
Simon Fraser
Message:

Composited frames incorrectly get requestAnimationFrame throttled
https://bugs.webkit.org/show_bug.cgi?id=178396

Reviewed by Zalan Bujtas.

Source/WebCore:

If a composited iframe was inside overflow:scroll, and the overflow was scrolled to the left
further than the window width, then RenderLayer::childrenClipRect() would return an empty rectangle
and we'd incorrectly consider the iframe out of view, and thus throttle its requestAnimationFrame.

childrenClipRect() was taking unscaledDocumentRect(), applying the clip, and then mapping the result
from local to absolute coordinates (which mapped it through the overflow scroll offset). This is incorrect
because it considers the unscaledDocumentRect() to be in local coordinates, which it is not.

Instead, start with the infinite rect, which essentially tells us if we have any clipping, and then
intersect that with the document rect at the end. Something similar is done in other places that call.
calculateRects().

Test: fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::calculateClipRects const):

LayoutTests:

  • fast/animation/request-animation-frame-throttle-inside-overflow-scroll-expected.txt: Added.
  • fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r225546 r225554  
     12017-12-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Composited frames incorrectly get requestAnimationFrame throttled
     4        https://bugs.webkit.org/show_bug.cgi?id=178396
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * fast/animation/request-animation-frame-throttle-inside-overflow-scroll-expected.txt: Added.
     9        * fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html: Added.
     10
    1112017-12-05  Joseph Pecoraro  <pecoraro@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r225552 r225554  
     12017-12-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Composited frames incorrectly get requestAnimationFrame throttled
     4        https://bugs.webkit.org/show_bug.cgi?id=178396
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        If a composited iframe was inside overflow:scroll, and the overflow was scrolled to the left
     9        further than the window width, then RenderLayer::childrenClipRect() would return an empty rectangle
     10        and we'd incorrectly consider the iframe out of view, and thus throttle its requestAnimationFrame.
     11
     12        childrenClipRect() was taking unscaledDocumentRect(), applying the clip, and then mapping the result
     13        from local to absolute coordinates (which mapped it through the overflow scroll offset). This is incorrect
     14        because it considers the unscaledDocumentRect() to be in local coordinates, which it is not.
     15
     16        Instead, start with the infinite rect, which essentially tells us if we have any clipping, and then
     17        intersect that with the document rect at the end. Something similar is done in other places that call.
     18        calculateRects().
     19
     20        Test: fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html
     21
     22        * rendering/RenderLayer.cpp:
     23        (WebCore::RenderLayer::calculateClipRects const):
     24
    1252017-12-05  Michael Saboff  <msaboff@apple.com>
    226
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r225117 r225554  
    56345634    ClipRectsContext clipRectsContext(clippingRootLayer, TemporaryClipRects);
    56355635    // Need to use temporary clip rects, because the value of 'dontClipToOverflow' may be different from the painting path (<rdar://problem/11844909>).
    5636     calculateRects(clipRectsContext, renderer().view().unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, offsetFromAncestor(clipRectsContext.rootLayer));
    5637     return clippingRootLayer->renderer().localToAbsoluteQuad(FloatQuad(foregroundRect.rect())).enclosingBoundingBox();
     5636    calculateRects(clipRectsContext, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, offsetFromAncestor(clipRectsContext.rootLayer));
     5637    if (foregroundRect.rect().isInfinite())
     5638        return renderer().view().unscaledDocumentRect();
     5639
     5640    auto absoluteClippingRect = clippingRootLayer->renderer().localToAbsoluteQuad(FloatQuad(foregroundRect.rect())).enclosingBoundingBox();
     5641    return intersection(absoluteClippingRect, renderer().view().unscaledDocumentRect());
    56385642}
    56395643
Note: See TracChangeset for help on using the changeset viewer.