summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/WebPage/FindController.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebKit2/WebProcess/WebPage/FindController.cpp
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/FindController.cpp')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/FindController.cpp44
1 files changed, 30 insertions, 14 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
index 6b6156934..4918dde36 100644
--- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -33,6 +33,7 @@
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <WebCore/DocumentMarkerController.h>
+#include <WebCore/FloatQuad.h>
#include <WebCore/FocusController.h>
#include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
@@ -89,12 +90,8 @@ static Frame* frameWithSelection(Page* page)
return 0;
}
-void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount)
+void FindController::updateFindUIAfterPageScroll(bool found, const String& string, FindOptions options, unsigned maxMatchCount)
{
- m_webPage->corePage()->unmarkAllTextMatches();
-
- bool found = m_webPage->corePage()->findString(string, core(options));
-
Frame* selectedFrame = frameWithSelection(m_webPage->corePage());
bool shouldShowOverlay = false;
@@ -141,19 +138,27 @@ void FindController::findString(const String& string, FindOptions options, unsig
}
ASSERT(!m_findPageOverlay);
- return;
- }
-
- if (!m_findPageOverlay) {
- RefPtr<PageOverlay> findPageOverlay = PageOverlay::create(this);
- m_findPageOverlay = findPageOverlay.get();
- m_webPage->installPageOverlay(findPageOverlay.release());
} else {
- // The page overlay needs to be repainted.
- m_findPageOverlay->setNeedsDisplay();
+ if (!m_findPageOverlay) {
+ RefPtr<PageOverlay> findPageOverlay = PageOverlay::create(this);
+ m_findPageOverlay = findPageOverlay.get();
+ m_webPage->installPageOverlay(findPageOverlay.release());
+ } else {
+ // The page overlay needs to be repainted.
+ m_findPageOverlay->setNeedsDisplay();
+ }
}
}
+void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount)
+{
+ m_webPage->corePage()->unmarkAllTextMatches();
+
+ bool found = m_webPage->corePage()->findString(string, core(options));
+
+ m_webPage->drawingArea()->dispatchAfterEnsuringUpdatedScrollPosition(bind(&FindController::updateFindUIAfterPageScroll, this, found, string, options, maxMatchCount));
+}
+
void FindController::hideFindUI()
{
if (m_findPageOverlay)
@@ -216,6 +221,7 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve
}
m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, m_webPage->corePage()->deviceScaleFactor(), handle, !isShowingOverlay, shouldAnimate));
+ m_findIndicatorRect = selectionRectInWindowCoordinates;
m_isShowingFindIndicator = true;
return true;
@@ -347,6 +353,16 @@ void FindController::drawRect(PageOverlay* pageOverlay, GraphicsContext& graphic
// Clear out the holes.
for (size_t i = 0; i < rects.size(); ++i)
graphicsContext.fillRect(rects[i]);
+
+ if (!m_isShowingFindIndicator)
+ return;
+
+ if (Frame* selectedFrame = frameWithSelection(m_webPage->corePage())) {
+ IntRect findIndicatorRect = selectedFrame->view()->contentsToWindow(enclosingIntRect(selectedFrame->selection()->bounds()));
+
+ if (findIndicatorRect != m_findIndicatorRect)
+ hideFindIndicator();
+ }
}
bool FindController::mouseEvent(PageOverlay* pageOverlay, const WebMouseEvent& mouseEvent)