Title: [114778] trunk/Source
Revision
114778
Author
commit-qu...@webkit.org
Date
2012-04-20 14:17:54 -0700 (Fri, 20 Apr 2012)

Log Message

Avoid synchronously recalculating the nonFastScrollableRegion when the ScrollableArea set changes
https://bugs.webkit.org/show_bug.cgi?id=84470

Patch by James Robinson <jam...@chromium.org> on 2012-04-20
Reviewed by Anders Carlsson.

Source/WebCore:

When a scrollable area is added or removed, we shouldn't recalculate the nonFastScrollableRegion synchronously
since this is slow, the RenderObject tree might not be in an up-to-date state, and we'll typically do layout
soon anyway.

* page/FrameView.cpp:
(WebCore::FrameView::addScrollableArea):
(WebCore::FrameView::removeScrollableArea):
* page/scrolling/ScrollingCoordinator.cpp:
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):

Source/WebKit/chromium:

Trigger a layout when a plugin becomes or stops being scrollable so the nonFastScrollableRegion
can be updated.

* src/ScrollbarGroup.cpp:
(WebKit::ScrollbarGroup::scrollbarCreated):
(WebKit::ScrollbarGroup::scrollbarDestroyed):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114777 => 114778)


--- trunk/Source/WebCore/ChangeLog	2012-04-20 21:02:19 UTC (rev 114777)
+++ trunk/Source/WebCore/ChangeLog	2012-04-20 21:17:54 UTC (rev 114778)
@@ -1,3 +1,21 @@
+2012-04-20  James Robinson  <jam...@chromium.org>
+
+        Avoid synchronously recalculating the nonFastScrollableRegion when the ScrollableArea set changes
+        https://bugs.webkit.org/show_bug.cgi?id=84470
+
+        Reviewed by Anders Carlsson.
+
+        When a scrollable area is added or removed, we shouldn't recalculate the nonFastScrollableRegion synchronously
+        since this is slow, the RenderObject tree might not be in an up-to-date state, and we'll typically do layout
+        soon anyway.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::addScrollableArea):
+        (WebCore::FrameView::removeScrollableArea):
+        * page/scrolling/ScrollingCoordinator.cpp:
+        * page/scrolling/ScrollingCoordinator.h:
+        (ScrollingCoordinator):
+
 2012-04-20  Emil A Eklund  <e...@chromium.org>
 
         Fix use of LayoutUnits in DOMNodeHighlighter

Modified: trunk/Source/WebCore/page/FrameView.cpp (114777 => 114778)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-04-20 21:02:19 UTC (rev 114777)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-04-20 21:17:54 UTC (rev 114778)
@@ -3478,11 +3478,6 @@
     if (!m_scrollableAreas)
         m_scrollableAreas = adoptPtr(new ScrollableAreaSet);
     m_scrollableAreas->add(scrollableArea);
-
-    if (Page* page = m_frame->page()) {
-        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
-            scrollingCoordinator->frameViewScrollableAreasDidChange(this);
-    }
 }
 
 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
@@ -3490,11 +3485,6 @@
     if (!m_scrollableAreas)
         return;
     m_scrollableAreas->remove(scrollableArea);
-
-    if (Page* page = m_frame->page()) {
-        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
-            scrollingCoordinator->frameViewScrollableAreasDidChange(this);
-    }
 }
 
 bool FrameView::containsScrollableArea(ScrollableArea* scrollableArea) const

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (114777 => 114778)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-04-20 21:02:19 UTC (rev 114777)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-04-20 21:17:54 UTC (rev 114778)
@@ -156,15 +156,6 @@
 
 }
 
-void ScrollingCoordinator::frameViewScrollableAreasDidChange(FrameView*)
-{
-    ASSERT(isMainThread());
-    ASSERT(m_page);
-
-    Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame()->view());
-    setNonFastScrollableRegion(nonFastScrollableRegion);
-}
-
 void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView*)
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (114777 => 114778)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2012-04-20 21:02:19 UTC (rev 114777)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2012-04-20 21:17:54 UTC (rev 114778)
@@ -72,9 +72,6 @@
     // Should be called whenever the given frame view has been laid out.
     void frameViewLayoutUpdated(FrameView*);
 
-    // Should be called whenever the set of ScrollableAreas inside a FrameView changes.
-    void frameViewScrollableAreasDidChange(FrameView*);
-
     // Should be called whenever a wheel event handler is added or removed in the 
     // frame view's underlying document.
     void frameViewWheelEventHandlerCountChanged(FrameView*);

Modified: trunk/Source/WebKit/chromium/ChangeLog (114777 => 114778)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-04-20 21:02:19 UTC (rev 114777)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-04-20 21:17:54 UTC (rev 114778)
@@ -1,3 +1,17 @@
+2012-04-20  James Robinson  <jam...@chromium.org>
+
+        Avoid synchronously recalculating the nonFastScrollableRegion when the ScrollableArea set changes
+        https://bugs.webkit.org/show_bug.cgi?id=84470
+
+        Reviewed by Anders Carlsson.
+
+        Trigger a layout when a plugin becomes or stops being scrollable so the nonFastScrollableRegion
+        can be updated.
+
+        * src/ScrollbarGroup.cpp:
+        (WebKit::ScrollbarGroup::scrollbarCreated):
+        (WebKit::ScrollbarGroup::scrollbarDestroyed):
+
 2012-04-20  Dana Jansens  <dan...@chromium.org>
 
         [chromium] Some filters require inflating damage rect in CCDamageTracker

Modified: trunk/Source/WebKit/chromium/src/ScrollbarGroup.cpp (114777 => 114778)


--- trunk/Source/WebKit/chromium/src/ScrollbarGroup.cpp	2012-04-20 21:02:19 UTC (rev 114777)
+++ trunk/Source/WebKit/chromium/src/ScrollbarGroup.cpp	2012-04-20 21:17:54 UTC (rev 114778)
@@ -63,8 +63,10 @@
         didAddVerticalScrollbar(scrollbar->scrollbar());
     }
 
-    if (!hadScrollbars)
+    if (!hadScrollbars) {
         m_frameView->addScrollableArea(this);
+        m_frameView->setNeedsLayout();
+    }
 }
 
 void ScrollbarGroup::scrollbarDestroyed(WebScrollbarImpl* scrollbar)
@@ -78,8 +80,10 @@
         m_verticalScrollbar = 0;
     }
 
-    if (!m_horizontalScrollbar && !m_verticalScrollbar)
+    if (!m_horizontalScrollbar && !m_verticalScrollbar) {
         m_frameView->removeScrollableArea(this);
+        m_frameView->setNeedsLayout();
+    }
 }
 
 void ScrollbarGroup::setLastMousePosition(const IntPoint& point)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to