Changeset 70499 in webkit


Ignore:
Timestamp:
Oct 25, 2010 3:59:14 PM (14 years ago)
Author:
andersca@apple.com
Message:

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.

Location:
trunk/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r70496 r70499  
     12010-10-25  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Update the fake Carbon window when the window frame changes
     6        https://bugs.webkit.org/show_bug.cgi?id=48273
     7
     8        * UIProcess/API/mac/WKView.mm:
     9        (screenForWindow):
     10        (-[WKView _updateWindowFrame]):
     11        Pass the window frame in Carbon coordinates.
     12
     13        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
     14        (WebKit::NetscapePlugin::windowFrameChanged):
     15        Update the window bounds.
     16
     17        * WebProcess/Plugins/PluginView.cpp:
     18        (WebKit::PluginView::setWindowFrame):
     19        Call the plug-in.
     20
     21        (WebKit::PluginView::platformLayer):
     22        Fix a crash when WebCore asked for the layer before it was initialized.
     23
    1242010-10-25  Oliver Hunt  <oliver@apple.com>
    225
  • trunk/WebKit2/UIProcess/API/mac/WKView.mm

    r70357 r70499  
    409409}
    410410
     411static NSScreen *screenForWindow(NSWindow *window)
     412{
     413    if (NSScreen *screen = [window screen]) // nil if the window is off-screen
     414        return screen;
     415   
     416    NSArray *screens = [NSScreen screens];
     417    if ([screens count] > 0)
     418        return [screens objectAtIndex:0]; // screen containing the menubar
     419   
     420    return nil;
     421}
     422
    411423- (void)_updateWindowFrame
    412424{
    413     ASSERT([self window]);
    414 
    415     _data->_page->updateWindowFrame(enclosingIntRect([[self window] frame]));
     425    NSWindow *window = [self window];
     426    ASSERT(window);
     427
     428    // We want the window frame in Carbon coordinates, so flip the Y coordinate.
     429    NSRect windowFrame = [window frame];
     430    NSScreen *screen = ::screenForWindow(window);
     431    windowFrame.origin.y = NSMaxY([screen frame]) - windowFrame.origin.y;
     432
     433    _data->_page->updateWindowFrame(enclosingIntRect(windowFrame));
    416434}
    417435
  • trunk/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm

    r70347 r70499  
    603603}
    604604
    605 void NetscapePlugin::windowFrameChanged(const IntRect&)
    606 {
    607     // FIXME: Implement.
     605void NetscapePlugin::windowFrameChanged(const IntRect& windowFrame)
     606{
     607    switch (m_eventModel) {
     608        case NPEventModelCocoa:
     609            // Nothing to do.
     610            break;
     611
     612        case NPEventModelCarbon: {
     613            Rect bounds;
     614            bounds.top = windowFrame.y() + windowFrame.height();
     615            bounds.left = windowFrame.x();
     616            bounds.right = windowFrame.right();
     617            bounds.bottom = windowFrame.y();
     618           
     619            ::SetWindowBounds(windowRef(), kWindowStructureRgn, &bounds);
     620            break;
     621        }
     622
     623        default:
     624            ASSERT_NOT_REACHED();
     625    }
    608626}
    609627   
  • trunk/WebKit2/WebProcess/Plugins/PluginView.cpp

    r69808 r70499  
    340340    if (!m_plugin)
    341341        return;
    342        
    343     // FIXME: Implement.
     342
     343    m_plugin->windowFrameChanged(windowFrame);
    344344}
    345345
     
    399399PlatformLayer* PluginView::platformLayer() const
    400400{
     401    // The plug-in can be null here if it failed to initialize or hasn't yet been initialized.
     402    if (!m_plugin)
     403        return 0;
     404       
    401405    return m_plugin->pluginLayer();
    402406}
Note: See TracChangeset for help on using the changeset viewer.