[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 14:32:57 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 2ce670ce7f80eedba0080c20f8afa466f68ecb58
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 13 01:05:41 2010 +0000
Paint the find overlay background
https://bugs.webkit.org/show_bug.cgi?id=47565
Reviewed by Dan Bernstein.
WebCore:
Export symbols required by WebKit2.
* WebCore.exp.in:
WebKit2:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::findString):
Don't show the overlay if we have too many matches.
* WebProcess/WebPage/FindPageOverlay.cpp:
(WebKit::FindPageOverlay::rectsForTextMatches):
Get the rects for all text matches.
(WebKit::FindPageOverlay::drawRect):
Assert that we're only being called if there are any text matches.
Paint the background.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69625 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 172060b..55f4ee8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-12 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Paint the find overlay background
+ https://bugs.webkit.org/show_bug.cgi?id=47565
+
+ Export symbols required by WebKit2.
+
+ * WebCore.exp.in:
+
2010-10-12 James Robinson <jamesr at chromium.org>
Unreviewed chromium compile fixes for http://trac.webkit.org/changeset/69619
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index e382a1b..8b15968 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -346,8 +346,12 @@ __ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
__ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
__ZN7WebCore15FocusController9setActiveEb
__ZN7WebCore15GraphicsContext12setFillColorERKNS_5ColorENS_10ColorSpaceE
+__ZN7WebCore15GraphicsContext20endTransparencyLayerEv
+__ZN7WebCore15GraphicsContext21setCompositeOperationENS_17CompositeOperatorE
+__ZN7WebCore15GraphicsContext22beginTransparencyLayerEf
__ZN7WebCore15GraphicsContext4clipERKNS_9FloatRectE
__ZN7WebCore15GraphicsContext4saveEv
+__ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectERKNS_5ColorENS_10ColorSpaceE
__ZN7WebCore15GraphicsContext7restoreEv
__ZN7WebCore15GraphicsContext9translateEff
__ZN7WebCore15GraphicsContextC1EP9CGContext
@@ -1058,6 +1062,7 @@ __ZNK7WebCore6Widget23convertToContainingViewERKNS_8IntPointE
__ZNK7WebCore6Widget25convertFromContainingViewERKNS_7IntRectE
__ZNK7WebCore6Widget25convertFromContainingViewERKNS_8IntPointE
__ZNK7WebCore6Widget25convertToContainingWindowERKNS_7IntRectE
+__ZNK7WebCore6Widget25convertToContainingWindowERKNS_8IntPointE
__ZNK7WebCore6Widget9frameRectEv
__ZNK7WebCore7Element12getAttributeERKNS_13QualifiedNameE
__ZNK7WebCore7Element9innerTextEv
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 178d33c..8b45846 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-12 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Paint the find overlay background
+ https://bugs.webkit.org/show_bug.cgi?id=47565
+
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::FindController::findString):
+ Don't show the overlay if we have too many matches.
+
+ * WebProcess/WebPage/FindPageOverlay.cpp:
+ (WebKit::FindPageOverlay::rectsForTextMatches):
+ Get the rects for all text matches.
+
+ (WebKit::FindPageOverlay::drawRect):
+ Assert that we're only being called if there are any text matches.
+ Paint the background.
+
2010-10-12 Sam Weinig <sam at webkit.org>
Reviewed by Dan Bernstein.
diff --git a/WebKit2/WebProcess/WebPage/FindController.cpp b/WebKit2/WebProcess/WebPage/FindController.cpp
index cfcc044..2c0272c 100644
--- a/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -52,7 +52,8 @@ static Frame* frameWithSelection(Page* page)
void FindController::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxNumMatches)
{
- bool found = m_webPage->corePage()->findString(string, (findOptions & FindOptionsCaseInsensitive) ? TextCaseInsensitive : TextCaseSensitive,
+ TextCaseSensitivity caseSensitivity = findOptions & FindOptionsCaseInsensitive ? TextCaseInsensitive : TextCaseSensitive;
+ bool found = m_webPage->corePage()->findString(string, caseSensitivity,
findDirection == FindDirectionForward ? WebCore::FindDirectionForward : WebCore::FindDirectionBackward,
findOptions & FindOptionsWrapAround);
@@ -68,9 +69,15 @@ void FindController::findString(const String& string, FindDirection findDirectio
if (selectedFrame)
selectedFrame->selection()->clear();
} else {
- // FIXME: We need to show the find indicator here.
-
shouldShowOverlay = findOptions & FindOptionsShowOverlay;
+
+ if (shouldShowOverlay) {
+ unsigned numMatches = m_webPage->corePage()->markAllMatchesForText(string, caseSensitivity, false, maxNumMatches);
+
+ // Check if we have more matches than allowed.
+ if (numMatches > maxNumMatches)
+ shouldShowOverlay = false;
+ }
}
if (!shouldShowOverlay) {
diff --git a/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp b/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
index f6948dd..a5c5705 100644
--- a/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
+++ b/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
@@ -26,7 +26,11 @@
#include "FindPageOverlay.h"
#include "FindController.h"
+#include "WebPage.h"
+#include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
#include <WebCore/GraphicsContext.h>
+#include <WebCore/Page.h>
using namespace WebCore;
@@ -47,10 +51,67 @@ FindPageOverlay::~FindPageOverlay()
m_findController->findPageOverlayDestroyed();
}
-void FindPageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
+Vector<IntRect> FindPageOverlay::rectsForTextMatches()
+{
+ Vector<IntRect> rects;
+
+ for (Frame* frame = webPage()->corePage()->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ Document* document = frame->document();
+ if (!document)
+ continue;
+
+ IntRect visibleRect = frame->view()->visibleContentRect();
+ Vector<IntRect> frameRects = document->markers()->renderedRectsForMarkers(DocumentMarker::TextMatch);
+ IntPoint frameOffset(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height());
+ frameOffset = frame->view()->convertToContainingWindow(frameOffset);
+
+ for (Vector<IntRect>::iterator it = frameRects.begin(), end = frameRects.end(); it != end; ++it) {
+ it->intersect(visibleRect);
+ it->move(frameOffset.x(), frameOffset.y());
+ rects.append(*it);
+ }
+ }
+
+ return rects;
+}
+
+static const int overlayBackgroundRed = 25;
+static const int overlayBackgroundGreen = 25;
+static const int overlayBackgroundBlue = 25;
+static const int overlayBackgroundAlpha = 63;
+
+static Color overlayBackgroundColor()
{
- // FIXME: Draw something.
+ return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha);
}
+
+void FindPageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
+{
+ Vector<IntRect> rects = rectsForTextMatches();
+ ASSERT(!rects.isEmpty());
+
+ FrameView* frameView = webPage()->corePage()->mainFrame()->view();
+
+ int width = frameView->width();
+ if (frameView->verticalScrollbar())
+ width -= frameView->verticalScrollbar()->width();
+ int height = frameView->height();
+ if (frameView->horizontalScrollbar())
+ height -= frameView->horizontalScrollbar()->height();
+
+ IntRect paintRect = intersection(dirtyRect, IntRect(0, 0, width, height));
+ if (paintRect.isEmpty())
+ return;
+ graphicsContext.beginTransparencyLayer(1);
+ graphicsContext.setCompositeOperation(CompositeCopy);
+
+ // Draw the background.
+ graphicsContext.fillRect(paintRect, overlayBackgroundColor(), sRGBColorSpace);
+
+ // FIXME: Draw the holes.
+
+ graphicsContext.endTransparencyLayer();
+}
} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/FindPageOverlay.h b/WebKit2/WebProcess/WebPage/FindPageOverlay.h
index 5c99be3..f5be864 100644
--- a/WebKit2/WebProcess/WebPage/FindPageOverlay.h
+++ b/WebKit2/WebProcess/WebPage/FindPageOverlay.h
@@ -28,6 +28,7 @@
#include "PageOverlay.h"
#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
namespace WebKit {
@@ -41,6 +42,8 @@ public:
private:
explicit FindPageOverlay(FindController*);
+ Vector<WebCore::IntRect> rectsForTextMatches();
+
// PageOverlay.
virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
diff --git a/WebKit2/WebProcess/WebPage/PageOverlay.h b/WebKit2/WebProcess/WebPage/PageOverlay.h
index 69c4783..9844c3a 100644
--- a/WebKit2/WebProcess/WebPage/PageOverlay.h
+++ b/WebKit2/WebProcess/WebPage/PageOverlay.h
@@ -50,6 +50,8 @@ public:
protected:
PageOverlay();
+ WebPage* webPage() const { return m_webPage; }
+
private:
WebPage* m_webPage;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list