Changeset 122403 in webkit


Ignore:
Timestamp:
Jul 11, 2012 7:01:02 PM (12 years ago)
Author:
mrowe@apple.com
Message:

<http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes

Reviewed by Dan Bernstein.

Source/WebKit/mac:

  • WebView/WebFullScreenController.mm:

(convertRectToScreen): Add a static helper method that calls through to -[NSWindow convertRectToScreen:] on OS versions where it exists
but otherwise provides a compatibility implementation of it.
(-[WebFullScreenController enterFullScreen:]): Call our new helper.

Source/WebKit2:

  • UIProcess/mac/WKFullScreenWindowController.mm:

(convertRectToScreen): Add a static helper method that calls through to -[NSWindow convertRectToScreen:] on OS versions where it exists
but otherwise provides a compatibility implementation of it.
(-[WKFullScreenWindowController enterFullScreen:]): Call our new helper.

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r122400 r122403  
     12012-07-11  Mark Rowe  <mrowe@apple.com>
     2
     3        <http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes
     4
     5        Reviewed by Dan Bernstein.
     6
     7        * WebView/WebFullScreenController.mm:
     8        (convertRectToScreen): Add a static helper method that calls through to -[NSWindow convertRectToScreen:] on OS versions where it exists
     9        but otherwise provides a compatibility implementation of it.
     10        (-[WebFullScreenController enterFullScreen:]): Call our new helper.
     11
    1122012-07-11  Mark Rowe  <mrowe@apple.com>
    213
  • trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm

    r122400 r122403  
    7171@end
    7272
    73 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
    74 @interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
    75 - (NSRect)convertRectToScreen:(NSRect)aRect;
    76 @end
    77 
    78 @implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
    79 - (NSRect)convertRectToScreen:(NSRect)rect
    80 {
    81     NSRect frame = [self frame];
     73#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     74static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
     75{
     76    return [window convertRectToScreen:rect];
     77}
     78#else
     79static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
     80{
     81    NSRect frame = [window frame];
    8282    rect.origin.x += frame.origin.x;
    8383    rect.origin.y += frame.origin.y;
    8484    return rect;
    8585}
    86 @end
    8786#endif
    8887
     
    209208        screen = [NSScreen mainScreen];
    210209    NSRect screenFrame = [screen frame];
    211    
    212     NSRect webViewFrame = [[_webView window] convertRectToScreen:
    213                            [_webView convertRect:[_webView frame] toView:nil]];
    214    
     210
     211    NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]);
     212
    215213    // Flip coordinate system:
    216214    webViewFrame.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(webViewFrame);
  • trunk/Source/WebKit2/ChangeLog

    r122400 r122403  
     12012-07-11  Mark Rowe  <mrowe@apple.com>
     2
     3        <http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes
     4
     5        Reviewed by Dan Bernstein.
     6
     7        * UIProcess/mac/WKFullScreenWindowController.mm:
     8        (convertRectToScreen): Add a static helper method that calls through to -[NSWindow convertRectToScreen:] on OS versions where it exists
     9        but otherwise provides a compatibility implementation of it.
     10        (-[WKFullScreenWindowController enterFullScreen:]): Call our new helper.
     11
    1122012-07-11  Mark Rowe  <mrowe@apple.com>
    213
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm

    r122400 r122403  
    6363@end
    6464
    65 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
    66 @interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
    67 - (NSRect)convertRectToScreen:(NSRect)aRect;
    68 @end
    69 
    70 @implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
    71 - (NSRect)convertRectToScreen:(NSRect)rect
    72 {
    73     NSRect frame = [self frame];
     65#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     66static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
     67{
     68    return [window convertRectToScreen:rect];
     69}
     70#else
     71static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
     72{
     73    NSRect frame = [window frame];
    7474    rect.origin.x += frame.origin.x;
    7575    rect.origin.y += frame.origin.y;
    7676    return rect;
    7777}
    78 @end
    7978#endif
    8079
     
    218217    NSRect screenFrame = [screen frame];
    219218
    220     NSRect webViewFrame = [[_webView window] convertRectToScreen:
    221                            [_webView convertRect:[_webView frame] toView:nil]];
     219    NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]);
    222220
    223221    // Flip coordinate system:
Note: See TracChangeset for help on using the changeset viewer.