diff options
41 files changed, 173 insertions, 176 deletions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 67335f8..a0b460f 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1567,8 +1567,8 @@ const Experiment kExperiments[] = { IDS_FLAGS_HIDPI_NAME, IDS_FLAGS_HIDPI_DESCRIPTION, kOsWin, - ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kHighDPISupport, "1", - switches::kHighDPISupport, "0") + ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(gfx::switches::kHighDPISupport, "1", + gfx::switches::kHighDPISupport, "0") }, #if defined(OS_CHROMEOS) { diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 26258d6..4a04a96 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -174,7 +174,7 @@ #include "net/base/net_util.h" #include "printing/printed_document.h" #include "ui/base/l10n/l10n_util_win.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #endif // defined(OS_WIN) #if defined(OS_MACOSX) @@ -924,7 +924,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { local_state_->GetString(prefs::kApplicationLocale); #if defined(OS_WIN) - ui::EnableHighDPISupport(); + gfx::EnableHighDPISupport(); #endif // On a POSIX OS other than ChromeOS, the parameter that is passed to the diff --git a/chrome/browser/extensions/api/system_display/display_info_provider_win.cc b/chrome/browser/extensions/api/system_display/display_info_provider_win.cc index 846d777..57a4c3a 100644 --- a/chrome/browser/extensions/api/system_display/display_info_provider_win.cc +++ b/chrome/browser/extensions/api/system_display/display_info_provider_win.cc @@ -7,8 +7,8 @@ #include <windows.h> #include "base/strings/utf_string_conversions.h" -#include "ui/base/win/dpi.h" #include "ui/gfx/display.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/size.h" namespace extensions { @@ -41,7 +41,7 @@ BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor, gfx::Display display(0, gfx::Rect(monitor_info.rcMonitor)); display.set_work_area(gfx::Rect(monitor_info.rcWork)); - gfx::Size dpi(ui::GetDPI()); + gfx::Size dpi(gfx::GetDPI()); unit->id = WideToUTF8(device.DeviceID); unit->name = WideToUTF8(device.DeviceString); unit->is_primary = monitor_info.dwFlags & MONITORINFOF_PRIMARY ? true : false; diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index b8d66c3..b55fab7 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -58,7 +58,7 @@ #if defined(OS_WIN) #include "base/win/metro.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx extern "C" IMAGE_DOS_HEADER __ImageBase; @@ -305,8 +305,8 @@ BOOL CALLBACK GetMonitorDPICallback(HMONITOR, HDC hdc, LPRECT, LPARAM dwData) { GetDeviceCaps(hdc, HORZRES) / (size_x / kMillimetersPerInch) : 0; double dpi_y = (size_y > 0) ? GetDeviceCaps(hdc, VERTRES) / (size_y / kMillimetersPerInch) : 0; - dpi_x *= ui::win::GetUndocumentedDPIScale(); - dpi_y *= ui::win::GetUndocumentedDPIScale(); + dpi_x *= gfx::win::GetUndocumentedDPIScale(); + dpi_y *= gfx::win::GetUndocumentedDPIScale(); screen_info->max_dpi_x = std::max(dpi_x, screen_info->max_dpi_x); screen_info->max_dpi_y = std::max(dpi_y, screen_info->max_dpi_y); return TRUE; diff --git a/chrome/browser/ui/views/frame/browser_desktop_root_window_host_win.cc b/chrome/browser/ui/views/frame/browser_desktop_root_window_host_win.cc index 975844b..6310a02 100644 --- a/chrome/browser/ui/views/frame/browser_desktop_root_window_host_win.cc +++ b/chrome/browser/ui/views/frame/browser_desktop_root_window_host_win.cc @@ -17,7 +17,7 @@ #include "chrome/browser/ui/views/theme_image_mapper.h" #include "grit/theme_resources.h" #include "ui/base/theme_provider.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #include "ui/views/controls/menu/native_menu_win.h" #pragma comment(lib, "dwmapi.lib") @@ -272,7 +272,7 @@ void BrowserDesktopRootWindowHostWin::UpdateDWMFrame() { if (!browser_view_->IsFullscreen()) { gfx::Rect tabstrip_bounds( browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); - tabstrip_bounds = ui::win::DIPToScreenRect(tabstrip_bounds); + tabstrip_bounds = gfx::win::DIPToScreenRect(tabstrip_bounds); margins.cyTopHeight = tabstrip_bounds.bottom() + kDWMFrameTopOffset; } } diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc index 6068ede..872ae88 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -35,8 +35,8 @@ #include "ui/base/models/simple_menu_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/theme_provider.h" -#include "ui/base/win/dpi.h" #include "ui/base/window_open_disposition.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/font.h" #include "ui/views/controls/menu/native_menu_win.h" #include "ui/views/views_delegate.h" @@ -440,7 +440,7 @@ void BrowserFrameWin::UpdateDWMFrame() { if (!IsFullscreen()) { gfx::Rect tabstrip_bounds( browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); - tabstrip_bounds = ui::win::DIPToScreenRect(tabstrip_bounds); + tabstrip_bounds = gfx::win::DIPToScreenRect(tabstrip_bounds); margins.cyTopHeight = tabstrip_bounds.bottom() + kDWMFrameTopOffset; } } diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index 512bad3..a6c83e7 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc @@ -25,8 +25,8 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle_win.h" #include "ui/base/theme_provider.h" -#include "ui/base/win/dpi.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/icon_util.h" #include "ui/gfx/image/image.h" #include "ui/views/controls/label.h" @@ -275,7 +275,7 @@ int GlassBrowserFrameView::NonClientTopBorderHeight( // We'd like to use FrameBorderThickness() here, but the maximized Aero glass // frame has a 0 frame border around most edges and a CYSIZEFRAME-thick border // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). - return ui::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME) + + return gfx::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME) + ((!restored && !frame()->ShouldLeaveOffsetNearTopBorder()) ? -kTabstripTopShadowThickness : kNonClientRestoredExtraThickness); } diff --git a/chrome/browser/ui/views/frame/minimize_button_metrics_win.cc b/chrome/browser/ui/views/frame/minimize_button_metrics_win.cc index 827aeda..784c483 100644 --- a/chrome/browser/ui/views/frame/minimize_button_metrics_win.cc +++ b/chrome/browser/ui/views/frame/minimize_button_metrics_win.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "base/i18n/rtl.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" namespace { @@ -21,10 +21,10 @@ int GetMinimizeButtonOffsetForWindow(HWND hwnd) { // Chrome is not DPIAware we need to properly scale the coordinates as // MapWindowPoints() expects scaled coordinates. POINT minimize_button_corner = { titlebar_info.rgrect[2].left / - ui::win::GetUndocumentedDPIScale(), + gfx::win::GetUndocumentedDPIScale(), 0 }; MapWindowPoints(HWND_DESKTOP, hwnd, &minimize_button_corner, 1); - return minimize_button_corner.x / ui::win::GetDeviceScaleFactor(); + return minimize_button_corner.x / gfx::win::GetDeviceScaleFactor(); } } // namespace diff --git a/chrome/browser/ui/views/tabs/dragged_tab_view.cc b/chrome/browser/ui/views/tabs/dragged_tab_view.cc index 9c5e19f..e203fcb 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_view.cc @@ -13,7 +13,7 @@ #if defined(USE_AURA) #include "ui/views/widget/native_widget_aura.h" #elif defined(OS_WIN) -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #include "ui/views/widget/native_widget_win.h" #endif @@ -82,7 +82,7 @@ void DraggedTabView::MoveTo(const gfx::Point& screen_point) { int y = screen_point.y() - ScaleValue(mouse_tab_offset_.y()); #if defined(OS_WIN) && !defined(USE_AURA) - double scale = ui::win::GetDeviceScaleFactor(); + double scale = gfx::win::GetDeviceScaleFactor(); x = static_cast<int>(scale * screen_point.x()); y = static_cast<int>(scale * screen_point.y()); // TODO(beng): make this cross-platform diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 3f1bc1c..9fc34c2 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -49,7 +49,7 @@ #include "sandbox/win/src/sandbox_types.h" #include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_switches.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #include "webkit/common/user_agent/user_agent.h" #if defined(USE_TCMALLOC) diff --git a/content/browser/renderer_host/backing_store_win.cc b/content/browser/renderer_host/backing_store_win.cc index aea1985..9992fde 100644 --- a/content/browser/renderer_host/backing_store_win.cc +++ b/content/browser/renderer_host/backing_store_win.cc @@ -9,7 +9,7 @@ #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/public/common/content_switches.h" #include "skia/ext/platform_canvas.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/gdi_util.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/size_conversions.h" @@ -92,7 +92,7 @@ bool BackingStoreWin::ColorManagementEnabled() { size_t BackingStoreWin::MemorySize() { gfx::Size size_in_pixels = gfx::ToCeiledSize(gfx::ScaleSize(size(), - ui::win::GetDeviceScaleFactor())); + gfx::win::GetDeviceScaleFactor())); return size_in_pixels.GetArea() * (color_depth_ / 8); } @@ -174,7 +174,7 @@ void BackingStoreWin::ScrollBackingStore(const gfx::Vector2d& delta, // TODO(darin): this doesn't work if delta x() and y() are both non-zero! DCHECK(delta.x() == 0 || delta.y() == 0); - float scale = ui::win::GetDeviceScaleFactor(); + float scale = gfx::win::GetDeviceScaleFactor(); gfx::Rect screen_rect = gfx::ToEnclosingRect( gfx::ScaleRect(clip_rect, scale)); int dx = static_cast<int>(delta.x() * scale); diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc index 9e7f10e..0c98502 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc @@ -29,8 +29,8 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_data.h" #include "content/public/common/content_switches.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/gdi_util.h" #endif @@ -169,7 +169,7 @@ BOOL CALLBACK PaintEnumChildProc(HWND hwnd, LPARAM lparam) { return TRUE; gfx::Rect* rect = reinterpret_cast<gfx::Rect*>(lparam); - gfx::Rect rect_in_pixels = ui::win::DIPToScreenRect(*rect); + gfx::Rect rect_in_pixels = gfx::win::DIPToScreenRect(*rect); static UINT msg = RegisterWindowMessage(kPaintMessageName); WPARAM wparam = MAKEWPARAM(rect_in_pixels.x(), rect_in_pixels.y()); lparam = MAKELPARAM(rect_in_pixels.width(), rect_in_pixels.height()); @@ -284,7 +284,7 @@ void RenderWidgetHostViewBase::MovePluginWindowsHelper( #endif if (move.rects_valid) { - gfx::Rect clip_rect_in_pixel = ui::win::DIPToScreenRect(move.clip_rect); + gfx::Rect clip_rect_in_pixel = gfx::win::DIPToScreenRect(move.clip_rect); HRGN hrgn = ::CreateRectRgn(clip_rect_in_pixel.x(), clip_rect_in_pixel.y(), clip_rect_in_pixel.right(), @@ -313,7 +313,7 @@ void RenderWidgetHostViewBase::MovePluginWindowsHelper( } gfx::Rect window_rect_in_pixel = - ui::win::DIPToScreenRect(move.window_rect); + gfx::win::DIPToScreenRect(move.window_rect); defer_window_pos_info = ::DeferWindowPos(defer_window_pos_info, window, NULL, window_rect_in_pixel.x(), diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index 9adb554..4b7c75e 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc @@ -29,6 +29,7 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "ui/base/ui_base_switches.h" #include "ui/gfx/size_conversions.h" +#include "ui/gfx/switches.h" #include "ui/gl/gl_switches.h" #if defined(OS_MACOSX) @@ -36,7 +37,7 @@ #endif #if defined(OS_WIN) -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #endif namespace content { @@ -834,8 +835,8 @@ class CompositingRenderWidgetHostViewTabCaptureHighDPI cmd->AppendSwitchASCII(switches::kForceDeviceScaleFactor, base::StringPrintf("%f", scale())); #if defined(OS_WIN) - cmd->AppendSwitchASCII(switches::kHighDPISupport, "1"); - ui::EnableHighDPISupport(); + cmd->AppendSwitchASCII(gfx::switches::kHighDPISupport, "1"); + gfx::EnableHighDPISupport(); #endif } diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index 6aefe0f..c8c4dc4 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -67,11 +67,11 @@ #include "ui/base/touch/touch_enabled.h" #include "ui/base/ui_base_switches.h" #include "ui/base/view_prop.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" #include "ui/base/win/mouse_wheel_util.h" #include "ui/base/win/touch_input.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/rect.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/screen.h" @@ -324,7 +324,7 @@ void GetScreenInfoForWindow(gfx::NativeViewId id, WebKit::WebScreenInfo screen_info; screen_info.depth = dev_mode.dmBitsPerPel; screen_info.depthPerComponent = dev_mode.dmBitsPerPel / 3; // Assumes RGB - screen_info.deviceScaleFactor = ui::win::GetDeviceScaleFactor(); + screen_info.deviceScaleFactor = gfx::win::GetDeviceScaleFactor(); screen_info.isMonochrome = dev_mode.dmColor == DMCOLOR_MONOCHROME; screen_info.rect = gfx::Rect(monitor_info.rcMonitor); screen_info.availableRect = gfx::Rect(monitor_info.rcWork); @@ -644,7 +644,7 @@ bool RenderWidgetHostViewWin::IsShowing() { } gfx::Rect RenderWidgetHostViewWin::GetViewBounds() const { - return ui::win::ScreenToDIPRect(GetPixelBounds()); + return gfx::win::ScreenToDIPRect(GetPixelBounds()); } gfx::Rect RenderWidgetHostViewWin::GetPixelBounds() const { @@ -774,7 +774,7 @@ void RenderWidgetHostViewWin::DidUpdateBackingStore( // surprisingly, this ordering matters. for (size_t i = 0; i < copy_rects.size(); ++i) { - gfx::Rect pixel_rect = ui::win::DIPToScreenRect(copy_rects[i]); + gfx::Rect pixel_rect = gfx::win::DIPToScreenRect(copy_rects[i]); // Damage might not be DIP aligned. pixel_rect.Inset(-1, -1); RECT bounds = pixel_rect.ToRECT(); @@ -783,11 +783,11 @@ void RenderWidgetHostViewWin::DidUpdateBackingStore( if (!scroll_rect.IsEmpty()) { TRACE_EVENT0("content", "ScrollWindowEx"); - gfx::Rect pixel_rect = ui::win::DIPToScreenRect(scroll_rect); + gfx::Rect pixel_rect = gfx::win::DIPToScreenRect(scroll_rect); // Damage might not be DIP aligned. pixel_rect.Inset(-1, -1); RECT clip_rect = pixel_rect.ToRECT(); - float scale = ui::win::GetDeviceScaleFactor(); + float scale = gfx::win::GetDeviceScaleFactor(); int dx = static_cast<int>(scale * scroll_delta.x()); int dy = static_cast<int>(scale * scroll_delta.y()); ScrollWindowEx(dx, dy, NULL, &clip_rect, NULL, NULL, SW_INVALIDATE); @@ -1316,7 +1316,7 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { if (backing_store) { gfx::Rect bitmap_rect(gfx::Point(), - ui::win::DIPToScreenSize(backing_store->size())); + gfx::win::DIPToScreenSize(backing_store->size())); bool manage_colors = BackingStoreWin::ColorManagementEnabled(); if (manage_colors) @@ -2004,7 +2004,7 @@ LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam, if (render_widget_host_) { WebKit::WebMouseWheelEvent wheel_event = WebMouseWheelEventBuilder::Build(m_hWnd, message, wparam, lparam); - float scale = ui::win::GetDeviceScaleFactor(); + float scale = gfx::win::GetDeviceScaleFactor(); wheel_event.x /= scale; wheel_event.y /= scale; wheel_event.deltaX /= scale; @@ -2171,19 +2171,19 @@ bool WebTouchState::UpdateTouchPoint( TOUCHINPUT* touch_input) { CPoint coordinates( TOUCH_COORD_TO_PIXEL(touch_input->x) / - ui::win::GetUndocumentedDPITouchScale(), + gfx::win::GetUndocumentedDPITouchScale(), TOUCH_COORD_TO_PIXEL(touch_input->y) / - ui::win::GetUndocumentedDPITouchScale()); + gfx::win::GetUndocumentedDPITouchScale()); int radius_x = 1; int radius_y = 1; if (touch_input->dwMask & TOUCHINPUTMASKF_CONTACTAREA) { // Some touch drivers send a contact area of "-1", yet flag it as valid. radius_x = std::max(1, static_cast<int>(TOUCH_COORD_TO_PIXEL(touch_input->cxContact) / - ui::win::GetUndocumentedDPITouchScale())); + gfx::win::GetUndocumentedDPITouchScale())); radius_y = std::max(1, static_cast<int>(TOUCH_COORD_TO_PIXEL(touch_input->cyContact) / - ui::win::GetUndocumentedDPITouchScale())); + gfx::win::GetUndocumentedDPITouchScale())); } // Detect and exclude stationary moves. @@ -2199,7 +2199,7 @@ bool WebTouchState::UpdateTouchPoint( touch_point->screenPosition.x = coordinates.x; touch_point->screenPosition.y = coordinates.y; window_->ScreenToClient(&coordinates); - static float scale = ui::win::GetDeviceScaleFactor(); + static float scale = gfx::win::GetDeviceScaleFactor(); touch_point->position.x = coordinates.x / scale; touch_point->position.y = coordinates.y / scale; touch_point->radiusX = radius_x; @@ -2247,9 +2247,9 @@ LRESULT RenderWidgetHostViewWin::OnTouchEvent(UINT message, WPARAM wparam, pointer_down_context_ = true; last_touch_location_ = gfx::Point( TOUCH_COORD_TO_PIXEL(points[0].x) / - ui::win::GetUndocumentedDPITouchScale(), + gfx::win::GetUndocumentedDPITouchScale(), TOUCH_COORD_TO_PIXEL(points[0].y) / - ui::win::GetUndocumentedDPITouchScale()); + gfx::win::GetUndocumentedDPITouchScale()); } bool should_forward = render_widget_host_->ShouldForwardTouchEvent() && @@ -2513,7 +2513,7 @@ gfx::Rect RenderWidgetHostViewWin::GetBoundsInRootWindow() { GetSystemMetrics(SM_CYSIZEFRAME)); } - return ui::win::ScreenToDIPRect(rect); + return gfx::win::ScreenToDIPRect(rect); } // Creates a HWND within the RenderWidgetHostView that will serve as a host @@ -2894,7 +2894,7 @@ void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message, return; } - gfx::Point point = ui::win::ScreenToDIPPoint( + gfx::Point point = gfx::win::ScreenToDIPPoint( gfx::Point(static_cast<short>(LOWORD(lparam)), static_cast<short>(HIWORD(lparam)))); lparam = MAKELPARAM(point.x(), point.y()); @@ -2973,7 +2973,7 @@ void RenderWidgetHostViewWin::DoPopupOrFullscreenInit(HWND parent_hwnd, const gfx::Rect& pos, DWORD ex_style) { Create(parent_hwnd, NULL, NULL, WS_POPUP, ex_style); - gfx::Rect screen_rect = ui::win::DIPToScreenRect(pos); + gfx::Rect screen_rect = gfx::win::DIPToScreenRect(pos); MoveWindow(screen_rect.x(), screen_rect.y(), screen_rect.width(), screen_rect.height(), TRUE); ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); diff --git a/content/child/npapi/webplugin_delegate_impl_win.cc b/content/child/npapi/webplugin_delegate_impl_win.cc index 766b552..2f1d488 100644 --- a/content/child/npapi/webplugin_delegate_impl_win.cc +++ b/content/child/npapi/webplugin_delegate_impl_win.cc @@ -31,8 +31,8 @@ #include "content/public/common/content_constants.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/public/web/WebInputEvent.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" +#include "ui/gfx/dpi_win.h" #include "webkit/common/cursors/webcursor.h" using WebKit::WebKeyboardEvent; @@ -775,8 +775,8 @@ bool WebPluginDelegateImpl::WindowedReposition( return false; } - gfx::Rect window_rect = ui::win::DIPToScreenRect(window_rect_in_dip); - gfx::Rect clip_rect = ui::win::DIPToScreenRect(clip_rect_in_dip); + gfx::Rect window_rect = gfx::win::DIPToScreenRect(window_rect_in_dip); + gfx::Rect clip_rect = gfx::win::DIPToScreenRect(clip_rect_in_dip); if (window_rect_ == window_rect && clip_rect_ == clip_rect) return false; diff --git a/remoting/host/plugin/host_plugin.cc b/remoting/host/plugin/host_plugin.cc index 0a8b161..b8e2b13 100644 --- a/remoting/host/plugin/host_plugin.cc +++ b/remoting/host/plugin/host_plugin.cc @@ -21,7 +21,7 @@ #include "remoting/host/plugin/host_plugin_utils.h" #include "remoting/host/plugin/host_script_object.h" #if defined(OS_WIN) -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #endif #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npfunctions.h" @@ -545,7 +545,7 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs #endif #if defined(OS_WIN) - ui::EnableHighDPISupport(); + gfx::EnableHighDPISupport(); #endif return NPERR_NO_ERROR; diff --git a/ui/base/l10n/l10n_util_win.cc b/ui/base/l10n/l10n_util_win.cc index 123b74f..c49452c 100644 --- a/ui/base/l10n/l10n_util_win.cc +++ b/ui/base/l10n/l10n_util_win.cc @@ -15,7 +15,7 @@ #include "base/win/windows_version.h" #include "grit/app_locale_settings.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" namespace { @@ -151,7 +151,7 @@ bool NeedOverrideDefaultUIFont(string16* override_font_family, } void AdjustUIFont(LOGFONT* logfont) { - AdjustUIFontForDIP(ui::GetDPIScale(), logfont); + AdjustUIFontForDIP(gfx::GetDPIScale(), logfont); } void AdjustUIFontForDIP(float dpi_scale, LOGFONT* logfont) { diff --git a/ui/base/l10n/l10n_util_win_unittest.cc b/ui/base/l10n/l10n_util_win_unittest.cc index 10e4963..3ef1100 100644 --- a/ui/base/l10n/l10n_util_win_unittest.cc +++ b/ui/base/l10n/l10n_util_win_unittest.cc @@ -9,7 +9,7 @@ #include "base/win/win_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" typedef PlatformTest L10nUtilWinTest; diff --git a/ui/base/layout.cc b/ui/base/layout.cc index d384301..c035ae9 100644 --- a/ui/base/layout.cc +++ b/ui/base/layout.cc @@ -23,7 +23,7 @@ #if defined(OS_WIN) #include "base/win/metro.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #include <Windows.h> #endif // defined(OS_WIN) @@ -124,7 +124,7 @@ std::vector<ScaleFactor>& GetSupportedScaleFactorsInternal() { // Have high-DPI resources for 140% and 180% scaling on Windows based on // default scaling for Metro mode. Round to nearest supported scale in // all cases. - if (ui::IsInHighDPIMode()) { + if (gfx::IsInHighDPIMode()) { supported_scale_factors->push_back(SCALE_FACTOR_140P); supported_scale_factors->push_back(SCALE_FACTOR_180P); } diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc index ec47d4c..ffd2cd0 100644 --- a/ui/base/resource/resource_bundle_win.cc +++ b/ui/base/resource/resource_bundle_win.cc @@ -10,7 +10,7 @@ #include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_data_dll_win.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" namespace ui { @@ -42,7 +42,7 @@ void ResourceBundle::LoadCommonResources() { // default scaling for Metro mode. If high-DPI mode is enabled, load resource // pak closest to the desired scale factor. The high-DPI resources are // scaled up from 100% touch. - float scale = ui::win::GetDeviceScaleFactor(); + float scale = gfx::win::GetDeviceScaleFactor(); bool force_touch_resources = false; switch(ui::GetScaleFactorFromScale(scale)) { case ui::SCALE_FACTOR_180P: diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc index bf5fff3..3adb215 100644 --- a/ui/base/ui_base_switches.cc +++ b/ui/base/ui_base_switches.cc @@ -33,9 +33,6 @@ const char kEnableTouchEditing[] = "enable-touch-editing"; // Enables the Views textfield on Windows. const char kEnableViewsTextfield[] = "enable-views-textfield"; -// Enables/Disables High DPI support (windows) -const char kHighDPISupport[] = "high-dpi-support"; - // Overrides the device scale factor for the browser UI and the contents. const char kForceDeviceScaleFactor[] = "force-device-scale-factor"; diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h index 4f0850b..cbe9a77 100644 --- a/ui/base/ui_base_switches.h +++ b/ui/base/ui_base_switches.h @@ -22,7 +22,6 @@ UI_EXPORT extern const char kEnableTouchDragDrop[]; UI_EXPORT extern const char kEnableTouchEditing[]; UI_EXPORT extern const char kEnableViewsTextfield[]; UI_EXPORT extern const char kForceDeviceScaleFactor[]; -UI_EXPORT extern const char kHighDPISupport[]; UI_EXPORT extern const char kHighlightMissingScaledResources[]; UI_EXPORT extern const char kLang[]; UI_EXPORT extern const char kLocalePak[]; diff --git a/ui/base/win/events_win.cc b/ui/base/win/events_win.cc index bcd72727..4381cb0 100644 --- a/ui/base/win/events_win.cc +++ b/ui/base/win/events_win.cc @@ -11,7 +11,7 @@ #include "base/win/win_util.h" #include "ui/base/events/event_utils.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/point.h" namespace ui { @@ -213,7 +213,7 @@ gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { GET_Y_LPARAM(native_event.lParam) }; ScreenToClient(native_event.hwnd, &native_point); gfx::Point location(native_point); - location = ui::win::ScreenToDIPPoint(location); + location = gfx::win::ScreenToDIPPoint(location); return location; } diff --git a/ui/base/win/hwnd_subclass.cc b/ui/base/win/hwnd_subclass.cc index fc4f6c9..cd557fa 100644 --- a/ui/base/win/hwnd_subclass.cc +++ b/ui/base/win/hwnd_subclass.cc @@ -9,8 +9,8 @@ #include "base/logging.h" #include "base/memory/scoped_vector.h" #include "base/memory/singleton.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" +#include "ui/gfx/dpi_win.h" namespace { const char kHWNDSubclassKey[] = "__UI_BASE_WIN_HWND_SUBCLASS_PROC__"; @@ -144,9 +144,9 @@ LRESULT HWNDSubclass::OnWndProc(HWND hwnd, &point, sizeof(TOUCHINPUT))) { POINT touch_location = { TOUCH_COORD_TO_PIXEL(point.x) / - ui::win::GetUndocumentedDPITouchScale(), + gfx::win::GetUndocumentedDPITouchScale(), TOUCH_COORD_TO_PIXEL(point.y) / - ui::win::GetUndocumentedDPITouchScale()}; + gfx::win::GetUndocumentedDPITouchScale()}; HWND actual_target = WindowFromPoint(touch_location); if (actual_target != hwnd) { return SendMessage(actual_target, message, w_param, l_param); diff --git a/ui/gfx/canvas_paint_win.cc b/ui/gfx/canvas_paint_win.cc index 661b297..71c8367 100644 --- a/ui/gfx/canvas_paint_win.cc +++ b/ui/gfx/canvas_paint_win.cc @@ -56,7 +56,7 @@ void CanvasSkiaPaint::Init(bool opaque) { const int height = ps_.rcPaint.bottom - ps_.rcPaint.top; RecreateBackingCanvas(gfx::Size(width, height), - ui::GetScaleFactorFromScale(ui::win::GetDeviceScaleFactor()), + ui::GetScaleFactorFromScale(gfx::win::GetDeviceScaleFactor()), opaque); skia::PlatformCanvas* canvas = platform_canvas(); @@ -65,8 +65,8 @@ void CanvasSkiaPaint::Init(bool opaque) { // This will bring the canvas into the screen coordinate system for the // dirty rect canvas->translate( - -ps_.rcPaint.left / ui::win::GetDeviceScaleFactor(), - -ps_.rcPaint.top / ui::win::GetDeviceScaleFactor()); + -ps_.rcPaint.left / gfx::win::GetDeviceScaleFactor(), + -ps_.rcPaint.top / gfx::win::GetDeviceScaleFactor()); } } // namespace gfx diff --git a/ui/gfx/canvas_paint_win.h b/ui/gfx/canvas_paint_win.h index d9326e30..ed31a6e 100644 --- a/ui/gfx/canvas_paint_win.h +++ b/ui/gfx/canvas_paint_win.h @@ -6,8 +6,8 @@ #define UI_GFX_CANVAS_PAINT_WIN_H_ #include "skia/ext/platform_canvas.h" -#include "ui/base/win/dpi.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/size.h" namespace gfx { diff --git a/ui/base/win/dpi.cc b/ui/gfx/dpi_win.cc index cbb5890..51972d2 100644 --- a/ui/base/win/dpi.cc +++ b/ui/gfx/dpi_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #include <windows.h> #include "base/command_line.h" @@ -10,8 +10,8 @@ #include "base/win/windows_version.h" #include "ui/base/layout.h" #include "base/win/registry.h" -#include "ui/base/ui_base_switches.h" #include "ui/gfx/display.h" +#include "ui/gfx/switches.h" #include "ui/gfx/point_conversions.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/size_conversions.h" @@ -24,9 +24,10 @@ int kDefaultDPIY = 96; // Tests to see if the command line flag "--high-dpi-support" is set. bool IsHighDPIEnabled() { // Default is disabled. - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kHighDPISupport)) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + gfx::switches::kHighDPISupport)) { return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kHighDPISupport).compare("1") == 0; + gfx::switches::kHighDPISupport).compare("1") == 0; } return false; } @@ -37,7 +38,7 @@ bool IsHighDPIEnabled() { float GetDeviceScaleFactorImpl() { if (IsHighDPIEnabled()) { float scale = gfx::Display::HasForceDeviceScaleFactor() ? - gfx::Display::GetForcedDeviceScaleFactor() : ui::GetDPIScale(); + gfx::Display::GetForcedDeviceScaleFactor() : gfx::GetDPIScale(); // Quantize to nearest supported scale factor. scale = ui::GetScaleFactorScale(ui::GetScaleFactorFromScale(scale)); return scale; @@ -57,9 +58,9 @@ BOOL IsProcessDPIAwareWrapper() { } // namespace -namespace ui { +namespace gfx { -gfx::Size GetDPI() { +Size GetDPI() { static int dpi_x = 0; static int dpi_y = 0; static bool should_initialize = true; @@ -73,7 +74,7 @@ gfx::Size GetDPI() { dpi_x = GetDeviceCaps(screen_dc, LOGPIXELSX); dpi_y = GetDeviceCaps(screen_dc, LOGPIXELSY); } - return gfx::Size(dpi_x, dpi_y); + return Size(dpi_x, dpi_y); } float GetDPIScale() { @@ -107,35 +108,33 @@ float GetDeviceScaleFactor() { return device_scale_factor; } -gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point) { - return gfx::ToFlooredPoint( - gfx::ScalePoint(pixel_point, 1.0f / GetDeviceScaleFactor())); +Point ScreenToDIPPoint(const Point& pixel_point) { + return ToFlooredPoint(ScalePoint(pixel_point, 1.0f / GetDeviceScaleFactor())); } -gfx::Point DIPToScreenPoint(const gfx::Point& dip_point) { - return gfx::ToFlooredPoint( - gfx::ScalePoint(dip_point, GetDeviceScaleFactor())); +Point DIPToScreenPoint(const Point& dip_point) { + return ToFlooredPoint(ScalePoint(dip_point, GetDeviceScaleFactor())); } -gfx::Rect ScreenToDIPRect(const gfx::Rect& pixel_bounds) { +Rect ScreenToDIPRect(const Rect& pixel_bounds) { // TODO(kevers): Switch to non-deprecated method for float to int conversions. - return gfx::ToFlooredRectDeprecated( - gfx::ScaleRect(pixel_bounds, 1.0f / GetDeviceScaleFactor())); + return ToFlooredRectDeprecated( + ScaleRect(pixel_bounds, 1.0f / GetDeviceScaleFactor())); } -gfx::Rect DIPToScreenRect(const gfx::Rect& dip_bounds) { +Rect DIPToScreenRect(const Rect& dip_bounds) { // TODO(kevers): Switch to non-deprecated method for float to int conversions. - return gfx::ToFlooredRectDeprecated( - gfx::ScaleRect(dip_bounds, GetDeviceScaleFactor())); + return ToFlooredRectDeprecated( + ScaleRect(dip_bounds, GetDeviceScaleFactor())); } -gfx::Size ScreenToDIPSize(const gfx::Size& size_in_pixels) { - return gfx::ToFlooredSize( - gfx::ScaleSize(size_in_pixels, 1.0f / GetDeviceScaleFactor())); +Size ScreenToDIPSize(const Size& size_in_pixels) { + return ToFlooredSize( + ScaleSize(size_in_pixels, 1.0f / GetDeviceScaleFactor())); } -gfx::Size DIPToScreenSize(const gfx::Size& dip_size) { - return gfx::ToFlooredSize(gfx::ScaleSize(dip_size, GetDeviceScaleFactor())); +Size DIPToScreenSize(const Size& dip_size) { + return ToFlooredSize(ScaleSize(dip_size, GetDeviceScaleFactor())); } int GetSystemMetricsInDIP(int metric) { @@ -173,5 +172,4 @@ double GetUndocumentedDPITouchScale() { } // namespace win - -} // namespace ui +} // namespace gfx diff --git a/ui/base/win/dpi.h b/ui/gfx/dpi_win.h index 86a3883..a056f53 100644 --- a/ui/base/win/dpi.h +++ b/ui/gfx/dpi_win.h @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_BASE_WIN_DPI_H_ -#define UI_BASE_WIN_DPI_H_ +#ifndef UI_GFX_DPI_WIN_H_ +#define UI_GFX_DPI_WIN_H_ +#include "ui/gfx/gfx_export.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -#include "ui/base/ui_export.h" -namespace ui { +namespace gfx { -UI_EXPORT gfx::Size GetDPI(); +UI_EXPORT Size GetDPI(); // Gets the scale factor of the display. For example, if the display DPI is // 96 then the scale factor is 1.0. @@ -28,17 +28,17 @@ namespace win { UI_EXPORT float GetDeviceScaleFactor(); -UI_EXPORT gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point); +UI_EXPORT Point ScreenToDIPPoint(const Point& pixel_point); -UI_EXPORT gfx::Point DIPToScreenPoint(const gfx::Point& dip_point); +UI_EXPORT Point DIPToScreenPoint(const Point& dip_point); -UI_EXPORT gfx::Rect ScreenToDIPRect(const gfx::Rect& pixel_bounds); +UI_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds); -UI_EXPORT gfx::Rect DIPToScreenRect(const gfx::Rect& dip_bounds); +UI_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds); -UI_EXPORT gfx::Size ScreenToDIPSize(const gfx::Size& size_in_pixels); +UI_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels); -UI_EXPORT gfx::Size DIPToScreenSize(const gfx::Size& dip_size); +UI_EXPORT Size DIPToScreenSize(const Size& dip_size); // Win32's GetSystemMetrics uses pixel measures. This function calls // GetSystemMetrics for the given |metric|, then converts the result to DIP. @@ -58,7 +58,6 @@ UI_EXPORT double GetUndocumentedDPIScale(); UI_EXPORT double GetUndocumentedDPITouchScale(); } // namespace win +} // namespace gfx -} // namespace ui - -#endif // UI_BASE_WIN_DPI_H_ +#endif // UI_GFX_DPI_WIN_H_ diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc index 642db85..7ae5306 100644 --- a/ui/gfx/screen_win.cc +++ b/ui/gfx/screen_win.cc @@ -10,8 +10,8 @@ #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "base/win/win_util.h" -#include "ui/base/win/dpi.h" #include "ui/gfx/display.h" +#include "ui/gfx/dpi_win.h" namespace { @@ -29,7 +29,7 @@ gfx::Display GetDisplay(MONITORINFOEX& monitor_info) { gfx::Rect bounds = gfx::Rect(monitor_info.rcMonitor); gfx::Display display(id, bounds); display.set_work_area(gfx::Rect(monitor_info.rcWork)); - display.SetScaleAndBounds(ui::win::GetDeviceScaleFactor(), bounds); + display.SetScaleAndBounds(gfx::win::GetDeviceScaleFactor(), bounds); return display; } @@ -58,7 +58,7 @@ ScreenWin::~ScreenWin() { } bool ScreenWin::IsDIPEnabled() { - return ui::IsInHighDPIMode(); + return IsInHighDPIMode(); } gfx::Point ScreenWin::GetCursorScreenPoint() { @@ -129,7 +129,7 @@ gfx::Display ScreenWin::GetPrimaryDisplay() const { gfx::Display display = GetDisplay(mi); // TODO(kevers|girard): Test if these checks can be reintroduced for high-DIP // once more of the app is DIP-aware. - if (!ui::IsInHighDPIMode()) { + if (!IsInHighDPIMode()) { DCHECK_EQ(GetSystemMetrics(SM_CXSCREEN), display.size().width()); DCHECK_EQ(GetSystemMetrics(SM_CYSCREEN), display.size().height()); } diff --git a/ui/gfx/switches.cc b/ui/gfx/switches.cc index 55452c3..a278f46 100644 --- a/ui/gfx/switches.cc +++ b/ui/gfx/switches.cc @@ -17,5 +17,8 @@ const char kEnableBrowserTextSubpixelPositioning[] = const char kEnableWebkitTextSubpixelPositioning[] = "enable-webkit-text-subpixel-positioning"; +// Enables/Disables High DPI support (windows) +const char kHighDPISupport[] = "high-dpi-support"; + } // namespace switches } // namespace gfx diff --git a/ui/gfx/switches.h b/ui/gfx/switches.h index cbd2e8af..f8069d0 100644 --- a/ui/gfx/switches.h +++ b/ui/gfx/switches.h @@ -12,6 +12,7 @@ namespace switches { UI_EXPORT extern const char kEnableBrowserTextSubpixelPositioning[]; UI_EXPORT extern const char kEnableWebkitTextSubpixelPositioning[]; +UI_EXPORT extern const char kHighDPISupport[]; } // namespace switches } // namespace gfx diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc index 1839de3..79081b7 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc @@ -23,8 +23,8 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColorPriv.h" #include "third_party/skia/include/core/SkShader.h" -#include "ui/base/win/dpi.h" #include "ui/gfx/color_utils.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/gdi_util.h" #include "ui/gfx/rect.h" #include "ui/gfx/rect_conversions.h" @@ -243,7 +243,7 @@ gfx::Size NativeThemeWin::GetPartSize(Part part, case kScrollbarVerticalThumb: case kScrollbarHorizontalTrack: case kScrollbarVerticalTrack: - size.cx = size.cy = ui::win::GetSystemMetricsInDIP(SM_CXVSCROLL); + size.cx = size.cy = gfx::win::GetSystemMetricsInDIP(SM_CXVSCROLL); return gfx::Size(size.cx, size.cy); } diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc index 0a6adcb..502678b 100644 --- a/ui/surface/accelerated_surface_win.cc +++ b/ui/surface/accelerated_surface_win.cc @@ -26,9 +26,9 @@ #include "media/base/video_util.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/latency_info.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" #include "ui/base/win/shell.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/rect.h" #include "ui/gl/gl_switches.h" #include "ui/surface/accelerated_surface_transformer_win.h" @@ -720,11 +720,11 @@ void AcceleratedPresenter::DoPresentAndAcknowledge( // presented then drop the frame. gfx::Size window_size = GetWindowSize(); bool size_mismatch = size != window_size; - if (ui::IsInHighDPIMode()) { + if (gfx::IsInHighDPIMode()) { // Check if the size mismatch is within allowable round off or truncation // error. - gfx::Size dip_size = ui::win::ScreenToDIPSize(window_size); - gfx::Size pixel_size = ui::win::DIPToScreenSize(dip_size); + gfx::Size dip_size = gfx::win::ScreenToDIPSize(window_size); + gfx::Size pixel_size = gfx::win::DIPToScreenSize(dip_size); size_mismatch = abs(window_size.width() - size.width()) > abs(window_size.width() - pixel_size.width()) || abs(window_size.height() - size.height()) > @@ -348,8 +348,6 @@ 'base/win/accessibility_misc_utils.cc', 'base/win/accessibility_misc_utils.h', 'base/win/atl_module.h', - 'base/win/dpi.cc', - 'base/win/dpi.h', 'base/win/events_win.cc', 'base/win/extra_sdk_defines.h', 'base/win/foreground_helper.cc', @@ -438,6 +436,8 @@ 'gfx/display.h', 'gfx/display_observer.cc', 'gfx/display_observer.h', + 'gfx/dpi_win.cc', + 'gfx/dpi_win.h', 'gfx/favicon_size.cc', 'gfx/favicon_size.h', 'gfx/font.cc', @@ -905,7 +905,6 @@ 'gfx/display_observer.cc', 'gfx/path.cc', 'gfx/selection_model.cc', - 'gfx/switches.cc', ], 'dependencies': [ 'ui_jni_headers', diff --git a/ui/views/controls/native/native_view_host_win.cc b/ui/views/controls/native/native_view_host_win.cc index 24ea19e..da71d06 100644 --- a/ui/views/controls/native/native_view_host_win.cc +++ b/ui/views/controls/native/native_view_host_win.cc @@ -7,10 +7,10 @@ #include <oleacc.h> #include "base/logging.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hidden_window.h" #include "ui/base/win/window_impl.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/dpi_win.h" #include "ui/views/controls/native/native_view_host.h" #include "ui/views/focus/focus_manager.h" #include "ui/views/widget/native_widget.h" @@ -91,7 +91,7 @@ void NativeViewHostWin::ShowWidget(int x, int y, int w, int h) { SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_NOZORDER; - gfx::Rect bounds = ui::win::DIPToScreenRect(gfx::Rect(x,y,w,h)); + gfx::Rect bounds = gfx::win::DIPToScreenRect(gfx::Rect(x,y,w,h)); // Only send the SHOWWINDOW flag if we're invisible, to avoid flashing. if (!IsWindowVisible(host_->native_view())) diff --git a/ui/views/widget/aero_tooltip_manager.cc b/ui/views/widget/aero_tooltip_manager.cc index b1719de..504ae48 100644 --- a/ui/views/widget/aero_tooltip_manager.cc +++ b/ui/views/widget/aero_tooltip_manager.cc @@ -11,8 +11,8 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "ui/base/l10n/l10n_util_win.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/point.h" namespace views { @@ -42,13 +42,13 @@ void AeroTooltipManager::OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param) { if (u_msg == WM_MOUSEMOVE || u_msg == WM_NCMOUSEMOVE) { gfx::Point mouse_pos_in_pixels(l_param); - gfx::Point mouse_pos = ui::win::ScreenToDIPPoint(mouse_pos_in_pixels); + gfx::Point mouse_pos = gfx::win::ScreenToDIPPoint(mouse_pos_in_pixels); if (u_msg == WM_NCMOUSEMOVE) { // NC message coordinates are in screen coordinates. POINT temp = mouse_pos_in_pixels.ToPOINT(); ::MapWindowPoints(HWND_DESKTOP, GetParent(), &temp, 1); mouse_pos_in_pixels.SetPoint(temp.x, temp.y); - mouse_pos = ui::win::ScreenToDIPPoint(mouse_pos_in_pixels); + mouse_pos = gfx::win::ScreenToDIPPoint(mouse_pos_in_pixels); } if (last_mouse_pos_ != mouse_pos) { last_mouse_pos_ = mouse_pos; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc index 63f6be3..3467fea 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc @@ -15,8 +15,8 @@ #include "ui/base/cursor/cursor_loader_win.h" #include "ui/base/ime/input_method.h" #include "ui/base/ime/win/tsf_bridge.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/shell.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/insets.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/path_win.h" @@ -112,7 +112,7 @@ aura::RootWindow* DesktopRootWindowHostWin::Init( has_non_client_view_ = Widget::RequiresNonClientView(params.type); - gfx::Rect pixel_bounds = ui::win::DIPToScreenRect(params.bounds); + gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds); message_handler_->Init(parent_hwnd, pixel_bounds); aura::RootWindow::CreateParams rw_params(params.bounds); @@ -202,7 +202,7 @@ void DesktopRootWindowHostWin::ShowWindowWithState( void DesktopRootWindowHostWin::ShowMaximizedWithBounds( const gfx::Rect& restored_bounds) { - gfx::Rect pixel_bounds = ui::win::DIPToScreenRect(restored_bounds); + gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(restored_bounds); message_handler_->ShowMaximizedWithBounds(pixel_bounds); } @@ -211,12 +211,12 @@ bool DesktopRootWindowHostWin::IsVisible() const { } void DesktopRootWindowHostWin::SetSize(const gfx::Size& size) { - gfx::Size size_in_pixels = ui::win::DIPToScreenSize(size); + gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(size); message_handler_->SetSize(size_in_pixels); } void DesktopRootWindowHostWin::CenterWindow(const gfx::Size& size) { - gfx::Size size_in_pixels = ui::win::DIPToScreenSize(size); + gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(size); message_handler_->CenterWindow(size_in_pixels); } @@ -224,22 +224,22 @@ void DesktopRootWindowHostWin::GetWindowPlacement( gfx::Rect* bounds, ui::WindowShowState* show_state) const { message_handler_->GetWindowPlacement(bounds, show_state); - *bounds = ui::win::ScreenToDIPRect(*bounds); + *bounds = gfx::win::ScreenToDIPRect(*bounds); } gfx::Rect DesktopRootWindowHostWin::GetWindowBoundsInScreen() const { gfx::Rect pixel_bounds = message_handler_->GetWindowBoundsInScreen(); - return ui::win::ScreenToDIPRect(pixel_bounds); + return gfx::win::ScreenToDIPRect(pixel_bounds); } gfx::Rect DesktopRootWindowHostWin::GetClientAreaBoundsInScreen() const { gfx::Rect pixel_bounds = message_handler_->GetClientAreaBoundsInScreen(); - return ui::win::ScreenToDIPRect(pixel_bounds); + return gfx::win::ScreenToDIPRect(pixel_bounds); } gfx::Rect DesktopRootWindowHostWin::GetRestoredBounds() const { gfx::Rect pixel_bounds = message_handler_->GetRestoredBounds(); - return ui::win::ScreenToDIPRect(pixel_bounds); + return gfx::win::ScreenToDIPRect(pixel_bounds); } gfx::Rect DesktopRootWindowHostWin::GetWorkAreaBoundsInScreen() const { @@ -249,7 +249,7 @@ gfx::Rect DesktopRootWindowHostWin::GetWorkAreaBoundsInScreen() const { MONITOR_DEFAULTTONEAREST), &monitor_info); gfx::Rect pixel_bounds = gfx::Rect(monitor_info.rcWork); - return ui::win::ScreenToDIPRect(pixel_bounds); + return gfx::win::ScreenToDIPRect(pixel_bounds); } void DesktopRootWindowHostWin::SetShape(gfx::NativeRegion native_region) { @@ -580,7 +580,7 @@ bool DesktopRootWindowHostWin::WillProcessWorkAreaChange() const { int DesktopRootWindowHostWin::GetNonClientComponent( const gfx::Point& point) const { - gfx::Point dip_position = ui::win::ScreenToDIPPoint(point); + gfx::Point dip_position = gfx::win::ScreenToDIPPoint(point); return native_widget_delegate_->GetNonClientComponent(dip_position); } @@ -723,7 +723,7 @@ void DesktopRootWindowHostWin::HandleClientSizeChanged( if (root_window_host_delegate_) root_window_host_delegate_->OnHostResized(new_size); // TODO(beng): replace with a layout manager?? - gfx::Size dip_size = ui::win::ScreenToDIPSize(without_expansion); + gfx::Size dip_size = gfx::win::ScreenToDIPSize(without_expansion); content_window_->SetBounds(gfx::Rect(dip_size)); native_widget_delegate_->OnNativeWidgetSizeChanged(dip_size); } diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index ea0b069..8cfeca7 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -24,12 +24,12 @@ #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/theme_provider.h" #include "ui/base/view_prop.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" #include "ui/base/win/mouse_wheel_util.h" #include "ui/base/win/shell.h" #include "ui/gfx/canvas.h" #include "ui/gfx/canvas_skia_paint.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/path.h" #include "ui/gfx/point_conversions.h" #include "ui/gfx/screen.h" @@ -116,7 +116,7 @@ void NativeWidgetWin::Show(int show_state) { // NativeWidgetWin, NativeWidget implementation: void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) { - gfx::Rect pixel_bounds = ui::win::DIPToScreenRect(params.bounds); + gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds); Widget::InitParams params_in_pixel(params); params_in_pixel.bounds = pixel_bounds; SetInitParams(params_in_pixel); @@ -220,7 +220,7 @@ internal::InputMethodDelegate* NativeWidgetWin::GetInputMethodDelegate() { } void NativeWidgetWin::CenterWindow(const gfx::Size& size) { - gfx::Size size_in_pixels = ui::win::DIPToScreenSize(size); + gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(size); message_handler_->CenterWindow(size_in_pixels); } @@ -228,7 +228,7 @@ void NativeWidgetWin::GetWindowPlacement( gfx::Rect* bounds, ui::WindowShowState* show_state) const { message_handler_->GetWindowPlacement(bounds, show_state); - *bounds = ui::win::ScreenToDIPRect(*bounds); + *bounds = gfx::win::ScreenToDIPRect(*bounds); } void NativeWidgetWin::SetWindowTitle(const string16& title) { @@ -246,21 +246,21 @@ void NativeWidgetWin::InitModalType(ui::ModalType modal_type) { gfx::Rect NativeWidgetWin::GetWindowBoundsInScreen() const { gfx::Rect bounds_in_pixels = message_handler_->GetWindowBoundsInScreen(); - return ui::win::ScreenToDIPRect(bounds_in_pixels); + return gfx::win::ScreenToDIPRect(bounds_in_pixels); } gfx::Rect NativeWidgetWin::GetClientAreaBoundsInScreen() const { gfx::Rect bounds_in_pixels = message_handler_->GetClientAreaBoundsInScreen(); - return ui::win::ScreenToDIPRect(bounds_in_pixels); + return gfx::win::ScreenToDIPRect(bounds_in_pixels); } gfx::Rect NativeWidgetWin::GetRestoredBounds() const { gfx::Rect bounds_in_pixels = message_handler_->GetRestoredBounds(); - return ui::win::ScreenToDIPRect(bounds_in_pixels); + return gfx::win::ScreenToDIPRect(bounds_in_pixels); } void NativeWidgetWin::SetBounds(const gfx::Rect& bounds) { - float scale = ui::win::GetDeviceScaleFactor(); + float scale = gfx::win::GetDeviceScaleFactor(); gfx::Rect bounds_in_pixels( gfx::ToCeiledPoint(gfx::ScalePoint(bounds.origin(), scale)), gfx::ToFlooredSize(gfx::ScaleSize(bounds.size(), scale))); @@ -305,7 +305,7 @@ void NativeWidgetWin::Hide() { void NativeWidgetWin::ShowMaximizedWithBounds( const gfx::Rect& restored_bounds) { - gfx::Rect pixel_bounds = ui::win::DIPToScreenRect(restored_bounds); + gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(restored_bounds); message_handler_->ShowMaximizedWithBounds(pixel_bounds); } @@ -412,7 +412,7 @@ void NativeWidgetWin::RunShellDrag(View* view, } void NativeWidgetWin::SchedulePaintInRect(const gfx::Rect& rect) { - gfx::Rect pixel_rect = ui::win::DIPToScreenRect(rect); + gfx::Rect pixel_rect = gfx::win::DIPToScreenRect(rect); message_handler_->SchedulePaintInRect(pixel_rect); } @@ -429,7 +429,7 @@ void NativeWidgetWin::ClearNativeFocus() { } gfx::Rect NativeWidgetWin::GetWorkAreaBoundsInScreen() const { - return ui::win::ScreenToDIPRect( + return gfx::win::ScreenToDIPRect( gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( GetNativeView()).work_area()); } @@ -566,7 +566,7 @@ bool NativeWidgetWin::WillProcessWorkAreaChange() const { } int NativeWidgetWin::GetNonClientComponent(const gfx::Point& point) const { - gfx::Point point_in_dip = ui::win::ScreenToDIPPoint(point); + gfx::Point point_in_dip = gfx::win::ScreenToDIPPoint(point); return delegate_->GetNonClientComponent(point_in_dip); } @@ -581,13 +581,13 @@ bool NativeWidgetWin::GetClientAreaInsets(gfx::Insets* insets) const { void NativeWidgetWin::GetMinMaxSize(gfx::Size* min_size, gfx::Size* max_size) const { - *min_size = ui::win::ScreenToDIPSize(delegate_->GetMinimumSize()); - *max_size = ui::win::ScreenToDIPSize(delegate_->GetMaximumSize()); + *min_size = gfx::win::ScreenToDIPSize(delegate_->GetMinimumSize()); + *max_size = gfx::win::ScreenToDIPSize(delegate_->GetMaximumSize()); } gfx::Size NativeWidgetWin::GetRootViewSize() const { gfx::Size pixel_size = GetWidget()->GetRootView()->size(); - return ui::win::ScreenToDIPSize(pixel_size); + return gfx::win::ScreenToDIPSize(pixel_size); } void NativeWidgetWin::ResetWindowControls() { @@ -726,7 +726,7 @@ void NativeWidgetWin::HandleVisibilityChanged(bool visible) { } void NativeWidgetWin::HandleClientSizeChanged(const gfx::Size& new_size) { - gfx::Size size_in_dip = ui::win::ScreenToDIPSize(new_size); + gfx::Size size_in_dip = gfx::win::ScreenToDIPSize(new_size); delegate_->OnNativeWidgetSizeChanged(size_in_dip); } @@ -751,8 +751,8 @@ void NativeWidgetWin::HandleNativeBlur(HWND focused_window) { bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) { static gfx::Transform scale_transform( - 1/ui::win::GetDeviceScaleFactor(), 0.0, - 0.0, 1/ui::win::GetDeviceScaleFactor(), + 1/gfx::win::GetDeviceScaleFactor(), 0.0, + 0.0, 1/gfx::win::GetDeviceScaleFactor(), 0.0, 0.0); if (event.IsMouseWheelEvent()) { ui::MouseWheelEvent dpi_event( @@ -815,7 +815,7 @@ void NativeWidgetWin::HandleInputLanguageChange(DWORD character_set, } bool NativeWidgetWin::HandlePaintAccelerated(const gfx::Rect& invalid_rect) { - gfx::Rect dpi_rect = ui::win::ScreenToDIPRect(invalid_rect); + gfx::Rect dpi_rect = gfx::win::ScreenToDIPRect(invalid_rect); return delegate_->OnNativeWidgetPaintAccelerated(dpi_rect); } @@ -905,11 +905,11 @@ bool Widget::ConvertRect(const Widget* source, if (source_hwnd == target_hwnd) return true; - RECT win_rect = ui::win::DIPToScreenRect(*rect).ToRECT(); + RECT win_rect = gfx::win::DIPToScreenRect(*rect).ToRECT(); if (::MapWindowPoints(source_hwnd, target_hwnd, reinterpret_cast<LPPOINT>(&win_rect), sizeof(RECT)/sizeof(POINT))) { - *rect = ui::win::ScreenToDIPRect(gfx::Rect(win_rect)); + *rect = gfx::win::ScreenToDIPRect(gfx::Rect(win_rect)); return true; } return false; diff --git a/ui/views/widget/tooltip_manager_win.cc b/ui/views/widget/tooltip_manager_win.cc index 803fa15..4c0a241 100644 --- a/ui/views/widget/tooltip_manager_win.cc +++ b/ui/views/widget/tooltip_manager_win.cc @@ -16,9 +16,9 @@ #include "base/win/scoped_hdc.h" #include "base/win/scoped_select_object.h" #include "ui/base/l10n/l10n_util_win.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" #include "ui/base/win/scoped_set_map_mode.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/font_list.h" #include "ui/gfx/screen.h" #include "ui/views/view.h" @@ -227,7 +227,7 @@ bool TooltipManagerWin::SetTooltipPosition(int text_x, int text_y) { // Calculate the bounds the tooltip will get. gfx::Point view_loc; View::ConvertPointToScreen(last_tooltip_view_, &view_loc); - view_loc = ui::win::DIPToScreenPoint(view_loc); + view_loc = gfx::win::DIPToScreenPoint(view_loc); RECT bounds = { view_loc.x() + text_x, view_loc.y() + text_y, view_loc.x() + text_x + tooltip_width_, @@ -301,14 +301,14 @@ void TooltipManagerWin::UpdateTooltip(const gfx::Point& mouse_pos) { void TooltipManagerWin::OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param) { gfx::Point mouse_pos_in_pixels(l_param); - gfx::Point mouse_pos = ui::win::ScreenToDIPPoint(mouse_pos_in_pixels); + gfx::Point mouse_pos = gfx::win::ScreenToDIPPoint(mouse_pos_in_pixels); if (u_msg >= WM_NCMOUSEMOVE && u_msg <= WM_NCXBUTTONDBLCLK) { // NC message coordinates are in screen coordinates. POINT temp = mouse_pos_in_pixels.ToPOINT(); ::MapWindowPoints(HWND_DESKTOP, GetParent(), &temp, 1); mouse_pos_in_pixels.SetPoint(temp.x, temp.y); - mouse_pos = ui::win::ScreenToDIPPoint(mouse_pos_in_pixels); + mouse_pos = gfx::win::ScreenToDIPPoint(mouse_pos_in_pixels); } if (u_msg != WM_MOUSEMOVE || last_mouse_pos_ != mouse_pos) { diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 6af4479..e998dff 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -16,13 +16,13 @@ #include "ui/base/gestures/gesture_sequence.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "ui/base/touch/touch_enabled.h" -#include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" #include "ui/base/win/mouse_wheel_util.h" #include "ui/base/win/shell.h" #include "ui/base/win/touch_input.h" #include "ui/gfx/canvas.h" #include "ui/gfx/canvas_skia_paint.h" +#include "ui/gfx/dpi_win.h" #include "ui/gfx/icon_util.h" #include "ui/gfx/insets.h" #include "ui/gfx/path.h" @@ -1205,7 +1205,7 @@ void HWNDMessageHandler::RedrawLayeredWindowContents() { // We need to clip to the dirty rect ourselves. layered_window_contents_->sk_canvas()->save(SkCanvas::kClip_SaveFlag); - double scale = ui::win::GetDeviceScaleFactor(); + double scale = gfx::win::GetDeviceScaleFactor(); layered_window_contents_->sk_canvas()->scale( SkScalar(scale),SkScalar(scale)); layered_window_contents_->ClipRect(invalid_rect_); @@ -2068,9 +2068,9 @@ LRESULT HWNDMessageHandler::OnTouchEvent(UINT message, if (touch_event_type != ui::ET_UNKNOWN) { POINT point; point.x = TOUCH_COORD_TO_PIXEL(input[i].x) / - ui::win::GetUndocumentedDPITouchScale(); + gfx::win::GetUndocumentedDPITouchScale(); point.y = TOUCH_COORD_TO_PIXEL(input[i].y) / - ui::win::GetUndocumentedDPITouchScale(); + gfx::win::GetUndocumentedDPITouchScale(); ScreenToClient(hwnd(), &point); diff --git a/webkit/child/webthemeengine_impl_win.cc b/webkit/child/webthemeengine_impl_win.cc index e4d05b3..6953372 100644 --- a/webkit/child/webthemeengine_impl_win.cc +++ b/webkit/child/webthemeengine_impl_win.cc @@ -10,7 +10,7 @@ #include "skia/ext/platform_canvas.h" #include "skia/ext/skia_utils_win.h" #include "third_party/WebKit/public/platform/WebRect.h" -#include "ui/base/win/dpi.h" +#include "ui/gfx/dpi_win.h" #include "ui/native_theme/native_theme.h" using WebKit::WebCanvas; @@ -1000,7 +1000,7 @@ WebSize WebThemeEngineImpl::getSize(int part) { // metric if required. if (size.width() == 0) { int width = static_cast<int>(GetSystemMetrics(SM_CXVSCROLL) / - ui::win::GetDeviceScaleFactor()); + gfx::win::GetDeviceScaleFactor()); size = gfx::Size(width, width); } return WebSize(size.width(), size.height()); |