Title: [102243] trunk/Source/WebCore
Revision
102243
Author
[email protected]
Date
2011-12-07 08:40:31 -0800 (Wed, 07 Dec 2011)

Log Message

Micro-optimize ScrollView::visibleContentRect().
<http://webkit.org/b/74001>

Reviewed by Anders Carlsson.

Reorder the scrollbar exclusion code to minimize the number of virtual calls
to ScrollableArea::verticalScrollbar(), ScrollableArea::horizontalScrollbar()
and Scrollbar::isOverlayScrollbar().

* platform/ScrollView.cpp:
(WebCore::ScrollView::visibleContentRect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102242 => 102243)


--- trunk/Source/WebCore/ChangeLog	2011-12-07 16:16:34 UTC (rev 102242)
+++ trunk/Source/WebCore/ChangeLog	2011-12-07 16:40:31 UTC (rev 102243)
@@ -1,5 +1,19 @@
 2011-12-07  Andreas Kling  <[email protected]>
 
+        Micro-optimize ScrollView::visibleContentRect().
+        <http://webkit.org/b/74001>
+
+        Reviewed by Anders Carlsson.
+
+        Reorder the scrollbar exclusion code to minimize the number of virtual calls
+        to ScrollableArea::verticalScrollbar(), ScrollableArea::horizontalScrollbar()
+        and Scrollbar::isOverlayScrollbar().
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::visibleContentRect):
+
+2011-12-07  Andreas Kling  <[email protected]>
+
         ApplyPropertyBorderImage: Remove unneeded template argument for mapNinePieceImage().
         <http://webkit.org/b/73998>
 

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (102242 => 102243)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2011-12-07 16:16:34 UTC (rev 102242)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2011-12-07 16:40:31 UTC (rev 102243)
@@ -231,11 +231,16 @@
     if (!m_fixedVisibleContentRect.isEmpty())
         return m_fixedVisibleContentRect;
 
-    int verticalScrollbarWidth = verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()
-        && !includeScrollbars ? verticalScrollbar()->width() : 0;
-    int horizontalScrollbarHeight = horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()
-        && !includeScrollbars ? horizontalScrollbar()->height() : 0;
+    int verticalScrollbarWidth = 0;
+    int horizontalScrollbarHeight = 0;
 
+    if (!includeScrollbars) {
+        if (Scrollbar* verticalBar = verticalScrollbar())
+            verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
+        if (Scrollbar* horizontalBar = horizontalScrollbar())
+            horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
+    }
+
     return IntRect(m_scrollOffset.width(),
                    m_scrollOffset.height(),
                    max(0, width() - verticalScrollbarWidth), 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to