Title: [179639] trunk/Tools
Revision
179639
Author
simon.fra...@apple.com
Date
2015-02-04 14:53:13 -0800 (Wed, 04 Feb 2015)

Log Message

WKTR should not use -mainScreen to pick a color profile
https://bugs.webkit.org/show_bug.cgi?id=141265

Reviewed by Tim Horton.

-[NSScreen mainScreen] depends on the active window, so use the first screen
(which is the one we put the window on anyway).

Do some cleanup in DRT that makes the code look similar.

* DumpRenderTree/mac/DumpRenderTree.mm:
(createWebViewAndOffscreenWindow):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (179638 => 179639)


--- trunk/Tools/ChangeLog	2015-02-04 22:42:49 UTC (rev 179638)
+++ trunk/Tools/ChangeLog	2015-02-04 22:53:13 UTC (rev 179639)
@@ -1,5 +1,22 @@
 2015-02-04  Simon Fraser  <simon.fra...@apple.com>
 
+        WKTR should not use -mainScreen to pick a color profile
+        https://bugs.webkit.org/show_bug.cgi?id=141265
+
+        Reviewed by Tim Horton.
+        
+        -[NSScreen mainScreen] depends on the active window, so use the first screen
+        (which is the one we put the window on anyway).
+        
+        Do some cleanup in DRT that makes the code look similar.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (createWebViewAndOffscreenWindow):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::PlatformWebView):
+
+2015-02-04  Simon Fraser  <simon.fra...@apple.com>
+
         LayoutTestHelper should set the color profile of all displays
         https://bugs.webkit.org/show_bug.cgi?id=141260
 

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (179638 => 179639)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2015-02-04 22:42:49 UTC (rev 179638)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2015-02-04 22:53:13 UTC (rev 179639)
@@ -704,10 +704,11 @@
     
     // To make things like certain NSViews, dragging, and plug-ins work, put the WebView a window, but put it off-screen so you don't see it.
     // Put it at -10000, -10000 in "flipped coordinates", since WebCore and the DOM use flipped coordinates.
-    NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
+    NSScreen *firstScreen = [[NSScreen screens] firstObject];
+    NSRect windowRect = NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
     DumpRenderTreeWindow *window = [[DumpRenderTreeWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
 
-    [window setColorSpace:[[[NSScreen screens] objectAtIndex:0] colorSpace]];
+    [window setColorSpace:[firstScreen colorSpace]];
     [window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
     [[window contentView] addSubview:webView];
     [window orderBack:nil];

Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (179638 => 179639)


--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2015-02-04 22:42:49 UTC (rev 179638)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2015-02-04 22:53:13 UTC (rev 179639)
@@ -141,10 +141,11 @@
     m_view = [[TestRunnerWKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:relatedPage useThreadedScrolling:useThreadedScrolling];
     [m_view setWindowOcclusionDetectionEnabled:NO];
 
-    NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
+    NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
+    NSRect windowRect = NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
     m_window = [[WebKitTestRunnerWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:(NSBackingStoreType)_NSBackingStoreUnbuffered defer:YES];
     m_window.platformWebView = this;
-    [m_window setColorSpace:[[NSScreen mainScreen] colorSpace]];
+    [m_window setColorSpace:[firstScreen colorSpace]];
     [m_window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
     [[m_window contentView] addSubview:m_view];
     [m_window orderBack:nil];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to