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


The following commit has been merged in the debian/experimental branch:
commit a71ad2cedf9a5a9d1dafeadbd8056210479a8576
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 12 23:10:36 2010 +0000

    Start fleshing out find page overlays
    https://bugs.webkit.org/show_bug.cgi?id=47559
    
    Reviewed by Sam Weinig.
    
    WebKit2:
    
    * UIProcess/API/C/WKAPICast.h:
    (WebKit::toFindOptions):
    Handle the kWKFindOptionsShowFindIndicator flag.
    
    * WebKit2.pro:
    * WebKit2.xcodeproj/project.pbxproj:
    Add new files.
    
    * WebProcess/WebPage/FindController.cpp:
    (WebKit::FindController::FindController):
    Initialize the find page overlay.
    
    (WebKit::FindController::findString):
    Hide or show the find page overlay.
    
    (WebKit::FindController::findPageOverlayDestroyed):
    Null out the find page overlay.
    
    * WebProcess/WebPage/FindPageOverlay.cpp: Added.
    * WebProcess/WebPage/FindPageOverlay.h: Added.
    Add stubbed out FindPageOverlay class.
    
    * WebProcess/WebPage/PageOverlay.cpp: Added.
    (WebKit::PageOverlay::setPage):
    Set the parent web page.
    
    (WebKit::PageOverlay::setNeedsDisplay):
    Invalidate the parent web page.
    
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::drawRect):
    If there's a page overlay, ask it to draw on top of the page contents.
    
    (WebKit::WebPage::installPageOverlay):
    Set the page overlay.
    
    (WebKit::WebPage::uninstallPageOverlay):
    Clear the page overlay.
    
    * win/WebKit2.vcproj:
    Add new files.
    
    WebKitTools:
    
    * MiniBrowser/mac/BrowserWindowController.m:
    (-[BrowserWindowController find:]):
    Pass kWKFindOptionsShowOverlay to WKPageFindString.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69616 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index a45c17e..bf9b57e 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,52 @@
+2010-10-12  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Start fleshing out find page overlays
+        https://bugs.webkit.org/show_bug.cgi?id=47559
+
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit::toFindOptions):
+        Handle the kWKFindOptionsShowFindIndicator flag.
+
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+        
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::FindController):
+        Initialize the find page overlay.
+
+        (WebKit::FindController::findString):
+        Hide or show the find page overlay.
+
+        (WebKit::FindController::findPageOverlayDestroyed):
+        Null out the find page overlay.
+
+        * WebProcess/WebPage/FindPageOverlay.cpp: Added.
+        * WebProcess/WebPage/FindPageOverlay.h: Added.
+        Add stubbed out FindPageOverlay class.
+
+        * WebProcess/WebPage/PageOverlay.cpp: Added.
+        (WebKit::PageOverlay::setPage):
+        Set the parent web page.
+
+        (WebKit::PageOverlay::setNeedsDisplay):
+        Invalidate the parent web page.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::drawRect):
+        If there's a page overlay, ask it to draw on top of the page contents.
+
+        (WebKit::WebPage::installPageOverlay):
+        Set the page overlay.
+
+        (WebKit::WebPage::uninstallPageOverlay):
+        Clear the page overlay.
+
+        * win/WebKit2.vcproj:
+        Add new files.
+
 2010-10-12  Jessie Berlin  <jberlin at apple.com>
 
         Reviewed by Jon Honeycutt.
diff --git a/WebKit2/UIProcess/API/C/WKAPICast.h b/WebKit2/UIProcess/API/C/WKAPICast.h
index 92a803d..5e9f353 100644
--- a/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -139,6 +139,8 @@ inline FindOptions toFindOptions(WKFindOptions wkFindOptions)
         findOptions |= FindOptionsWrapAround;
     if (wkFindOptions & kWKFindOptionsShowOverlay)
         findOptions |= FindOptionsShowOverlay;
+    if (wkFindOptions & kWKFindOptionsShowFindIndicator)
+        findOptions |= FindOptionsShowFindIndicator;
 
     return static_cast<FindOptions>(findOptions);
 }
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index ef3581b..4a532a5 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -296,6 +296,8 @@ HEADERS += \
     WebProcess/WebPage/ChunkedUpdateDrawingArea.h \
     WebProcess/WebPage/DrawingArea.h \
     WebProcess/WebPage/FindController.h \
+    WebProcess/WebPage/FindPageOverlay.h \
+    WebProcess/WebPage/PageOverlay.h \
     WebProcess/WebPage/WebEditCommand.h \
     WebProcess/WebPage/WebFrame.h \
     WebProcess/WebPage/WebPage.h \
@@ -433,6 +435,8 @@ SOURCES += \
     WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp \
     WebProcess/WebPage/DrawingArea.cpp \
     WebProcess/WebPage/FindController.cpp \
+    WebProcess/WebPage/FindPageOverlay.cpp \
+    WebProcess/WebPage/PageOverlay.cpp \
     WebProcess/WebPage/WebEditCommand.cpp \
     WebProcess/WebPage/WebFrame.cpp \
     WebProcess/WebPage/WebPage.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index e7564a0..a61afdb 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -123,6 +123,10 @@
 		1A90C1EE1264FD50003E44D4 /* FindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C1ED1264FD50003E44D4 /* FindOptions.h */; };
 		1A90C1F41264FD71003E44D4 /* FindController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C1F21264FD71003E44D4 /* FindController.h */; };
 		1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C1F31264FD71003E44D4 /* FindController.cpp */; };
+		1A90C23712650717003E44D4 /* PageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C23512650717003E44D4 /* PageOverlay.h */; };
+		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 */; };
 		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 */; };
@@ -584,6 +588,10 @@
 		1A90C1ED1264FD50003E44D4 /* FindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindOptions.h; sourceTree = "<group>"; };
 		1A90C1F21264FD71003E44D4 /* FindController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindController.h; sourceTree = "<group>"; };
 		1A90C1F31264FD71003E44D4 /* FindController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindController.cpp; sourceTree = "<group>"; };
+		1A90C23512650717003E44D4 /* PageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageOverlay.h; sourceTree = "<group>"; };
+		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>"; };
 		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>"; };
@@ -1313,8 +1321,12 @@
 				BC8452A61162C80900CAB9B5 /* DrawingArea.h */,
 				1A90C1F31264FD71003E44D4 /* FindController.cpp */,
 				1A90C1F21264FD71003E44D4 /* FindController.h */,
+				1A90C2A212650C60003E44D4 /* FindPageOverlay.cpp */,
+				1A90C2A112650C60003E44D4 /* FindPageOverlay.h */,
 				0F5265B111DD37680006D33C /* LayerBackedDrawingArea.cpp */,
 				0F5265B211DD37680006D33C /* LayerBackedDrawingArea.h */,
+				1A90C23612650717003E44D4 /* PageOverlay.cpp */,
+				1A90C23512650717003E44D4 /* PageOverlay.h */,
 				BC72B9F811E6476B001EB4EA /* WebBackForwardListProxy.cpp */,
 				BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */,
 				BCA0EF7E12331E78007D3CFB /* WebEditCommand.cpp */,
@@ -2005,6 +2017,8 @@
 				1AC41AC71263C88300054E94 /* BinarySemaphore.h in Headers */,
 				1A90C1EE1264FD50003E44D4 /* FindOptions.h in Headers */,
 				1A90C1F41264FD71003E44D4 /* FindController.h in Headers */,
+				1A90C23712650717003E44D4 /* PageOverlay.h in Headers */,
+				1A90C2A312650C60003E44D4 /* FindPageOverlay.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2309,6 +2323,8 @@
 				1A3DD1FD125E59F3004515E6 /* WebFindClient.cpp in Sources */,
 				1AC41AC81263C88300054E94 /* BinarySemaphore.cpp in Sources */,
 				1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */,
+				1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */,
+				1A90C2A412650C60003E44D4 /* FindPageOverlay.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/WebPage/FindController.cpp b/WebKit2/WebProcess/WebPage/FindController.cpp
index 6ab0e49..cfcc044 100644
--- a/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -25,6 +25,7 @@
 
 #include "FindController.h"
 
+#include "FindPageOverlay.h"
 #include "WebPage.h"
 #include <WebCore/Frame.h>
 #include <WebCore/Page.h>
@@ -35,6 +36,7 @@ namespace WebKit {
 
 FindController::FindController(WebPage* webPage)
     : m_webPage(webPage)
+    , m_findPageOverlay(0)
 {
 }
 
@@ -56,6 +58,8 @@ void FindController::findString(const String& string, FindDirection findDirectio
 
     Frame* selectedFrame = frameWithSelection(m_webPage->corePage());
 
+    bool shouldShowOverlay = false;
+
     if (!found) {
         // We didn't find the string, clear all text matches.
         m_webPage->corePage()->unmarkAllTextMatches();
@@ -63,9 +67,30 @@ void FindController::findString(const String& string, FindDirection findDirectio
         // And clear the selection.
         if (selectedFrame)
             selectedFrame->selection()->clear();
+    } else {
+        // FIXME: We need to show the find indicator here.
+
+        shouldShowOverlay = findOptions & FindOptionsShowOverlay;
+    }
 
+    if (!shouldShowOverlay) {
+        if (m_findPageOverlay) {
+            // Get rid of the overlay.
+            m_webPage->uninstallPageOverlay();
+        }
+        
+        ASSERT(!m_findPageOverlay);
         return;
     }
+
+    if (!m_findPageOverlay) {
+        OwnPtr<FindPageOverlay> findPageOverlay = FindPageOverlay::create(this);
+        m_findPageOverlay = findPageOverlay.get();
+        m_webPage->installPageOverlay(findPageOverlay.release());
+    } else {
+        // The page overlay needs to be repainted.
+        m_findPageOverlay->setNeedsDisplay();
+    }
 }
 
 void FindController::hideFindUI()
@@ -73,4 +98,10 @@ void FindController::hideFindUI()
     // FIXME: Implement.
 }
 
+void FindController::findPageOverlayDestroyed()
+{
+    ASSERT(m_findPageOverlay);
+    m_findPageOverlay = 0;
+}
+
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/FindController.h b/WebKit2/WebProcess/WebPage/FindController.h
index 479591a..1678fc6 100644
--- a/WebKit2/WebProcess/WebPage/FindController.h
+++ b/WebKit2/WebProcess/WebPage/FindController.h
@@ -36,6 +36,7 @@ namespace WebCore {
 
 namespace WebKit {
 
+class FindPageOverlay;
 class WebPage;
 
 class FindController {
@@ -47,8 +48,11 @@ public:
     void findString(const String&, FindDirection, FindOptions, unsigned maxNumMatches);
     void hideFindUI();
 
+    void findPageOverlayDestroyed();
+
 private:
     WebPage* m_webPage;
+    FindPageOverlay* m_findPageOverlay;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp b/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
new file mode 100644
index 0000000..f6948dd
--- /dev/null
+++ b/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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 "FindPageOverlay.h"
+
+#include "FindController.h"
+#include <WebCore/GraphicsContext.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassOwnPtr<FindPageOverlay> FindPageOverlay::create(FindController* findController)
+{
+    return adoptPtr(new FindPageOverlay(findController));
+}
+
+FindPageOverlay::FindPageOverlay(FindController* findController)
+    : m_findController(findController)
+{
+}
+
+FindPageOverlay::~FindPageOverlay()
+{
+    m_findController->findPageOverlayDestroyed();
+}
+
+void FindPageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
+{
+    // FIXME: Draw something.
+}
+
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/FindPageOverlay.h b/WebKit2/WebProcess/WebPage/FindPageOverlay.h
new file mode 100644
index 0000000..5c99be3
--- /dev/null
+++ b/WebKit2/WebProcess/WebPage/FindPageOverlay.h
@@ -0,0 +1,52 @@
+/*
+ * 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 FindPageOverlay_h
+#define FindPageOverlay_h
+
+#include "PageOverlay.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+
+class FindController;
+
+class FindPageOverlay : public PageOverlay {
+public:
+    static PassOwnPtr<FindPageOverlay> create(FindController*);
+    virtual ~FindPageOverlay();
+
+private:
+    explicit FindPageOverlay(FindController*);
+
+    // PageOverlay.
+    virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
+
+    FindController* m_findController;
+};
+
+} // namespace WebKit
+
+#endif // FindPageOverlay_h
diff --git a/WebKit2/WebProcess/WebPage/PageOverlay.cpp b/WebKit2/WebProcess/WebPage/PageOverlay.cpp
new file mode 100644
index 0000000..9ced9bf
--- /dev/null
+++ b/WebKit2/WebProcess/WebPage/PageOverlay.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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 "PageOverlay.h"
+
+#include "WebPage.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PageOverlay::PageOverlay()
+    : m_webPage(0)
+{
+}
+
+PageOverlay::~PageOverlay()
+{
+}
+
+void PageOverlay::setPage(WebPage* webPage)
+{
+    ASSERT(!m_webPage);
+
+    m_webPage = webPage;
+    setNeedsDisplay();
+}
+
+void PageOverlay::setNeedsDisplay()
+{
+    m_webPage->drawingArea()->setNeedsDisplay(IntRect(IntPoint(), m_webPage->size()));
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/PageOverlay.h b/WebKit2/WebProcess/WebPage/PageOverlay.h
new file mode 100644
index 0000000..69c4783
--- /dev/null
+++ b/WebKit2/WebProcess/WebPage/PageOverlay.h
@@ -0,0 +1,59 @@
+/*
+ * 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 PageOverlay_h
+#define PageOverlay_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+    class GraphicsContext;
+    class IntRect;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class PageOverlay {
+    WTF_MAKE_NONCOPYABLE(PageOverlay);
+
+public:
+    virtual ~PageOverlay();
+    virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) = 0;
+    
+    void setPage(WebPage*);
+    void setNeedsDisplay();
+
+protected:
+    PageOverlay();
+
+private:
+    WebPage* m_webPage;
+};
+
+} // namespace WebKit
+
+#endif // PageOverlay_h
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 79ca8c3..fb7404e 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -30,6 +30,7 @@
 #include "InjectedBundle.h"
 #include "MessageID.h"
 #include "NetscapePlugin.h"
+#include "PageOverlay.h"
 #include "PluginProcessConnection.h"
 #include "PluginProcessConnectionManager.h"
 #include "PluginProxy.h"
@@ -382,6 +383,13 @@ void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
     graphicsContext.clip(rect);
     m_mainFrame->coreFrame()->view()->paint(&graphicsContext, rect);
     graphicsContext.restore();
+
+    if (m_pageOverlay) {
+        graphicsContext.save();
+        graphicsContext.clip(rect);
+        m_pageOverlay->drawRect(graphicsContext, rect);
+        graphicsContext.restore();
+    }
 }
 
 double WebPage::textZoomFactor() const
@@ -424,6 +432,17 @@ void WebPage::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFa
     return frame->setPageAndTextZoomFactors(static_cast<float>(pageZoomFactor), static_cast<float>(textZoomFactor));
 }
 
+void WebPage::installPageOverlay(PassOwnPtr<PageOverlay> pageOverlay)
+{
+    m_pageOverlay = pageOverlay;
+    m_pageOverlay->setPage(this);
+}
+
+void WebPage::uninstallPageOverlay()
+{
+    m_pageOverlay = 0;
+}
+
 // Events 
 
 static const WebEvent* g_currentEvent = 0;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 49e3f70..592d6ee 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -64,6 +64,7 @@ namespace WebCore {
 namespace WebKit {
 
 class DrawingArea;
+class PageOverlay;
 class PluginView;
 class WebEvent;
 class WebFrame;
@@ -157,6 +158,9 @@ public:
     HWND nativeWindow() const { return m_nativeWindow; }
 #endif
 
+    void installPageOverlay(PassOwnPtr<PageOverlay>);
+    void uninstallPageOverlay();
+
     static const WebEvent* currentEvent();
 
 private:
@@ -252,6 +256,7 @@ private:
     InjectedBundlePageUIClient m_uiClient;
 
     FindController m_findController;
+    OwnPtr<PageOverlay> m_pageOverlay;
 
     uint64_t m_pageID;
 };
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index 0113787..47cf4a7 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1044,6 +1044,22 @@
 					>
 				</File>
 				<File
+					RelativePath="..\WebProcess\WebPage\FindPageOverlay.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\WebPage\FindPageOverlay.h"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\WebPage\PageOverlay.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\WebPage\PageOverlay.h"
+					>
+				</File>
+				<File
 					RelativePath="..\WebProcess\WebPage\WebBackForwardListProxy.cpp"
 					>
 				</File>
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 211a50d..ff249fb 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-12  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Start fleshing out find page overlays
+        https://bugs.webkit.org/show_bug.cgi?id=47559
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController find:]):
+        Pass kWKFindOptionsShowOverlay to WKPageFindString.
+
 2010-10-12  Robert Hogan  <robert at webkit.org>
 
         Reviewed by Antonio Gomes.
diff --git a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
index 502a359..4e5f1d2 100644
--- a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
+++ b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
@@ -669,7 +669,7 @@ static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKF
     WKStringRef string = WKStringCreateWithCFString((CFStringRef)[sender stringValue]);
 
     WKPageFindString(_webView.pageRef, string, kWKFindDirectionForward, 
-                     kWKFindOptionsCaseInsensitive | kWKFindOptionsWrapAround | kWKFindOptionsShowFindIndicator, 100);
+                     kWKFindOptionsCaseInsensitive | kWKFindOptionsWrapAround | kWKFindOptionsShowFindIndicator | kWKFindOptionsShowOverlay, 100);
 }
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list