summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/WebPage/FindController.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebKit2/WebProcess/WebPage/FindController.cpp
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/FindController.cpp')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/FindController.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
index 9b8669d..8e9dba7 100644
--- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "FindController.h"
#include "ShareableBitmap.h"
@@ -151,22 +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;
@@ -259,7 +268,6 @@ static Color overlayBackgroundColor()
void FindController::drawRect(PageOverlay*, GraphicsContext& graphicsContext, const IntRect& dirtyRect)
{
Vector<IntRect> rects = rectsForTextMatches();
- ASSERT(!rects.isEmpty());
// Draw the background.
graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(), ColorSpaceSRGB);