Title: [122403] trunk/Source
Revision
122403
Author
[email protected]
Date
2012-07-11 19:01:02 -0700 (Wed, 11 Jul 2012)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (122402 => 122403)


--- trunk/Source/WebKit/mac/ChangeLog	2012-07-12 02:00:45 UTC (rev 122402)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-07-12 02:01:02 UTC (rev 122403)
@@ -1,5 +1,16 @@
 2012-07-11  Mark Rowe  <[email protected]>
 
+        <http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes
+
+        Reviewed by Dan Bernstein.
+
+        * 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.
+
+2012-07-11  Mark Rowe  <[email protected]>
+
         <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros
 
         This removal was handled by a script that translates the relevant macros in to the equivalent checks

Modified: trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm (122402 => 122403)


--- trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm	2012-07-12 02:00:45 UTC (rev 122402)
+++ trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm	2012-07-12 02:01:02 UTC (rev 122403)
@@ -70,20 +70,19 @@
 - (void)_startExitFullScreenAnimationWithDuration:(NSTimeInterval)duration;
 @end
 
-#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
-@interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
-- (NSRect)convertRectToScreen:(NSRect)aRect;
-@end
-
-@implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
-- (NSRect)convertRectToScreen:(NSRect)rect
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
 {
-    NSRect frame = [self frame];
+    return [window convertRectToScreen:rect];
+}
+#else
+static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
+{
+    NSRect frame = [window frame];
     rect.origin.x += frame.origin.x;
     rect.origin.y += frame.origin.y;
     return rect;
 }
-@end
 #endif
 
 @interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard)
@@ -208,10 +207,9 @@
     if (!screen)
         screen = [NSScreen mainScreen];
     NSRect screenFrame = [screen frame];
-    
-    NSRect webViewFrame = [[_webView window] convertRectToScreen:
-                           [_webView convertRect:[_webView frame] toView:nil]];
-    
+
+    NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]);
+
     // Flip coordinate system:
     webViewFrame.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(webViewFrame);
     

Modified: trunk/Source/WebKit2/ChangeLog (122402 => 122403)


--- trunk/Source/WebKit2/ChangeLog	2012-07-12 02:00:45 UTC (rev 122402)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-12 02:01:02 UTC (rev 122403)
@@ -1,5 +1,16 @@
 2012-07-11  Mark Rowe  <[email protected]>
 
+        <http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes
+
+        Reviewed by Dan Bernstein.
+
+        * 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.
+
+2012-07-11  Mark Rowe  <[email protected]>
+
         <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros
 
         This removal was handled by a script that translates the relevant macros in to the equivalent checks

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (122402 => 122403)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-07-12 02:00:45 UTC (rev 122402)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-07-12 02:01:02 UTC (rev 122403)
@@ -62,20 +62,19 @@
 - (void)_startExitFullScreenAnimationWithDuration:(NSTimeInterval)duration;
 @end
 
-#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
-@interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
-- (NSRect)convertRectToScreen:(NSRect)aRect;
-@end
-
-@implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
-- (NSRect)convertRectToScreen:(NSRect)rect
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
 {
-    NSRect frame = [self frame];
+    return [window convertRectToScreen:rect];
+}
+#else
+static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
+{
+    NSRect frame = [window frame];
     rect.origin.x += frame.origin.x;
     rect.origin.y += frame.origin.y;
     return rect;
 }
-@end
 #endif
 
 @interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard)
@@ -217,8 +216,7 @@
         screen = [NSScreen mainScreen];
     NSRect screenFrame = [screen frame];
 
-    NSRect webViewFrame = [[_webView window] convertRectToScreen:
-                           [_webView convertRect:[_webView frame] toView:nil]];
+    NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]);
 
     // Flip coordinate system:
     webViewFrame.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(webViewFrame);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to