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


The following commit has been merged in the debian/experimental branch:
commit 135d5a5db6584c804e46c5af66bd5e4a07723ed1
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 21 23:39:53 2010 +0000

    Forward window focus changes to the plug-in
    https://bugs.webkit.org/show_bug.cgi?id=46227
    
    Reviewed by Dan Bernstein.
    
    * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
    (WebKit::NetscapePlugin::windowFocusChanged):
    Send the NPCocoaEventWindowFocusChanged event.
    
    (WebKit::NetscapePlugin::windowFrameChanged):
    (WebKit::NetscapePlugin::windowVisibilityChanged):
    Add stubs.
    
    * WebProcess/Plugins/Plugin.h:
    Add windowFocusChanged, windowFrameChanged and windowVisibilityChanged.
    
    * WebProcess/Plugins/PluginView.cpp:
    (WebKit::PluginView::webPage):
    Make webPage a member function instead.
    
    (WebKit::PluginView::setWindowIsFocused):
    Call the plug-in member function.
    
    (WebKit::PluginView::initializePlugin):
    When the plug-in has been initialized, update its window frame, window visibility
    and window focus states.
    
    (WebKit::PluginView::setParent):
    Move viewGeometryDidChange to initializePlugin.
    
    * WebProcess/Plugins/PluginView.h:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::setActive):
    Tell all plug-in views about the new window focus state.
    
    (WebKit::WebPage::windowIsFocused):
    Return whether the window is focused or not.
    
    * WebProcess/WebPage/WebPage.h:
    (WebKit::WebPage::windowIsVisible):
    (WebKit::WebPage::windowFrame):
    Add getters.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67991 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 5a1332b..f41d1cb 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,50 @@
 2010-09-21  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by Dan Bernstein.
+
+        Forward window focus changes to the plug-in
+        https://bugs.webkit.org/show_bug.cgi?id=46227
+
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::windowFocusChanged):
+        Send the NPCocoaEventWindowFocusChanged event.
+
+        (WebKit::NetscapePlugin::windowFrameChanged):
+        (WebKit::NetscapePlugin::windowVisibilityChanged):
+        Add stubs.
+
+        * WebProcess/Plugins/Plugin.h:
+        Add windowFocusChanged, windowFrameChanged and windowVisibilityChanged.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::webPage):
+        Make webPage a member function instead.
+
+        (WebKit::PluginView::setWindowIsFocused):
+        Call the plug-in member function.
+
+        (WebKit::PluginView::initializePlugin):
+        When the plug-in has been initialized, update its window frame, window visibility 
+        and window focus states.
+
+        (WebKit::PluginView::setParent):
+        Move viewGeometryDidChange to initializePlugin.
+        
+        * WebProcess/Plugins/PluginView.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setActive):
+        Tell all plug-in views about the new window focus state.
+
+        (WebKit::WebPage::windowIsFocused):
+        Return whether the window is focused or not.
+
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::windowIsVisible):
+        (WebKit::WebPage::windowFrame):
+        Add getters.
+
+2010-09-21  Anders Carlsson  <andersca at apple.com>
+
         Reviewed by John Sullivan.
 
         Handle booleans in injected bundle messages
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index 413f9c5..e77c819 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -134,6 +134,13 @@ private:
     virtual bool handleMouseEnterEvent(const WebMouseEvent&);
     virtual bool handleMouseLeaveEvent(const WebMouseEvent&);
     virtual void setFocus(bool);
+
+#if PLATFORM(MAC)
+    virtual void windowFocusChanged(bool);
+    virtual void windowFrameChanged(const WebCore::IntRect&);
+    virtual void windowVisibilityChanged(bool);
+#endif
+
     virtual NPObject* pluginScriptableNPObject();
 
     virtual PluginController* controller();
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index 438341d..bb160e6 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -324,6 +324,35 @@ void NetscapePlugin::platformSetFocus(bool hasFocus)
     }
 }
 
+#if PLATFORM(MAC)
+void NetscapePlugin::windowFocusChanged(bool hasFocus)
+{
+    switch (m_eventModel) {
+        case NPEventModelCocoa: {
+            NPCocoaEvent event = initializeEvent(NPCocoaEventWindowFocusChanged);
+            
+            event.data.focus.hasFocus = hasFocus;
+            NPP_HandleEvent(&event);
+            break;
+        }
+
+        default:
+            ASSERT_NOT_REACHED();
+    }
+}
+
+void NetscapePlugin::windowFrameChanged(const IntRect&)
+{
+    // FIXME: Implement.
+}
+    
+void NetscapePlugin::windowVisibilityChanged(bool)
+{
+    // FIXME: Implement.
+}
+    
+#endif
+
 PlatformLayer* NetscapePlugin::pluginLayer()
 {
     return static_cast<PlatformLayer*>(m_pluginLayer.get());
diff --git a/WebKit2/WebProcess/Plugins/Plugin.h b/WebKit2/WebProcess/Plugins/Plugin.h
index a8d1faa..bfaba4e 100644
--- a/WebKit2/WebProcess/Plugins/Plugin.h
+++ b/WebKit2/WebProcess/Plugins/Plugin.h
@@ -123,12 +123,23 @@ public:
     // Tells the plug-in to handle the passed in mouse leave event. The plug-in should return true if it processed the event.
     virtual bool handleMouseLeaveEvent(const WebMouseEvent&) = 0;
 
-    // Tells the focus about focus changes.
+    // Tells the plug-in about focus changes.
     virtual void setFocus(bool) = 0;
 
     // Get the NPObject that corresponds to the plug-in's scriptable object. Returns a retained object.
     virtual NPObject* pluginScriptableNPObject() = 0;
 
+#if PLATFORM(MAC)
+    // Tells the plug-in about window focus changes.
+    virtual void windowFocusChanged(bool) = 0;
+
+    // Tells the plug-in about window frame changes.
+    virtual void windowFrameChanged(const WebCore::IntRect&) = 0;
+
+    // Tells the plug-in about window visibility changes.
+    virtual void windowVisibilityChanged(bool) = 0;
+#endif
+
     // Returns the plug-in controller for this plug-in.
     // FIXME: We could just have the controller be a member variable of Plugin.
     virtual PluginController* controller() = 0;
diff --git a/WebKit2/WebProcess/Plugins/PluginView.cpp b/WebKit2/WebProcess/Plugins/PluginView.cpp
index fc79a1e..d115477 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -221,14 +221,6 @@ void PluginView::Stream::didFinishLoading(NetscapePlugInStreamLoader*)
     m_pluginView = 0;
 }
 
-static inline WebPage* webPage(Frame* frame)
-{
-    WebPage* webPage = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->page();
-    ASSERT(webPage);
-
-    return webPage;
-}
-
 PluginView::PluginView(WebCore::HTMLPlugInElement* pluginElement, PassRefPtr<Plugin> plugin, const Plugin::Parameters& parameters)
     : PluginViewBase(0)
     , m_pluginElement(pluginElement)
@@ -241,14 +233,14 @@ PluginView::PluginView(WebCore::HTMLPlugInElement* pluginElement, PassRefPtr<Plu
     , m_npRuntimeObjectMap(this)
 {
 #if PLATFORM(MAC)
-    webPage(frame())->addPluginView(this);
+    webPage()->addPluginView(this);
 #endif
 }
 
 PluginView::~PluginView()
 {
 #if PLATFORM(MAC)
-    webPage(frame())->removePluginView(this);
+    webPage()->removePluginView(this);
 #endif
 
     ASSERT(!m_isBeingDestroyed);
@@ -279,6 +271,14 @@ Frame* PluginView::frame()
     return m_pluginElement->document()->frame();
 }
 
+WebPage* PluginView::webPage()
+{
+    WebPage* webPage = static_cast<WebFrameLoaderClient*>(frame()->loader()->client())->webFrame()->page();
+    ASSERT(webPage);
+    
+    return webPage;
+}
+
 void PluginView::manualLoadDidReceiveResponse(const ResourceResponse& response)
 {
     // Compute the stream related data from the resource response.
@@ -319,6 +319,14 @@ void PluginView::setWindowIsVisible(bool windowIsVisible)
     // FIXME: Implement.
 }
 
+void PluginView::setWindowIsFocused(bool windowIsFocused)
+{
+    if (!m_plugin)
+        return;
+
+    m_plugin->windowFocusChanged(windowIsFocused);    
+}
+
 void PluginView::setWindowFrame(const IntRect& windowFrame)
 {
     if (!m_plugin)
@@ -326,6 +334,7 @@ void PluginView::setWindowFrame(const IntRect& windowFrame)
         
     // FIXME: Implement.
 }
+
 #endif
 
 void PluginView::initializePlugin()
@@ -362,15 +371,19 @@ void PluginView::initializePlugin()
     
     m_isInitialized = true;
 
-#if PLATFORM(MAC)
-    if (!m_plugin->pluginLayer())
-        return;
+    viewGeometryDidChange();
 
-    if (!frame())
-        return;
+#if PLATFORM(MAC)
+    if (m_plugin->pluginLayer()) {
+        if (frame()) {
+            frame()->view()->enterCompositingMode();
+            m_pluginElement->setNeedsStyleRecalc(SyntheticStyleChange);
+        }
+    }
 
-    frame()->view()->enterCompositingMode();
-    m_pluginElement->setNeedsStyleRecalc(SyntheticStyleChange);
+    setWindowFrame(webPage()->windowFrame());
+    setWindowIsVisible(webPage()->windowIsVisible());
+    setWindowIsFocused(webPage()->windowIsFocused());
 #endif
 }
 
@@ -436,8 +449,6 @@ void PluginView::setParent(ScrollView* scrollView)
     
     if (scrollView)
         initializePlugin();
-
-    viewGeometryDidChange();
 }
 
 void PluginView::handleEvent(Event* event)
diff --git a/WebKit2/WebProcess/Plugins/PluginView.h b/WebKit2/WebProcess/Plugins/PluginView.h
index 5decc17..b2bf9c8 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.h
+++ b/WebKit2/WebProcess/Plugins/PluginView.h
@@ -63,6 +63,7 @@ public:
 
 #if PLATFORM(MAC)
     void setWindowIsVisible(bool);
+    void setWindowIsFocused(bool);
     void setWindowFrame(const WebCore::IntRect&);
 #endif
 
@@ -70,6 +71,8 @@ private:
     PluginView(WebCore::HTMLPlugInElement*, PassRefPtr<Plugin>, const Plugin::Parameters& parameters);
     virtual ~PluginView();
 
+    WebPage* webPage();
+
     void initializePlugin();
     void destroyPlugin();
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index c1efdf5..53fb967 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -500,6 +500,12 @@ void WebPage::touchEvent(const WebTouchEvent& touchEvent)
 void WebPage::setActive(bool isActive)
 {
     m_page->focusController()->setActive(isActive);
+
+#if PLATFORM(MAC)    
+    // Tell all our plug-in views that the window focus changed.
+    for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
+        (*it)->setWindowIsFocused(isActive);
+#endif
 }
 
 void WebPage::setFocused(bool isFocused)
@@ -705,6 +711,11 @@ void WebPage::setWindowFrame(const IntRect& windowFrame)
         (*it)->setWindowFrame(windowFrame);
 }
 
+bool WebPage::windowIsFocused() const
+{
+    return m_page->focusController()->isActive();
+}   
+
 #endif
 
 void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 779ec86..b91b5dc 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -145,6 +145,10 @@ public:
 #if PLATFORM(MAC)
     void addPluginView(PluginView*);
     void removePluginView(PluginView*);
+
+    bool windowIsVisible() const { return m_windowIsVisible; }
+    const WebCore::IntRect& windowFrame() const { return m_windowFrame; }
+    bool windowIsFocused() const;
 #endif
 
     static const WebEvent* currentEvent();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list