diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 20:18:39 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 20:18:39 +0000 |
commit | bd41e70e44d19eb809eb8565b1d8479daef5d8f5 (patch) | |
tree | 0e88d2cbed196214623267a5b4df7d46f10526a2 | |
parent | a35347045e2b2fc1416aefc28d2caf68047897e5 (diff) | |
download | chromium_src-bd41e70e44d19eb809eb8565b1d8479daef5d8f5.zip chromium_src-bd41e70e44d19eb809eb8565b1d8479daef5d8f5.tar.gz chromium_src-bd41e70e44d19eb809eb8565b1d8479daef5d8f5.tar.bz2 |
Inline mac/WebScreenInfoFactory into content::RenderWidgetHostViewMac
This ports the WebKit WebScreenInfoFactory::screenInfo call into RWHVMac
to remove the WebKit dependency. The code is also a bit shorter since
we can re-use existing utilities.
BUG=237267
Review URL: https://chromiumcodereview.appspot.com/17184003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207074 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_mac.mm | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index afa389d..5d2991c 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -47,16 +47,17 @@ #include "third_party/WebKit/public/web/WebInputEvent.h" #include "third_party/WebKit/public/web/WebScreenInfo.h" #include "third_party/WebKit/public/web/mac/WebInputEventFactory.h" -#include "third_party/WebKit/public/web/mac/WebScreenInfoFactory.h" #import "third_party/mozilla/ComplexTextInputPanel.h" #include "ui/base/cocoa/animation_utils.h" #import "ui/base/cocoa/fullscreen_window_manager.h" #import "ui/base/cocoa/underlay_opengl_hosting_window.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/layout.h" +#include "ui/gfx/display.h" #include "ui/gfx/point.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" +#include "ui/gfx/screen.h" #include "ui/gfx/size_conversions.h" #include "ui/surface/io_surface_support_mac.h" #include "webkit/plugins/npapi/webplugin.h" @@ -343,6 +344,24 @@ NSWindow* ApparentWindowForView(NSView* view) { return enclosing_window; } +WebKit::WebScreenInfo GetWebScreenInfo(NSView* view) { + gfx::Display display = + gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(view); + + NSScreen* screen = [NSScreen deepestScreen]; + + WebKit::WebScreenInfo results; + + results.deviceScaleFactor = static_cast<int>(display.device_scale_factor()); + results.depth = NSBitsPerPixelFromDepth([screen depth]); + results.depthPerComponent = NSBitsPerSampleFromDepth([screen depth]); + results.isMonochrome = + [[screen colorSpace] colorSpaceModel] == NSGrayColorSpaceModel; + results.rect = display.bounds(); + results.availableRect = display.work_area(); + return results; +} + } // namespace namespace content { @@ -359,7 +378,7 @@ RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( // static void RenderWidgetHostViewPort::GetDefaultScreenInfo( WebKit::WebScreenInfo* results) { - *results = WebKit::WebScreenInfoFactory::screenInfo(NULL); + *results = GetWebScreenInfo(NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -1549,7 +1568,7 @@ void RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange() { } void RenderWidgetHostViewMac::GetScreenInfo(WebKit::WebScreenInfo* results) { - *results = WebKit::WebScreenInfoFactory::screenInfo(GetNativeView()); + *results = GetWebScreenInfo(GetNativeView()); } gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() { |