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


The following commit has been merged in the debian/experimental branch:
commit 631cf2e5457617ef85644fab57a35b8986aeb84d
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 25 22:59:14 2010 +0000

    Update the fake Carbon window when the window frame changes
    https://bugs.webkit.org/show_bug.cgi?id=48273
    
    Reviewed by Dan Bernstein.
    
    * UIProcess/API/mac/WKView.mm:
    (screenForWindow):
    (-[WKView _updateWindowFrame]):
    Pass the window frame in Carbon coordinates.
    
    * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
    (WebKit::NetscapePlugin::windowFrameChanged):
    Update the window bounds.
    
    * WebProcess/Plugins/PluginView.cpp:
    (WebKit::PluginView::setWindowFrame):
    Call the plug-in.
    
    (WebKit::PluginView::platformLayer):
    Fix a crash when WebCore asked for the layer before it was initialized.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70499 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 5c55c15..5b8db97 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,26 @@
+2010-10-25  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Update the fake Carbon window when the window frame changes
+        https://bugs.webkit.org/show_bug.cgi?id=48273
+
+        * UIProcess/API/mac/WKView.mm:
+        (screenForWindow):
+        (-[WKView _updateWindowFrame]):
+        Pass the window frame in Carbon coordinates.
+
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::windowFrameChanged):
+        Update the window bounds.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::setWindowFrame):
+        Call the plug-in.
+
+        (WebKit::PluginView::platformLayer):
+        Fix a crash when WebCore asked for the layer before it was initialized.
+
 2010-10-25  Oliver Hunt  <oliver at apple.com>
 
         Reviewed by Gavin Barraclough.
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index c203554..e34fa88 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -408,11 +408,29 @@ static bool isViewVisible(NSView *view)
         area->setPageIsVisible(isViewVisible(self));
 }
 
+static NSScreen *screenForWindow(NSWindow *window)
+{
+    if (NSScreen *screen = [window screen]) // nil if the window is off-screen
+        return screen;
+    
+    NSArray *screens = [NSScreen screens];
+    if ([screens count] > 0)
+        return [screens objectAtIndex:0]; // screen containing the menubar
+    
+    return nil;
+}
+
 - (void)_updateWindowFrame
 {
-    ASSERT([self window]);
+    NSWindow *window = [self window];
+    ASSERT(window);
+
+    // We want the window frame in Carbon coordinates, so flip the Y coordinate.
+    NSRect windowFrame = [window frame];
+    NSScreen *screen = ::screenForWindow(window);
+    windowFrame.origin.y = NSMaxY([screen frame]) - windowFrame.origin.y;
 
-    _data->_page->updateWindowFrame(enclosingIntRect([[self window] frame]));
+    _data->_page->updateWindowFrame(enclosingIntRect(windowFrame));
 }
 
 - (void)viewWillMoveToWindow:(NSWindow *)window
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index fb9c1df..8532b7c 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -602,9 +602,27 @@ void NetscapePlugin::windowFocusChanged(bool hasFocus)
     }
 }
 
-void NetscapePlugin::windowFrameChanged(const IntRect&)
+void NetscapePlugin::windowFrameChanged(const IntRect& windowFrame)
 {
-    // FIXME: Implement.
+    switch (m_eventModel) {
+        case NPEventModelCocoa:
+            // Nothing to do.
+            break;
+
+        case NPEventModelCarbon: {
+            Rect bounds;
+            bounds.top = windowFrame.y() + windowFrame.height();
+            bounds.left = windowFrame.x();
+            bounds.right = windowFrame.right();
+            bounds.bottom = windowFrame.y();
+            
+            ::SetWindowBounds(windowRef(), kWindowStructureRgn, &bounds);
+            break;
+        }
+
+        default:
+            ASSERT_NOT_REACHED();
+    }
 }
     
 void NetscapePlugin::windowVisibilityChanged(bool)
diff --git a/WebKit2/WebProcess/Plugins/PluginView.cpp b/WebKit2/WebProcess/Plugins/PluginView.cpp
index e59a2c2..f2cc9a2 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -339,8 +339,8 @@ void PluginView::setWindowFrame(const IntRect& windowFrame)
 {
     if (!m_plugin)
         return;
-        
-    // FIXME: Implement.
+
+    m_plugin->windowFrameChanged(windowFrame);
 }
 
 #endif
@@ -398,6 +398,10 @@ void PluginView::initializePlugin()
 #if PLATFORM(MAC)
 PlatformLayer* PluginView::platformLayer() const
 {
+    // The plug-in can be null here if it failed to initialize or hasn't yet been initialized.
+    if (!m_plugin)
+        return 0;
+        
     return m_plugin->pluginLayer();
 }
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list