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

Unified Diff: content/browser/renderer_host/browser_compositor_view_mac.mm

Issue 2959873002: color: Add NSScreenColorSpaceDidChangeNotification observer (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/browser_compositor_view_mac.mm
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm
index 082550d0ee68e902103765b56812f95b6dc6453a..90851fe7df8f5145ea817f1bf54a0561b7efac7f 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.mm
+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -18,6 +18,7 @@
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
#include "ui/base/layout.h"
+#include "ui/display/screen.h"
#include "ui/gfx/geometry/dip_util.h"
namespace content {
@@ -356,18 +357,21 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
if (state_ == HasDetachedCompositor && new_state == HasAttachedCompositor) {
NSView* ns_view =
accelerated_widget_mac_ns_view_->AcceleratedWidgetGetNSView();
- float scale_factor = ui::GetScaleFactorForNativeView(ns_view);
ccameron 2017/06/26 22:45:02 At the moment, ui::GetScaleFactorForNativeView wra
+ display::Display display =
+ display::Screen::GetScreen()->GetDisplayNearestView(ns_view);
NSSize dip_ns_size = [ns_view bounds].size;
- gfx::Size pixel_size(dip_ns_size.width * scale_factor,
- dip_ns_size.height * scale_factor);
+ gfx::Size pixel_size(dip_ns_size.width * display.device_scale_factor(),
+ dip_ns_size.height * display.device_scale_factor());
delegated_frame_host_->SetCompositor(recyclable_compositor_->compositor());
delegated_frame_host_->WasShown(ui::LatencyInfo());
// Unsuspend the browser compositor after showing the delegated frame host.
// If there is not a saved delegated frame, then the delegated frame host
// will keep the compositor locked until a delegated frame is swapped.
- recyclable_compositor_->compositor()->SetScaleAndSize(scale_factor,
- pixel_size);
+ recyclable_compositor_->compositor()->SetDisplayColorSpace(
+ display.color_space());
+ recyclable_compositor_->compositor()->SetScaleAndSize(
+ display.device_scale_factor(), pixel_size);
recyclable_compositor_->Unsuspend();
state_ = HasAttachedCompositor;
}
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698