Changeset 150529 in webkit


Ignore:
Timestamp:
May 22, 2013 12:06:09 PM (11 years ago)
Author:
Simon Fraser
Message:

New Flickr doesn't get fast scrolling but should
https://bugs.webkit.org/show_bug.cgi?id=116514

Source/WebCore:

Reviewed by Darin Adler.

RenderObject increments and decrements a counter of slow repaint objects on
FrameView when it sees style changes related to background-attachment:fixed.
However, it omitted to decrement the count when a renderer with a fixed background
was destroyed.

This caused Flickr to never fall into fast scrolling mode, since it toggled
display:none on an element with a fixed background during loading, then removed
the fixed background.

Did some minor cleanup of #ENABLE(FAST_MOBILE_SCROLLING) crap.

Tests: platform/mac-wk2/tiled-drawing/slow-scrolling-background-toggle.html

platform/mac-wk2/tiled-drawing/slow-scrolling-hidden-background-toggle.html
platform/mac-wk2/tiled-drawing/slow-scrolling.html

  • rendering/RenderObject.cpp:

(WebCore::shouldRepaintFixedBackgroundsOnScroll):
(WebCore::RenderObject::styleWillChange):
(WebCore::RenderObject::willBeRemovedFromTree):

LayoutTests:

Reviewed by Darin Adler.

slow-scrolling-hidden-background-toggle.html actually tests this patch. The other
two tests were added because there appear to be no tests for basic internals.mainThreadScrollingReasons()
functionality.

  • platform/mac-wk2/tiled-drawing/slow-scrolling-background-toggle-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/slow-scrolling-background-toggle.html: Added.
  • platform/mac-wk2/tiled-drawing/slow-scrolling-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/slow-scrolling-hidden-background-toggle-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/slow-scrolling-hidden-background-toggle.html: Added.
  • platform/mac-wk2/tiled-drawing/slow-scrolling.html: Added.
Location:
trunk
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r150527 r150529  
     12013-05-22  Simon Fraser  <simon.fraser@apple.com>
     2
     3        New Flickr doesn't get fast scrolling but should
     4        https://bugs.webkit.org/show_bug.cgi?id=116514
     5
     6        Reviewed by Darin Adler.
     7       
     8        slow-scrolling-hidden-background-toggle.html actually tests this patch. The other
     9        two tests were added because there appear to be no tests for basic internals.mainThreadScrollingReasons()
     10        functionality.
     11
     12        * platform/mac-wk2/tiled-drawing/slow-scrolling-background-toggle-expected.txt: Added.
     13        * platform/mac-wk2/tiled-drawing/slow-scrolling-background-toggle.html: Added.
     14        * platform/mac-wk2/tiled-drawing/slow-scrolling-expected.txt: Added.
     15        * platform/mac-wk2/tiled-drawing/slow-scrolling-hidden-background-toggle-expected.txt: Added.
     16        * platform/mac-wk2/tiled-drawing/slow-scrolling-hidden-background-toggle.html: Added.
     17        * platform/mac-wk2/tiled-drawing/slow-scrolling.html: Added.
     18
    1192013-05-22  Robert Hogan  <robert@webkit.org>
    220
  • trunk/Source/WebCore/ChangeLog

    r150527 r150529  
     12013-05-22  Simon Fraser  <simon.fraser@apple.com>
     2
     3        New Flickr doesn't get fast scrolling but should
     4        https://bugs.webkit.org/show_bug.cgi?id=116514
     5
     6        Reviewed by Darin Adler.
     7       
     8        RenderObject increments and decrements a counter of slow repaint objects on
     9        FrameView when it sees style changes related to background-attachment:fixed.
     10        However, it omitted to decrement the count when a renderer with a fixed background
     11        was destroyed.
     12       
     13        This caused Flickr to never fall into fast scrolling mode, since it toggled
     14        display:none on an element with a fixed background during loading, then removed
     15        the fixed background.
     16       
     17        Did some minor cleanup of #ENABLE(FAST_MOBILE_SCROLLING) crap.
     18
     19        Tests: platform/mac-wk2/tiled-drawing/slow-scrolling-background-toggle.html
     20               platform/mac-wk2/tiled-drawing/slow-scrolling-hidden-background-toggle.html
     21               platform/mac-wk2/tiled-drawing/slow-scrolling.html
     22
     23        * rendering/RenderObject.cpp:
     24        (WebCore::shouldRepaintFixedBackgroundsOnScroll):
     25        (WebCore::RenderObject::styleWillChange):
     26        (WebCore::RenderObject::willBeRemovedFromTree):
     27
    1282013-05-22  Robert Hogan  <robert@webkit.org>
    229
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r150527 r150529  
    121121
    122122COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObject_should_stay_small);
     123
     124// On low-powered/mobile devices, preventing blitting on a scroll can cause noticeable delays
     125// when scrolling a page with a fixed background image. As an optimization, assuming there are
     126// no fixed positoned elements on the page, we can acclerate scrolling (via blitting) if we
     127// ignore the CSS property "background-attachment: fixed".
     128static bool shouldRepaintFixedBackgroundsOnScroll(FrameView* frameView)
     129{
     130#if !ENABLE(FAST_MOBILE_SCROLLING) && !PLATFORM(QT)
     131    UNUSED_PARAM(frameView);
     132#endif
     133
     134    bool repaintFixedBackgroundsOnScroll = true;
     135#if ENABLE(FAST_MOBILE_SCROLLING)
     136#if PLATFORM(QT)
     137    if (frameView->delegatesScrolling())
     138        repaintFixedBackgroundsOnScroll = false;
     139#else
     140    repaintFixedBackgroundsOnScroll = false;
     141#endif
     142#endif
     143    return repaintFixedBackgroundsOnScroll;
     144}
    123145
    124146bool RenderObject::s_affectsParentBlock = false;
     
    19371959    }
    19381960
    1939     if (view()->frameView()) {
    1940         bool shouldBlitOnFixedBackgroundImage = false;
    1941 #if ENABLE(FAST_MOBILE_SCROLLING)
    1942         // On low-powered/mobile devices, preventing blitting on a scroll can cause noticeable delays
    1943         // when scrolling a page with a fixed background image. As an optimization, assuming there are
    1944         // no fixed positoned elements on the page, we can acclerate scrolling (via blitting) if we
    1945         // ignore the CSS property "background-attachment: fixed".
    1946 #if PLATFORM(QT)
    1947         if (view()->frameView()->delegatesScrolling())
    1948 #endif
    1949             shouldBlitOnFixedBackgroundImage = true;
    1950 #endif
    1951 
    1952         bool newStyleSlowScroll = newStyle && !shouldBlitOnFixedBackgroundImage && newStyle->hasFixedBackgroundImage();
    1953         bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage();
     1961    if (FrameView* frameView = view()->frameView()) {
     1962        bool repaintFixedBackgroundsOnScroll = shouldRepaintFixedBackgroundsOnScroll(frameView);
     1963
     1964        bool newStyleSlowScroll = newStyle && repaintFixedBackgroundsOnScroll && newStyle->hasFixedBackgroundImage();
     1965        bool oldStyleSlowScroll = m_style && repaintFixedBackgroundsOnScroll && m_style->hasFixedBackgroundImage();
    19541966
    19551967#if USE(ACCELERATED_COMPOSITING)
    19561968        bool drawsRootBackground = isRoot() || (isBody() && !rendererHasBackground(document()->documentElement()->renderer()));
    1957         if (drawsRootBackground && !shouldBlitOnFixedBackgroundImage) {
     1969        if (drawsRootBackground && repaintFixedBackgroundsOnScroll) {
    19581970            if (view()->compositor()->supportsFixedRootBackgroundCompositing()) {
    19591971                if (newStyleSlowScroll && newStyle->hasEntirelyFixedBackground())
     
    19671979        if (oldStyleSlowScroll != newStyleSlowScroll) {
    19681980            if (oldStyleSlowScroll)
    1969                 view()->frameView()->removeSlowRepaintObject();
     1981                frameView->removeSlowRepaintObject();
     1982
    19701983            if (newStyleSlowScroll)
    1971                 view()->frameView()->addSlowRepaintObject();
     1984                frameView->addSlowRepaintObject();
    19721985        }
    19731986    }
     
    25112524{
    25122525    // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removals which would need to be fixed first.
     2526
     2527    if (FrameView* frameView = view()->frameView()) {
     2528        bool repaintFixedBackgroundsOnScroll = shouldRepaintFixedBackgroundsOnScroll(frameView);
     2529        if (repaintFixedBackgroundsOnScroll && m_style && m_style->hasFixedBackgroundImage())
     2530            frameView->removeSlowRepaintObject();
     2531    }
    25132532
    25142533    // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
Note: See TracChangeset for help on using the changeset viewer.