HostWindow invalidation functions should use root view coordinates
https://bugs.webkit.org/show_bug.cgi?id=72338

Reviewed by Dan Bernstein.

Source/WebCore:

Rename invalidateWindow to invalidateRootView, and invalidateContentsAndWindow
to invalidateContentsAndRootView. Make sure that the rects passed to the renamed functions
are in root view coordinates by changing contentsToWindow calls to contentsToRootView.

In practice this doesn't matter because for all platforms except Mac WebKit1, root view coordinates
and window coordinates are equivalent, and Mac WebKit1 doesn't use these invalidation functions.

* loader/EmptyClients.h:
* page/Chrome.cpp:
(WebCore::Chrome::invalidateRootView):
(WebCore::Chrome::invalidateContentsAndRootView):
* page/Chrome.h:
* page/ChromeClient.h:
* page/Frame.cpp:
(WebCore::Frame::tiledBackingStorePaintEnd):
* page/FrameView.cpp:
(WebCore::FrameView::invalidateRect):
(WebCore::FrameView::scrollContentsFastPath):
* platform/HostWindow.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::rectToCopyOnScroll):
(WebCore::ScrollView::scrollContents):
(WebCore::ScrollView::wheelEvent):
* platform/chromium/FramelessScrollView.cpp:
(WebCore::FramelessScrollView::invalidateRect):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImageChromeClient::invalidateContentsAndRootView):

Source/WebKit/chromium:

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::invalidateRootView):
(WebKit::ChromeClientImpl::invalidateContentsAndRootView):
(WebKit::ChromeClientImpl::invalidateContentsForSlowScroll):
* src/ChromeClientImpl.h:
* src/WebPopupMenuImpl.cpp:
(WebKit::WebPopupMenuImpl::invalidateRootView):
(WebKit::WebPopupMenuImpl::invalidateContentsAndRootView):
(WebKit::WebPopupMenuImpl::invalidateContentsForSlowScroll):
* src/WebPopupMenuImpl.h:

Source/WebKit/efl:

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::invalidateRootView):
(WebCore::ChromeClientEfl::invalidateContentsAndRootView):
(WebCore::ChromeClientEfl::invalidateContentsForSlowScroll):
* WebCoreSupport/ChromeClientEfl.h:

Source/WebKit/gtk:

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::invalidateRootView):
(WebKit::ChromeClient::invalidateContentsAndRootView):
(WebKit::ChromeClient::invalidateContentsForSlowScroll):
* WebCoreSupport/ChromeClientGtk.h:

Source/WebKit/mac:

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::invalidateRootView):
(WebChromeClient::invalidateContentsAndRootView):
(WebChromeClient::invalidateContentsForSlowScroll):

Source/WebKit/qt:

* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::invalidateRootView):
(WebCore::ChromeClientQt::invalidateContentsAndRootView):
(WebCore::ChromeClientQt::invalidateContentsForSlowScroll):
* WebCoreSupport/ChromeClientQt.h:

Source/WebKit/win:

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::invalidateRootView):
(WebChromeClient::invalidateContentsAndRootView):
* WebCoreSupport/WebChromeClient.h:

Source/WebKit/wince:

* WebCoreSupport/ChromeClientWinCE.cpp:
(WebKit::ChromeClientWinCE::invalidateRootView):
(WebKit::ChromeClientWinCE::invalidateContentsAndRootView):
(WebKit::ChromeClientWinCE::invalidateContentsForSlowScroll):
(WebKit::ChromeClientWinCE::scroll):
* WebCoreSupport/ChromeClientWinCE.h:

Source/WebKit/wx:

* WebKitSupport/ChromeClientWx.cpp:
(WebCore::ChromeClientWx::invalidateRootView):
(WebCore::ChromeClientWx::invalidateContentsForSlowScroll):
(WebCore::ChromeClientWx::invalidateContentsAndRootView):
* WebKitSupport/ChromeClientWx.h:

Source/WebKit2:

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::invalidateRootView):
(WebKit::WebChromeClient::invalidateContentsAndRootView):
* WebProcess/WebCoreSupport/WebChromeClient.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100290 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index 5556394..4f2fe46 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -603,7 +603,7 @@
 
 IntRect ScrollView::rectToCopyOnScroll() const
 {
-    IntRect scrollViewRect = convertToContainingWindow(IntRect(0, 0, visibleWidth(), visibleHeight()));
+    IntRect scrollViewRect = convertToRootView(IntRect(0, 0, visibleWidth(), visibleHeight()));
     if (hasOverlayScrollbars()) {
         int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVerticalScrollbar()) ? verticalScrollbar()->width() : 0;
         int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHorizontalScrollbar()) ? horizontalScrollbar()->height() : 0;
@@ -626,8 +626,8 @@
     IntRect updateRect = clipRect;
     updateRect.intersect(scrollViewRect);
 
-    // Invalidate the window (not the backing store).
-    hostWindow()->invalidateWindow(updateRect, false /*immediate*/);
+    // Invalidate the root view (not the backing store).
+    hostWindow()->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.
@@ -636,7 +636,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()->invalidateContentsAndWindow(panScrollIconDirtyRect, false /*immediate*/);
+        hostWindow()->invalidateContentsAndRootView(panScrollIconDirtyRect, false /*immediate*/);
     }
 
     if (canBlitOnScroll()) { // The main frame can just blit the WebView window
@@ -662,15 +662,15 @@
     }
 #endif
     if (!horizontalOverhangRect.isEmpty())
-        hostWindow()->invalidateContentsAndWindow(horizontalOverhangRect, false /*immediate*/);
+        hostWindow()->invalidateContentsAndRootView(horizontalOverhangRect, false /*immediate*/);
     if (!verticalOverhangRect.isEmpty())
-        hostWindow()->invalidateContentsAndWindow(verticalOverhangRect, false /*immediate*/);
+        hostWindow()->invalidateContentsAndRootView(verticalOverhangRect, false /*immediate*/);
 
     // This call will move children with native widgets (plugins) and invalidate them as well.
     frameRectsChanged();
 
     // Now blit the backingstore into the window which should be very fast.
-    hostWindow()->invalidateWindow(IntRect(), true);
+    hostWindow()->invalidateRootView(IntRect(), true);
 }
 
 bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
@@ -929,7 +929,7 @@
     }
 
     if (hostWindow())
-        hostWindow()->invalidateContentsAndWindow(contentsToWindow(paintRect), now /*immediate*/);
+        hostWindow()->invalidateContentsAndRootView(contentsToWindow(paintRect), now /*immediate*/);
 }
 
 IntRect ScrollView::scrollCornerRect() const
@@ -1252,7 +1252,7 @@
         return;
     m_drawPanScrollIcon = true;    
     m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , iconPosition.y() - panIconSizeLength / 2) ;
-    hostWindow()->invalidateContentsAndWindow(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
+    hostWindow()->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
 }
 
 void ScrollView::removePanScrollIcon()
@@ -1260,7 +1260,7 @@
     if (!hostWindow())
         return;
     m_drawPanScrollIcon = false; 
-    hostWindow()->invalidateContentsAndWindow(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
+    hostWindow()->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true /*immediate*/);
 }
 
 void ScrollView::setScrollOrigin(const IntPoint& origin, bool updatePositionAtAll, bool updatePositionSynchronously)