Commit 631cf2e5 authored by andersca@apple.com's avatar andersca@apple.com
Browse files

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
parent f7346b21
2010-10-25 Anders Carlsson <andersca@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@apple.com>
 
Reviewed by Gavin Barraclough.
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment