Title: [131939] trunk/Source/WebCore
Revision
131939
Author
[email protected]
Date
2012-10-19 13:33:27 -0700 (Fri, 19 Oct 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=99768
We should limit the tile cache coverage when a page can't take 
advantage of fast tile scrolling anyway

Reviewed by Simon Fraser.

When sites can't use fast-scrolling, there is no need to inflate the 
tile cache. In fact, we get a performance boost by keeping it small 
on painting-intensive sites. 

Instead of just looking a whether or not the FrameView 
canHaveScrollbar(), consult 
shouldUpdateScrollLayerPositionOnMainThread().
* page/FrameView.cpp:
(WebCore::FrameView::performPostLayoutTasks):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
        
Expose shouldUpdateScrollLayerPositionOnMainThread().
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::hasNonLayerFixedObjects):
(WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionOnMainThread):
(WebCore):
(WebCore::ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread):
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):

Bug fix. Should be bitwise and.
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::tileCoverageRect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131938 => 131939)


--- trunk/Source/WebCore/ChangeLog	2012-10-19 20:09:36 UTC (rev 131938)
+++ trunk/Source/WebCore/ChangeLog	2012-10-19 20:33:27 UTC (rev 131939)
@@ -1,3 +1,36 @@
+2012-10-19  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=99768
+        We should limit the tile cache coverage when a page can't take 
+        advantage of fast tile scrolling anyway
+
+        Reviewed by Simon Fraser.
+
+        When sites can't use fast-scrolling, there is no need to inflate the 
+        tile cache. In fact, we get a performance boost by keeping it small 
+        on painting-intensive sites. 
+
+        Instead of just looking a whether or not the FrameView 
+        canHaveScrollbar(), consult 
+        shouldUpdateScrollLayerPositionOnMainThread().
+        * page/FrameView.cpp:
+        (WebCore::FrameView::performPostLayoutTasks):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::RenderLayerBacking):
+        
+        Expose shouldUpdateScrollLayerPositionOnMainThread().
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::hasNonLayerFixedObjects):
+        (WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionOnMainThread):
+        (WebCore):
+        (WebCore::ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread):
+        * page/scrolling/ScrollingCoordinator.h:
+        (ScrollingCoordinator):
+
+        Bug fix. Should be bitwise and.
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::tileCoverageRect):
+
 2012-10-19  Mark Lam  <[email protected]>
 
         Added WTF::StackStats mechanism.

Modified: trunk/Source/WebCore/page/FrameView.cpp (131938 => 131939)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-10-19 20:09:36 UTC (rev 131938)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-10-19 20:33:27 UTC (rev 131939)
@@ -2500,8 +2500,14 @@
     }
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (TiledBacking* tiledBacking = this->tiledBacking())
-        tiledBacking->setTileCoverage(canHaveScrollbars() ? TiledBacking::CoverageForScrolling : TiledBacking::CoverageForVisibleArea);
+    if (TiledBacking* tiledBacking = this->tiledBacking()) {
+        if (page) {
+            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) {
+                bool shouldLimitTileCoverage = !canHaveScrollbars() || scrollingCoordinator->shouldUpdateScrollLayerPositionOnMainThread();
+                tiledBacking->setTileCoverage(shouldLimitTileCoverage ? TiledBacking::CoverageForVisibleArea : TiledBacking::CoverageForScrolling);
+            }
+        }
+    }
 #endif
 
     scrollToAnchor();

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (131938 => 131939)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-10-19 20:09:36 UTC (rev 131938)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-10-19 20:33:27 UTC (rev 131939)
@@ -258,7 +258,7 @@
 }
 #endif
 
-bool ScrollingCoordinator::hasNonLayerFixedObjects(FrameView* frameView)
+bool ScrollingCoordinator::hasNonLayerFixedObjects(FrameView* frameView) const
 {
     const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects();
     if (!viewportConstrainedObjects)
@@ -279,7 +279,7 @@
 #endif
 }
 
-void ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread()
+MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() const
 {
     FrameView* frameView = m_page->mainFrame()->view();
 
@@ -296,9 +296,14 @@
     if (m_page->mainFrame()->document()->isImageDocument())
         mainThreadScrollingReasons |= IsImageDocument;
 
-    setShouldUpdateScrollLayerPositionOnMainThread(mainThreadScrollingReasons);
+    return mainThreadScrollingReasons;
 }
 
+void ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread()
+{
+    setShouldUpdateScrollLayerPositionOnMainThread(mainThreadScrollingReasons());
+}
+
 void ScrollingCoordinator::setForceMainThreadScrollLayerPositionUpdates(bool forceMainThreadScrollLayerPositionUpdates)
 {
     if (m_forceMainThreadScrollLayerPositionUpdates == forceMainThreadScrollLayerPositionUpdates)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (131938 => 131939)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2012-10-19 20:09:36 UTC (rev 131938)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2012-10-19 20:33:27 UTC (rev 131939)
@@ -127,6 +127,9 @@
         IsImageDocument = 1 << 4
     };
 
+    MainThreadScrollingReasons mainThreadScrollingReasons() const;
+    bool shouldUpdateScrollLayerPositionOnMainThread() const { return mainThreadScrollingReasons() != 0; }
+
     // These virtual functions are currently unique to Chromium's WebLayer approach. Their meaningful
     // implementations are in ScrollingCoordinatorChromium.
     virtual void frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer*) { }
@@ -148,7 +151,7 @@
     virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*) { }
     virtual void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons) { }
 
-    bool hasNonLayerFixedObjects(FrameView*);
+    bool hasNonLayerFixedObjects(FrameView*) const;
     void updateShouldUpdateScrollLayerPositionOnMainThread();
 
     bool m_forceMainThreadScrollLayerPositionUpdates;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (131938 => 131939)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-10-19 20:09:36 UTC (rev 131938)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-10-19 20:33:27 UTC (rev 131939)
@@ -315,10 +315,10 @@
         // Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height.
         // These values were chosen because it's more common to have tall pages and to scroll vertically,
         // so we keep more tiles above and below the current area.
-        if (m_tileCoverage && CoverageForHorizontalScrolling)
+        if (m_tileCoverage & CoverageForHorizontalScrolling)
             tileCoverageRect.inflateX(tileCoverageRect.width() / 2);
 
-        if (m_tileCoverage && CoverageForVerticalScrolling)
+        if (m_tileCoverage & CoverageForVerticalScrolling)
             tileCoverageRect.inflateY(tileCoverageRect.height());
     }
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (131938 => 131939)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-10-19 20:09:36 UTC (rev 131938)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-10-19 20:33:27 UTC (rev 131939)
@@ -125,7 +125,10 @@
             if (TiledBacking* tiledBacking = m_graphicsLayer->tiledBacking()) {
                 Frame* frame = renderer()->frame();
                 tiledBacking->setIsInWindow(page->isOnscreen());
-                tiledBacking->setTileCoverage(frame->view()->canHaveScrollbars() ? TiledBacking::CoverageForScrolling : TiledBacking::CoverageForVisibleArea);
+                if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) {
+                    bool shouldLimitTileCoverage = !frame->view()->canHaveScrollbars() || scrollingCoordinator->shouldUpdateScrollLayerPositionOnMainThread();
+                    tiledBacking->setTileCoverage(shouldLimitTileCoverage ? TiledBacking::CoverageForVisibleArea : TiledBacking::CoverageForScrolling);
+                }
                 tiledBacking->setScrollingPerformanceLoggingEnabled(frame->settings() && frame->settings()->scrollingPerformanceLoggingEnabled());
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to