[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:40:32 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 550d42f6604554b331c6a8a183e6f222a665b833
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 15 17:27:12 2010 +0000

    Add a FindIndicator class
    https://bugs.webkit.org/show_bug.cgi?id=47635
    
    Reviewed by Sam Weinig.
    
    WebCore:
    
    Make Gradient.h and Generator.h private headers; they're used by WebKit2.
    
    * WebCore.xcodeproj/project.pbxproj:
    
    WebKit2:
    
    * Shared/BackingStore.h:
    (WebKit::BackingStore::bounds):
    New function that returns the bounds of the backing store.
    
    * UIProcess/API/mac/PageClientImpl.mm:
    (WebKit::PageClientImpl::setFindIndicator):
    Add stub.
    
    * UIProcess/API/qt/qwkpage.cpp:
    (QWKPagePrivate::setFindIndicator):
    Add stub.
    
    * UIProcess/FindIndicator.cpp: Added.
    * UIProcess/FindIndicator.h:
    
    * UIProcess/PageClient.h:
    Add setFindIndicator client member function.
    
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::setFindIndicator):
    Call PageClient::setFindIndicator.
    
    * UIProcess/WebPageProxy.messages.in:
    Add a fadeOut boolean to the message.
    
    * UIProcess/win/WebView.cpp:
    (WebKit::WebView::setFindIndicator):
    Add stub.
    
    * UIProcess/win/WebView.h:
    * WebKit2.pro:
    * WebKit2.xcodeproj/project.pbxproj:
    * WebProcess/WebPage/FindController.cpp:
    (WebKit::FindController::findString):
    (WebKit::FindController::updateFindIndicator):
    (WebKit::FindController::resetFindIndicator):
    * WebProcess/WebPage/FindController.h:
    * win/WebKit2.vcproj:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69862 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 92f887e..7a380fe 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-13  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Add a FindIndicator class
+        https://bugs.webkit.org/show_bug.cgi?id=47635
+
+        Make Gradient.h and Generator.h private headers; they're used by WebKit2.
+
+        * WebCore.xcodeproj/project.pbxproj:
+
 2010-10-15  Sergio Villar Senin  <svillar at igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 086874e..65aad7d 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -4751,7 +4751,7 @@
 		BC51579F0C03BBD3008BB0EE /* DOMHTMLMarqueeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5156E50C03B741008BB0EE /* DOMHTMLMarqueeElement.h */; };
 		BC5157DD0C03BC22008BB0EE /* DOMHTMLFrameElementPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5156F30C03B7DC008BB0EE /* DOMHTMLFrameElementPrivate.h */; };
 		BC51580B0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */; };
-		BC53C5F50DA56B920021EB5D /* Gradient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53C5F40DA56B920021EB5D /* Gradient.h */; };
+		BC53C5F50DA56B920021EB5D /* Gradient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53C5F40DA56B920021EB5D /* Gradient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC53C6080DA56C570021EB5D /* Gradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC53C6070DA56C570021EB5D /* Gradient.cpp */; };
 		BC53C60B0DA56CF10021EB5D /* GradientCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC53C60A0DA56CF10021EB5D /* GradientCG.cpp */; };
 		BC53C6920DA591140021EB5D /* CSSGradientValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53C6910DA591140021EB5D /* CSSGradientValue.h */; };
@@ -5060,7 +5060,7 @@
 		BCDFD4960E30592F009D10AD /* JSXMLHttpRequestUpload.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDFD4940E30592F009D10AD /* JSXMLHttpRequestUpload.h */; };
 		BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE013980C0BEF180043860A /* JSStyleSheet.cpp */; };
 		BCE0139B0C0BEF180043860A /* JSStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE013990C0BEF180043860A /* JSStyleSheet.h */; };
-		BCE04C8A0DAFF7A0007A0F41 /* Generator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE04C890DAFF7A0007A0F41 /* Generator.h */; };
+		BCE04C8A0DAFF7A0007A0F41 /* Generator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE04C890DAFF7A0007A0F41 /* Generator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BCE04C940DAFF902007A0F41 /* GeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE04C930DAFF902007A0F41 /* GeneratedImage.cpp */; };
 		BCE1C41B0D982980003B02F2 /* Location.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE1C4190D982980003B02F2 /* Location.h */; };
 		BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C41A0D982980003B02F2 /* Location.cpp */; };
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index affda32..26c5619 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,49 @@
+2010-10-13  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Add a FindIndicator class
+        https://bugs.webkit.org/show_bug.cgi?id=47635
+
+        * Shared/BackingStore.h:
+        (WebKit::BackingStore::bounds):
+        New function that returns the bounds of the backing store.
+
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::setFindIndicator):
+        Add stub.
+
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPagePrivate::setFindIndicator):
+        Add stub.
+
+        * UIProcess/FindIndicator.cpp: Added.
+        * UIProcess/FindIndicator.h:
+
+        * UIProcess/PageClient.h:
+        Add setFindIndicator client member function.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setFindIndicator):
+        Call PageClient::setFindIndicator.
+
+        * UIProcess/WebPageProxy.messages.in:
+        Add a fadeOut boolean to the message.
+
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::setFindIndicator):
+        Add stub.
+
+        * UIProcess/win/WebView.h:
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::findString):
+        (WebKit::FindController::updateFindIndicator):
+        (WebKit::FindController::resetFindIndicator):
+        * WebProcess/WebPage/FindController.h:
+        * win/WebKit2.vcproj:
+
 2010-10-14  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/Shared/BackingStore.h b/WebKit2/Shared/BackingStore.h
index 414de13..bf00519 100644
--- a/WebKit2/Shared/BackingStore.h
+++ b/WebKit2/Shared/BackingStore.h
@@ -27,7 +27,7 @@
 #define BackingStore_h
 
 #include "SharedMemory.h"
-#include <WebCore/IntSize.h>
+#include <WebCore/IntRect.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -35,7 +35,6 @@
 
 namespace WebCore {
     class GraphicsContext;
-    class IntRect;
 }
 
 namespace WebKit {
@@ -57,6 +56,8 @@ public:
     ~BackingStore();
 
     const WebCore::IntSize& size() const { return m_size; }
+    WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
+
     bool resize(const WebCore::IntSize& size);
 
     // Create a graphics context that can be used to paint into the backing store.
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.h b/WebKit2/UIProcess/API/mac/PageClientImpl.h
index 6b426a6..1d19df2 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -62,6 +62,8 @@ private:
 
     virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
 
+    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
+
 #if USE(ACCELERATED_COMPOSITING)
     void pageDidEnterAcceleratedCompositing();
     void pageDidLeaveAcceleratedCompositing();
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 6e7d0f8..9f01b03 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -225,6 +225,11 @@ void PageClientImpl::didNotHandleKeyEvent(const NativeWebKeyboardEvent&)
 {
 }
 
+void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
+{
+    // FIXME: Implement.
+}
+
 #if USE(ACCELERATED_COMPOSITING)
 void PageClientImpl::pageDidEnterAcceleratedCompositing()
 {
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 5ad7e87..16c6248 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -112,6 +112,10 @@ void QWKPagePrivate::didNotHandleKeyEvent(const NativeWebKeyboardEvent&)
 {
 }
 
+void QWKPagePrivate::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
+{
+}
+
 void QWKPagePrivate::paint(QPainter* painter, QRect area)
 {
     painter->save();
diff --git a/WebKit2/UIProcess/API/qt/qwkpage_p.h b/WebKit2/UIProcess/API/qt/qwkpage_p.h
index a48a0dd..da5e5e4 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -60,6 +60,8 @@ public:
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
     virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&);
 
+    virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
+
     void paint(QPainter* painter, QRect);
 
     void keyPressEvent(QKeyEvent*);
diff --git a/WebKit2/UIProcess/FindIndicator.cpp b/WebKit2/UIProcess/FindIndicator.cpp
new file mode 100644
index 0000000..52f48cb
--- /dev/null
+++ b/WebKit2/UIProcess/FindIndicator.cpp
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "FindIndicator.h"
+
+#include "BackingStore.h"
+#include <WebCore/Gradient.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/IntRect.h>
+#include <WebCore/Path.h>
+
+using namespace WebCore;
+
+static const float cornerRadius = 3.0;
+
+static const float shadowOffsetX = 0.0;
+static const float shadowOffsetY = 1.0;
+static const float shadowBlurRadius = 3.0;
+
+static const int shadowRed = 0;
+static const int shadowGreen = 0;
+static const int shadowBlue = 0;
+static const int shadowAlpha = 204;
+
+static const float lightBorderThickness = 1.0;
+static const float horizontalPaddingInsideLightBorder = 3.0;
+static const float verticalPaddingInsideLightBorder = 1.0;
+
+static const float horizontalBorderInsideShadow = lightBorderThickness + horizontalPaddingInsideLightBorder;
+static const float verticalBorderInsideShadow = lightBorderThickness + verticalPaddingInsideLightBorder;
+
+static const float leftBorderThickness = horizontalBorderInsideShadow + shadowOffsetX + shadowBlurRadius / 2.0;
+static const float topBorderThickness = verticalBorderInsideShadow - shadowOffsetY + shadowBlurRadius / 2.0;
+static const float rightBorderThickness = horizontalBorderInsideShadow - shadowOffsetX + shadowBlurRadius / 2.0;
+static const float bottomBorderThickness = verticalBorderInsideShadow + shadowOffsetY + shadowBlurRadius / 2.0;
+
+static const float horizontalOutsetToCenterOfLightBorder = horizontalBorderInsideShadow - lightBorderThickness / 2.0;
+static const float verticalOutsetToCenterOfLightBorder = verticalBorderInsideShadow - lightBorderThickness / 2.0;
+
+static const int lightBorderRed = 245;
+static const int lightBorderGreen = 230;
+static const int lightBorderBlue = 0;
+static const int lightBorderAlpha = 255;
+
+static const int gradientDarkRed = 237;
+static const int gradientDarkGreen = 204;
+static const int gradientDarkBlue = 0;
+static const int gradientDarkAlpha = 255;
+
+static const int gradientLightRed = 242;
+static const int gradientLightGreen = 239;
+static const int gradientLightBlue = 0;
+static const int gradientLightAlpha = 255;
+
+namespace WebKit {
+
+PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle)
+{
+    RefPtr<BackingStore> contentImage = BackingStore::create(enclosingIntRect(selectionRect).size(), contentImageHandle);
+    if (!contentImage)
+        return 0;
+
+    return adoptRef(new FindIndicator(selectionRect, textRects, contentImage.release()));
+}
+
+FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<BackingStore> contentImage)
+    : m_selectionRect(selectionRect)
+    , m_textRects(textRects)
+    , m_contentImage(contentImage)
+{
+}
+
+FindIndicator::~FindIndicator()
+{
+}
+
+static FloatRect inflateRect(const FloatRect& rect, float inflateX, float inflateY)
+{
+    FloatRect inflatedRect = rect;
+    inflatedRect.inflateX(inflateX);
+    inflatedRect.inflateY(inflateY);
+    
+    return inflatedRect;
+}
+
+FloatRect FindIndicator::frameRect() const
+{
+    return FloatRect(m_selectionRect.x() - leftBorderThickness, m_selectionRect.y() - topBorderThickness,
+                     m_selectionRect.width() + rightBorderThickness + leftBorderThickness,
+                     m_selectionRect.height() + topBorderThickness + bottomBorderThickness);
+}
+
+static Color lightBorderColor()
+{
+    return Color(lightBorderRed, lightBorderGreen, lightBorderBlue, lightBorderAlpha);
+}
+
+static Color shadowColor()
+{
+    return Color(shadowRed, shadowGreen, shadowBlue, shadowAlpha);
+}
+
+static Color gradientLightColor()
+{
+    return Color(gradientLightRed, gradientLightGreen, gradientLightBlue, gradientLightAlpha);
+}
+
+static Color gradientDarkColor()
+{
+    return Color(gradientDarkRed, gradientDarkGreen, gradientDarkBlue, gradientDarkAlpha);
+}
+
+static Path pathWithRoundedRect(const FloatRect& pathRect, float radius)
+{
+    Path path;
+    path.addRoundedRect(pathRect, FloatSize(radius, radius));
+
+    return path;
+}
+    
+void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
+{
+    for (size_t i = 0; i < m_textRects.size(); ++i) {
+        FloatRect textRect = m_textRects[i];
+        textRect.move(leftBorderThickness, topBorderThickness);
+
+        graphicsContext.save();
+        FloatRect outerPathRect = inflateRect(textRect, horizontalOutsetToCenterOfLightBorder, verticalOutsetToCenterOfLightBorder);
+        graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, shadowColor(), sRGBColorSpace);
+        graphicsContext.addPath(pathWithRoundedRect(outerPathRect, cornerRadius));
+        graphicsContext.setFillColor(lightBorderColor(), DeviceColorSpace);
+        graphicsContext.fillPath();
+        graphicsContext.restore();
+
+        graphicsContext.save();
+        FloatRect innerPathRect = inflateRect(textRect, horizontalPaddingInsideLightBorder, verticalPaddingInsideLightBorder);
+        graphicsContext.clip(pathWithRoundedRect(innerPathRect, cornerRadius));
+        RefPtr<Gradient> gradient = Gradient::create(FloatPoint(innerPathRect.x(), innerPathRect.y()), FloatPoint(innerPathRect.x(), innerPathRect.bottom()));
+        gradient->addColorStop(0, gradientLightColor());
+        gradient->addColorStop(1, gradientDarkColor());
+        graphicsContext.setFillGradient(gradient);
+        graphicsContext.fillRect(outerPathRect);
+        graphicsContext.restore();
+
+        graphicsContext.save();
+        graphicsContext.translate(FloatSize(roundf(leftBorderThickness), roundf(topBorderThickness) + m_contentImage->bounds().height()));
+        graphicsContext.scale(FloatSize(1, -1));
+        m_contentImage->paint(&graphicsContext, m_contentImage->bounds());
+        graphicsContext.restore();
+    }
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/FindIndicator.h b/WebKit2/UIProcess/FindIndicator.h
new file mode 100644
index 0000000..3220193
--- /dev/null
+++ b/WebKit2/UIProcess/FindIndicator.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FindIndicator_h
+#define FindIndicator_h
+
+#include "SharedMemory.h"
+#include <WebCore/FloatRect.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+    class GraphicsContext;
+}
+
+namespace WebKit {
+
+class BackingStore;
+
+class FindIndicator : public RefCounted<FindIndicator> {
+public:
+    static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle);
+    ~FindIndicator();
+
+    WebCore::FloatRect frameRect() const;
+
+    const Vector<WebCore::FloatRect>& textRects() const { return m_textRects; }
+
+    BackingStore* contentImage() const { return m_contentImage.get(); }
+
+    void draw(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
+
+private:
+    FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<BackingStore> contentImage);
+
+    WebCore::FloatRect m_selectionRect;
+    Vector<WebCore::FloatRect> m_textRects;
+    RefPtr<BackingStore> m_contentImage;
+};
+
+} // namespace WebKit
+
+#endif // FindIndicator_h
diff --git a/WebKit2/UIProcess/PageClient.h b/WebKit2/UIProcess/PageClient.h
index 30ee1fd..5bf7cc7 100644
--- a/WebKit2/UIProcess/PageClient.h
+++ b/WebKit2/UIProcess/PageClient.h
@@ -36,6 +36,7 @@ namespace WebCore {
 
 namespace WebKit {
 
+class FindIndicator;
 class NativeWebKeyboardEvent;
 class WebEditCommandProxy;
 
@@ -61,6 +62,8 @@ public:
 
     virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&) = 0;
 
+    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0;
+
 #if USE(ACCELERATED_COMPOSITING)
     virtual void pageDidEnterAcceleratedCompositing() = 0;
     virtual void pageDidLeaveAcceleratedCompositing() = 0;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 190d144..0a55d19 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -26,6 +26,7 @@
 #include "WebPageProxy.h"
 
 #include "DrawingAreaProxy.h"
+#include "FindIndicator.h"
 #include "MessageID.h"
 #include "NativeWebKeyboardEvent.h"
 #include "PageClient.h"
@@ -956,9 +957,10 @@ void WebPageProxy::didCountStringMatches(const String& string, uint32_t numMatch
     m_findClient.didCountStringMatches(this, string, numMatches);
 }
 
-void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle)
+void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
 {
-    // FIXME: Implement.
+    RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRect, textRects, contentImageHandle);
+    m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
 }
 
 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 5a5378f..168076e 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -282,7 +282,7 @@ private:
 
     // Find.
     void didCountStringMatches(const String&, uint32_t numMatches);
-    void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle);
+    void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
 
     void takeFocus(bool direction);
     void setToolTip(const String&);
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index 028fb8a..13b09c5 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -93,7 +93,7 @@ messages -> WebPageProxy {
 
     # Find.
     DidCountStringMatches(WTF::String string, uint32_t numMatches)
-    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle)
+    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle, bool fadeOut)
 
 #if USE(ACCELERATED_COMPOSITING)
     # Accelerated compsiting messages.
diff --git a/WebKit2/UIProcess/win/WebView.cpp b/WebKit2/UIProcess/win/WebView.cpp
index 660e848..3e9c9df 100644
--- a/WebKit2/UIProcess/win/WebView.cpp
+++ b/WebKit2/UIProcess/win/WebView.cpp
@@ -608,6 +608,11 @@ void WebView::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event)
     ::DefWindowProcW(event.nativeEvent()->hwnd, event.nativeEvent()->message, event.nativeEvent()->wParam, event.nativeEvent()->lParam);
 }
 
+void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
+{
+    // FIXME: Implement.
+}
+
 #if USE(ACCELERATED_COMPOSITING)
 void WebView::pageDidEnterAcceleratedCompositing()
 {
diff --git a/WebKit2/UIProcess/win/WebView.h b/WebKit2/UIProcess/win/WebView.h
index 652f2d1..fb0813f 100644
--- a/WebKit2/UIProcess/win/WebView.h
+++ b/WebKit2/UIProcess/win/WebView.h
@@ -102,6 +102,7 @@ private:
     virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
     virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
+    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
 
 #if USE(ACCELERATED_COMPOSITING)
     virtual void pageDidEnterAcceleratedCompositing();
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index 74c71fd..e86a891 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -240,6 +240,7 @@ HEADERS += \
     UIProcess/API/qt/qwkpreferences.h \
     UIProcess/ChunkedUpdateDrawingAreaProxy.h \
     UIProcess/DrawingAreaProxy.h \
+    UIProcess/FindIndicator.h \
     UIProcess/GenericCallback.h \
     UIProcess/Launcher/ProcessLauncher.h \
     UIProcess/Launcher/ThreadLauncher.h \
@@ -376,6 +377,7 @@ SOURCES += \
     UIProcess/API/cpp/qt/WKURLQt.cpp \
     UIProcess/ChunkedUpdateDrawingAreaProxy.cpp \
     UIProcess/DrawingAreaProxy.cpp \
+    UIProcess/FindIndicator.cpp \
     UIProcess/Plugins/PluginInfoStore.cpp \
     UIProcess/Plugins/qt/PluginInfoStoreQt.cpp \
     UIProcess/Launcher/ProcessLauncher.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index cbece2e..f406d82 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -126,6 +126,8 @@
 		1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C23612650717003E44D4 /* PageOverlay.cpp */; };
 		1A90C2A312650C60003E44D4 /* FindPageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C2A112650C60003E44D4 /* FindPageOverlay.h */; };
 		1A90C2A412650C60003E44D4 /* FindPageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C2A212650C60003E44D4 /* FindPageOverlay.cpp */; };
+		1A910071126675C4001842F5 /* FindIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A91006F126675C3001842F5 /* FindIndicator.h */; };
+		1A910072126675C4001842F5 /* FindIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A910070126675C4001842F5 /* FindIndicator.cpp */; };
 		1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; };
 		1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; };
 		1AA56F2911E92BC80061B882 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA56F2811E92BC80061B882 /* PluginController.h */; };
@@ -591,6 +593,8 @@
 		1A90C23612650717003E44D4 /* PageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageOverlay.cpp; sourceTree = "<group>"; };
 		1A90C2A112650C60003E44D4 /* FindPageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindPageOverlay.h; sourceTree = "<group>"; };
 		1A90C2A212650C60003E44D4 /* FindPageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindPageOverlay.cpp; sourceTree = "<group>"; };
+		1A91006F126675C3001842F5 /* FindIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindIndicator.h; sourceTree = "<group>"; };
+		1A910070126675C4001842F5 /* FindIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindIndicator.cpp; sourceTree = "<group>"; };
 		1AA1C79A100E7FC50078DEBC /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
@@ -1353,6 +1357,8 @@
 				BC2652151182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h */,
 				BC2652121182608100243E12 /* DrawingAreaProxy.cpp */,
 				BC2652131182608100243E12 /* DrawingAreaProxy.h */,
+				1A910070126675C4001842F5 /* FindIndicator.cpp */,
+				1A91006F126675C3001842F5 /* FindIndicator.h */,
 				BC17753E118BABF0007D9E9A /* GenericCallback.h */,
 				0F5265B711DD377F0006D33C /* LayerBackedDrawingAreaProxy.cpp */,
 				0F5265B811DD377F0006D33C /* LayerBackedDrawingAreaProxy.h */,
@@ -2027,6 +2033,7 @@
 				1A90C1F41264FD71003E44D4 /* FindController.h in Headers */,
 				1A90C23712650717003E44D4 /* PageOverlay.h in Headers */,
 				1A90C2A312650C60003E44D4 /* FindPageOverlay.h in Headers */,
+				1A910071126675C4001842F5 /* FindIndicator.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2333,6 +2340,7 @@
 				1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */,
 				1A90C2A412650C60003E44D4 /* FindPageOverlay.cpp in Sources */,
 				C01A260112662F2100C9ED55 /* BackingStoreCG.cpp in Sources */,
+				1A910072126675C4001842F5 /* FindIndicator.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/WebPage/FindController.cpp b/WebKit2/WebProcess/WebPage/FindController.cpp
index f230023..33fcac9 100644
--- a/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -87,7 +87,7 @@ void FindController::findString(const String& string, FindDirection findDirectio
                 shouldShowOverlay = false;
         }
 
-        if (!(findOptions & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame)) {
+        if (!(findOptions & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame, shouldShowOverlay)) {
             // Either we shouldn't show the find indicator, or we couldn't update it.
             resetFindIndicator();
         }
@@ -124,7 +124,7 @@ void FindController::findPageOverlayDestroyed()
     m_findPageOverlay = 0;
 }
 
-bool FindController::updateFindIndicator(Frame* selectedFrame)
+bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay)
 {
     if (!selectedFrame)
         return false;
@@ -162,7 +162,7 @@ bool FindController::updateFindIndicator(Frame* selectedFrame)
         textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates);
     }            
     
-    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, handle), m_webPage->pageID());
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, handle, !isShowingOverlay), m_webPage->pageID());
     m_isShowingFindIndicator = true;
 
     return true;
@@ -174,7 +174,7 @@ void FindController::resetFindIndicator()
         return;
 
     SharedMemory::Handle handle;
-    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), handle), m_webPage->pageID());
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), handle, false), m_webPage->pageID());
     m_isShowingFindIndicator = false;
 }
 
diff --git a/WebKit2/WebProcess/WebPage/FindController.h b/WebKit2/WebProcess/WebPage/FindController.h
index 620a0c2..5ab3226 100644
--- a/WebKit2/WebProcess/WebPage/FindController.h
+++ b/WebKit2/WebProcess/WebPage/FindController.h
@@ -51,7 +51,7 @@ public:
     void findPageOverlayDestroyed();
 
 private:
-    bool updateFindIndicator(WebCore::Frame* selectedFrame);
+    bool updateFindIndicator(WebCore::Frame* selectedFrame, bool isShowingOverlay);
     void resetFindIndicator();
     
     WebPage* m_webPage;
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index e350714..d3a5d70 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1501,6 +1501,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\UIProcess\FindIndicator.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\UIProcess\FindIndicator.h"
+				>
+			</File>
+			<File
 				RelativePath="..\UIProcess\GenericCallback.h"
 				>
 			</File>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list