Title: [152161] trunk/Source/WebCore
Revision
152161
Author
[email protected]
Date
2013-06-28 04:14:18 -0700 (Fri, 28 Jun 2013)

Log Message

Avoid duplicating hostWindow() call in ScrollView.cpp
https://bugs.webkit.org/show_bug.cgi?id=118168

Patch by Sanghyup Lee <[email protected]> on 2013-06-28
Reviewed by Christophe Dumez.

Remove redundant hostWindow() calls in ScrollView.cpp.

* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollContents):
(WebCore::ScrollView::contentsToScreen):
(WebCore::ScrollView::screenToContents):
(WebCore::ScrollView::repaintContentRectangle):
(WebCore::ScrollView::updateOverhangAreas):
(WebCore::ScrollView::addPanScrollIcon):
(WebCore::ScrollView::removePanScrollIcon):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152160 => 152161)


--- trunk/Source/WebCore/ChangeLog	2013-06-28 11:00:33 UTC (rev 152160)
+++ trunk/Source/WebCore/ChangeLog	2013-06-28 11:14:18 UTC (rev 152161)
@@ -1,3 +1,21 @@
+2013-06-28  Sanghyup Lee  <[email protected]>
+
+        Avoid duplicating hostWindow() call in ScrollView.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=118168
+
+        Reviewed by Christophe Dumez.
+
+        Remove redundant hostWindow() calls in ScrollView.cpp.
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::scrollContents):
+        (WebCore::ScrollView::contentsToScreen):
+        (WebCore::ScrollView::screenToContents):
+        (WebCore::ScrollView::repaintContentRectangle):
+        (WebCore::ScrollView::updateOverhangAreas):
+        (WebCore::ScrollView::addPanScrollIcon):
+        (WebCore::ScrollView::removePanScrollIcon):
+
 2013-06-28  Christophe Dumez  <[email protected]>
 
         Unreviewed, fix GTK build after r152156.

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (152160 => 152161)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2013-06-28 11:00:33 UTC (rev 152160)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2013-06-28 11:14:18 UTC (rev 152161)
@@ -658,7 +658,8 @@
 
 void ScrollView::scrollContents(const IntSize& scrollDelta)
 {
-    if (!hostWindow())
+    HostWindow* window = hostWindow();
+    if (!window)
         return;
 
     // Since scrolling is double buffered, we will be blitting the scroll view's intersection
@@ -669,7 +670,7 @@
     updateRect.intersect(scrollViewRect);
 
     // Invalidate the root view (not the backing store).
-    hostWindow()->invalidateRootView(updateRect, false /*immediate*/);
+    window->invalidateRootView(updateRect, false /*immediate*/);
 
     if (m_drawPanScrollIcon) {
         // FIXME: the pan icon is broken when accelerated compositing is on, since it will draw under the compositing layers.
@@ -678,7 +679,7 @@
         IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x() - (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySquareSizeLength / 2));
         IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation, IntSize(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength));
         panScrollIconDirtyRect.intersect(clipRect);
-        hostWindow()->invalidateContentsAndRootView(panScrollIconDirtyRect, false /*immediate*/);
+        window->invalidateContentsAndRootView(panScrollIconDirtyRect, false /*immediate*/);
     }
 
     if (canBlitOnScroll()) { // The main frame can just blit the WebView window
@@ -698,7 +699,7 @@
     frameRectsChanged();
 
     // Now blit the backingstore into the window which should be very fast.
-    hostWindow()->invalidateRootView(IntRect(), true);
+    window->invalidateRootView(IntRect(), true);
 }
 
 bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
@@ -784,20 +785,22 @@
 
 IntRect ScrollView::contentsToScreen(const IntRect& rect) const
 {
+    HostWindow* window = hostWindow();
     if (platformWidget())
         return platformContentsToScreen(rect);
-    if (!hostWindow())
+    if (!window)
         return IntRect();
-    return hostWindow()->rootViewToScreen(contentsToRootView(rect));
+    return window->rootViewToScreen(contentsToRootView(rect));
 }
 
 IntPoint ScrollView::screenToContents(const IntPoint& point) const
 {
+    HostWindow* window = hostWindow();
     if (platformWidget())
         return platformScreenToContents(point);
-    if (!hostWindow())
+    if (!window)
         return IntPoint();
-    return rootViewToContents(hostWindow()->screenToRootView(point));
+    return rootViewToContents(window->screenToRootView(point));
 }
 
 bool ScrollView::containsScrollbarsAvoidingResizer() const
@@ -967,8 +970,8 @@
         return;
     }
 
-    if (hostWindow())
-        hostWindow()->invalidateContentsAndRootView(contentsToWindow(paintRect), now /*immediate*/);
+    if (HostWindow* window = hostWindow())
+        window->invalidateContentsAndRootView(contentsToWindow(paintRect), now /*immediate*/);
 }
 
 IntRect ScrollView::scrollCornerRect() const
@@ -1161,16 +1164,17 @@
 
 void ScrollView::updateOverhangAreas()
 {
-    if (!hostWindow())
+    HostWindow* window = hostWindow();
+    if (!window)
         return;
 
     IntRect horizontalOverhangRect;
     IntRect verticalOverhangRect;
     calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRect);
     if (!horizontalOverhangRect.isEmpty())
-        hostWindow()->invalidateContentsAndRootView(horizontalOverhangRect, false /*immediate*/);
+        window->invalidateContentsAndRootView(horizontalOverhangRect, false /*immediate*/);
     if (!verticalOverhangRect.isEmpty())
-        hostWindow()->invalidateContentsAndRootView(verticalOverhangRect, false /*immediate*/);
+        window->invalidateContentsAndRootView(verticalOverhangRect, false /*immediate*/);
 }
 
 void ScrollView::paintOverhangAreas(GraphicsContext* context, const IntRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dirtyRect)
@@ -1308,19 +1312,21 @@
 
 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition)
 {
-    if (!hostWindow())
+    HostWindow* window = hostWindow();
+    if (!window)
         return;
     m_drawPanScrollIcon = true;    
     m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , iconPosition.y() - panIconSizeLength / 2) ;
-    hostWindow()->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
+    window->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
 }
 
 void ScrollView::removePanScrollIcon()
 {
-    if (!hostWindow())
+    HostWindow* window = hostWindow();
+    if (!window)
         return;
     m_drawPanScrollIcon = false; 
-    hostWindow()->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
+    window->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
 }
 
 void ScrollView::setScrollOrigin(const IntPoint& origin, bool updatePositionAtAll, bool updatePositionSynchronously)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to