From 12456fac1b181983b7ce52789be16e7e436a0996 Mon Sep 17 00:00:00 2001 From: "darin@chromium.org" Date: Wed, 1 Apr 2009 23:07:19 +0000 Subject: Replace webkit/glue/screen_info.h with WebKit/chromium/public/WebScreenInfo.h This also eliminates webkit_glue::GetScreenInfo and webkit_glue::GetScreenInfoHelper. As part of this CL, I also extracted all of the ParamTraits for WebKit API types into chrome/common/webkit_param_traits.h. R=dglazkov Review URL: http://codereview.chromium.org/58008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12993 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/webkit_glue_mac.mm | 69 ------------------------------------------ 1 file changed, 69 deletions(-) delete mode 100644 webkit/glue/webkit_glue_mac.mm (limited to 'webkit/glue/webkit_glue_mac.mm') diff --git a/webkit/glue/webkit_glue_mac.mm b/webkit/glue/webkit_glue_mac.mm deleted file mode 100644 index 484b6f1..0000000 --- a/webkit/glue/webkit_glue_mac.mm +++ /dev/null @@ -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 - -#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 -- cgit v1.1