[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 15:38:08 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e0f619d1533b8e63b3e3e19f4900586d9f289c3b
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 9 19:06:48 2010 +0000

    Add a PageOverlay::Client object in preparation of not allowing subclassing of PageOverlay
    https://bugs.webkit.org/show_bug.cgi?id=49263
    
    Reviewed by John Sullivan.
    
    * WebProcess/WebPage/FindPageOverlay.cpp:
    (WebKit::FindPageOverlay::FindPageOverlay):
    Call the PageOverlay constructor.
    
    (WebKit::FindPageOverlay::drawRect):
    (WebKit::FindPageOverlay::mouseEvent):
    These now take a PageOverlay callback.
    
    * WebProcess/WebPage/FindPageOverlay.h:
    FindPageOverlay now inherits from PageOverlay::Client.
    
    * WebProcess/WebPage/PageOverlay.cpp:
    (WebKit::PageOverlay::create):
    Add create function.
    
    (WebKit::PageOverlay::PageOverlay):
    The constructor now takes a client.
    
    (WebKit::PageOverlay::drawRect):
    (WebKit::PageOverlay::mouseEvent):
    Call the client methods.
    
    * WebProcess/WebPage/PageOverlay.h:
    Add Client class.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71652 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 0a171da..dc4d5e8 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,35 @@
+2010-11-09  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by John Sullivan.
+
+        Add a PageOverlay::Client object in preparation of not allowing subclassing of PageOverlay
+        https://bugs.webkit.org/show_bug.cgi?id=49263
+
+        * WebProcess/WebPage/FindPageOverlay.cpp:
+        (WebKit::FindPageOverlay::FindPageOverlay):
+        Call the PageOverlay constructor.
+
+        (WebKit::FindPageOverlay::drawRect):
+        (WebKit::FindPageOverlay::mouseEvent):
+        These now take a PageOverlay callback.
+
+        * WebProcess/WebPage/FindPageOverlay.h:
+        FindPageOverlay now inherits from PageOverlay::Client.
+
+        * WebProcess/WebPage/PageOverlay.cpp:
+        (WebKit::PageOverlay::create):
+        Add create function.
+
+        (WebKit::PageOverlay::PageOverlay):
+        The constructor now takes a client.
+
+        (WebKit::PageOverlay::drawRect):
+        (WebKit::PageOverlay::mouseEvent):
+        Call the client methods.
+
+        * WebProcess/WebPage/PageOverlay.h:
+        Add Client class.
+
 2010-11-09  Dan Bernstein  <mitz at apple.com>
 
         Rubber-stamped by Darin Adler.
diff --git a/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp b/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
index b8f6635..b18c940 100644
--- a/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
+++ b/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
@@ -52,7 +52,8 @@ PassOwnPtr<FindPageOverlay> FindPageOverlay::create(FindController* findControll
 }
 
 FindPageOverlay::FindPageOverlay(FindController* findController)
-    : m_findController(findController)
+    : PageOverlay(this)
+    , m_findController(findController)
 {
 }
 
@@ -104,7 +105,7 @@ static Color overlayBackgroundColor()
     return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha);
 }
 
-void FindPageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
+void FindPageOverlay::drawRect(PageOverlay*, GraphicsContext& graphicsContext, const IntRect& dirtyRect)
 {
     Vector<IntRect> rects = rectsForTextMatches();
     ASSERT(!rects.isEmpty());
@@ -145,7 +146,7 @@ void FindPageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect&
     graphicsContext.endTransparencyLayer();
 }
 
-bool FindPageOverlay::mouseEvent(const WebMouseEvent& event)
+bool FindPageOverlay::mouseEvent(PageOverlay*, const WebMouseEvent& event)
 {
     // If we get a mouse down event inside the page overlay we should hide the find UI.
     if (event.type() == WebEvent::MouseDown && bounds().contains(event.position())) {
diff --git a/WebKit2/WebProcess/WebPage/FindPageOverlay.h b/WebKit2/WebProcess/WebPage/FindPageOverlay.h
index 08d1a41..36cee32 100644
--- a/WebKit2/WebProcess/WebPage/FindPageOverlay.h
+++ b/WebKit2/WebProcess/WebPage/FindPageOverlay.h
@@ -34,7 +34,7 @@ namespace WebKit {
 
 class FindController;
 
-class FindPageOverlay : public PageOverlay {
+class FindPageOverlay : public PageOverlay, public PageOverlay::Client {
 public:
     static PassOwnPtr<FindPageOverlay> create(FindController*);
     virtual ~FindPageOverlay();
@@ -45,9 +45,9 @@ private:
     Vector<WebCore::IntRect> rectsForTextMatches();
     WebCore::IntRect bounds() const;
 
-    // PageOverlay.
-    virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
-    virtual bool mouseEvent(const WebMouseEvent&);
+    // PageOverlay::Client.
+    virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
+    virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&);
 
     FindController* m_findController;
 };
diff --git a/WebKit2/WebProcess/WebPage/PageOverlay.cpp b/WebKit2/WebProcess/WebPage/PageOverlay.cpp
index 9ced9bf..d47b841 100644
--- a/WebKit2/WebProcess/WebPage/PageOverlay.cpp
+++ b/WebKit2/WebProcess/WebPage/PageOverlay.cpp
@@ -31,8 +31,14 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PageOverlay::PageOverlay()
-    : m_webPage(0)
+PassRefPtr<PageOverlay> PageOverlay::create(Client* client)
+{
+    return adoptRef(new PageOverlay(client));
+}
+
+PageOverlay::PageOverlay(Client* client)
+    : m_client(client)
+    , m_webPage(0)
 {
 }
 
@@ -53,4 +59,14 @@ void PageOverlay::setNeedsDisplay()
     m_webPage->drawingArea()->setNeedsDisplay(IntRect(IntPoint(), m_webPage->size()));
 }
 
+void PageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
+{
+    m_client->drawRect(this, graphicsContext, dirtyRect);
+}
+    
+bool PageOverlay::mouseEvent(const WebMouseEvent& mouseEvent)
+{
+    return m_client->mouseEvent(this, mouseEvent);
+}
+
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/PageOverlay.h b/WebKit2/WebProcess/WebPage/PageOverlay.h
index 02fde45..05c5f4f 100644
--- a/WebKit2/WebProcess/WebPage/PageOverlay.h
+++ b/WebKit2/WebProcess/WebPage/PageOverlay.h
@@ -26,7 +26,8 @@
 #ifndef PageOverlay_h
 #define PageOverlay_h
 
-#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
     class GraphicsContext;
@@ -38,23 +39,34 @@ namespace WebKit {
 class WebMouseEvent;
 class WebPage;
 
-class PageOverlay {
-    WTF_MAKE_NONCOPYABLE(PageOverlay);
-
+class PageOverlay : public RefCounted<PageOverlay> {
 public:
-    virtual ~PageOverlay();
-    virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) = 0;
-    virtual bool mouseEvent(const WebMouseEvent&) = 0;
+    class Client {
+    protected:
+        virtual ~Client() { }
+    
+    public:
+        virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) = 0;
+        virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&) = 0;
+    };
 
+    static PassRefPtr<PageOverlay> create(Client*);
+    virtual ~PageOverlay();
+    
     void setPage(WebPage*);
     void setNeedsDisplay();
 
+    void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
+    bool mouseEvent(const WebMouseEvent&);
+
 protected:
-    PageOverlay();
+    explicit PageOverlay(Client*);
 
     WebPage* webPage() const { return m_webPage; }
 
 private:
+    Client* m_client;
+
     WebPage* m_webPage;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list