summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webkit_glue_mac.mm
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-01 23:07:19 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-01 23:07:19 +0000
commit12456fac1b181983b7ce52789be16e7e436a0996 (patch)
treea5a3a92808d8e78d5d620e6f900db60adcb84197 /webkit/glue/webkit_glue_mac.mm
parent31b882b2aac660139d1ea77b953e6c99ab184cb4 (diff)
downloadchromium_src-12456fac1b181983b7ce52789be16e7e436a0996.zip
chromium_src-12456fac1b181983b7ce52789be16e7e436a0996.tar.gz
chromium_src-12456fac1b181983b7ce52789be16e7e436a0996.tar.bz2
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
Diffstat (limited to 'webkit/glue/webkit_glue_mac.mm')
-rw-r--r--webkit/glue/webkit_glue_mac.mm69
1 files changed, 0 insertions, 69 deletions
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 <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