2011-02-07 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 00:29:23 +0000 (00:29 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 00:29:23 +0000 (00:29 +0000)
        Reviewed by Darin Adler.

        Find bouncy is missing content on pages with framesets
        https://bugs.webkit.org/show_bug.cgi?id=53958
        <rdar://problem/8904447>

        Fix paint rect computation; FrameView::paint expects the paint rect to be in the
        parent widget's coordinate system.

        * WebProcess/WebPage/FindController.cpp:
        (WebKit::FindController::updateFindIndicator):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77862 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/FindController.cpp

index cbbcdd8bb0a73086933b7412b1442ed96c97861e..fac1318afdbaa7b8c96f0368ba281a1f0eff59b2 100644 (file)
@@ -1,3 +1,17 @@
+2011-02-07  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Find bouncy is missing content on pages with framesets
+        https://bugs.webkit.org/show_bug.cgi?id=53958
+        <rdar://problem/8904447>
+
+        Fix paint rect computation; FrameView::paint expects the paint rect to be in the
+        parent widget's coordinate system.
+
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::updateFindIndicator):
+
 2011-02-07  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Anders Carlsson.
index afe19922d754c8c84761a56bf9fa06ab5d18a685..8e9dba78c1dc6e0309cc6da29415af72517c569d 100644 (file)
@@ -152,25 +152,30 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve
     if (!selectedFrame)
         return false;
 
+    IntRect selectionRect = enclosingIntRect(selectedFrame->selection()->bounds());
+
     // We want the selection rect in window coordinates.
-    IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(enclosingIntRect(selectedFrame->selection()->bounds()));
+    IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(selectionRect);
     
     Vector<FloatRect> textRects;
     selectedFrame->selection()->getClippedVisibleTextRectangles(textRects);
 
     // Create a backing store and paint the find indicator text into it.
-    RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRectInWindowCoordinates.size());
+    RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRect.size());
     if (!findIndicatorTextBackingStore)
         return false;
     
     OwnPtr<GraphicsContext> graphicsContext = findIndicatorTextBackingStore->createGraphicsContext();
 
-    graphicsContext->translate(-selectionRectInWindowCoordinates.x(), -selectionRectInWindowCoordinates.y());
+    IntRect paintRect = selectionRect;
+    paintRect.move(selectedFrame->view()->frameRect().x(), selectedFrame->view()->frameRect().y());
+    paintRect.move(-selectedFrame->view()->scrollOffset());
+
+    graphicsContext->translate(-paintRect.x(), -paintRect.y());
     selectedFrame->view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers);
     selectedFrame->document()->updateLayout();
 
-    graphicsContext->clip(selectionRectInWindowCoordinates);
-    selectedFrame->view()->paint(graphicsContext.get(), selectionRectInWindowCoordinates);
+    selectedFrame->view()->paint(graphicsContext.get(), paintRect);
     selectedFrame->view()->setPaintBehavior(PaintBehaviorNormal);
     
     SharedMemory::Handle handle;