Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: webkit/glue/webkit_glue_mac.mm

Issue 58008: Replace webkit/glue/screen_info.h with WebKit/chromium/public/WebScreenInfo.h... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/glue/webkit_glue_mac.mm
===================================================================
--- webkit/glue/webkit_glue_mac.mm (revision 12916)
+++ webkit/glue/webkit_glue_mac.mm (working copy)
@@ -1,69 +0,0 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
-
-#include "config.h"
-
-#include "webkit/glue/webkit_glue.h"
-
-#import <AppKit/AppKit.h>
-
-#include "webkit/glue/screen_info.h"
-
-namespace webkit_glue {
-
-static NSScreen *ScreenForWindow(NSWindow *window) {
- NSScreen *screen = [window screen]; // nil if the window is off-screen
- if (screen)
- return screen;
-
- NSArray *screens = [NSScreen screens];
- if ([screens count] > 0)
- return [screens objectAtIndex:0]; // screen containing the menubar
-
- return nil;
-}
-
-static gfx::Rect ToUserSpace(const NSRect& rect, NSWindow *destination) {
- CGRect user_rect = NSRectToCGRect(rect);
-
- user_rect.origin.y =
- NSMaxY([ScreenForWindow(destination) frame]) -
- (user_rect.origin.y + user_rect.size.height); // flip
-
- if (destination) {
- CGFloat scale = 1 / [destination userSpaceScaleFactor]; // scale down
- user_rect.origin.x *= scale;
- user_rect.origin.y *= scale;
- user_rect.size.width *= scale;
- user_rect.size.height *= scale;
- }
-
- return gfx::Rect(user_rect);
-}
-
-ScreenInfo GetScreenInfoHelper(gfx::NativeView view) {
- NSString *color_space = NSColorSpaceFromDepth([[NSScreen deepestScreen] depth]);
- bool monochrome = color_space == NSCalibratedWhiteColorSpace ||
- color_space == NSCalibratedBlackColorSpace ||
- color_space == NSDeviceWhiteColorSpace ||
- color_space == NSDeviceBlackColorSpace;
-
- ScreenInfo results;
- results.depth =
- NSBitsPerPixelFromDepth([[NSScreen deepestScreen] depth]);
- results.depth_per_component =
- NSBitsPerSampleFromDepth([[NSScreen deepestScreen] depth]);
- results.is_monochrome =
- color_space == NSCalibratedWhiteColorSpace ||
- color_space == NSCalibratedBlackColorSpace ||
- color_space == NSDeviceWhiteColorSpace ||
- color_space == NSDeviceBlackColorSpace;
- results.rect =
- ToUserSpace([ScreenForWindow([view window]) frame], [view window]);
- results.available_rect =
- ToUserSpace([ScreenForWindow([view window]) visibleFrame], [view window]);
- return results;
-}
-
-} // namespace webkit_glue

Powered by Google App Engine
This is Rietveld 408576698