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

Unified Diff: content/browser/renderer_host/render_widget_host_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
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
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 ec313b3cb70319fc02b3d60ec514766ef3980895..a4d10aa0b52bda08d79876ec1d7e9e382882653a 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -732,9 +732,11 @@ new BrowserCompositorMac(this, this, render_widget_host_->is_hidden(),
}
void RenderWidgetHostViewMac::UpdateBackingStoreProperties() {
- if (!render_widget_host_)
- return;
- render_widget_host_->NotifyScreenInfoChanged();
+ UpdateScreenInfo(cocoa_view_);
+ // Update the ui::Compositor's color space here. The other display properties
+ // of the ui::Compositor are updated by frame metadata.
+ if (browser_compositor_)
+ browser_compositor_->SetDisplayColorSpace(current_display_color_space_);
}
RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const {
@@ -1740,7 +1742,7 @@ new BrowserCompositorMac(this, this, render_widget_host_->is_hidden(),
host->delegate()->UpdateDeviceScaleFactor(display.device_scale_factor());
}
- UpdateScreenInfo(cocoa_view_);
+ UpdateBackingStoreProperties();
}
} // namespace content
@@ -2686,8 +2688,7 @@ - (void)windowDidChangeBackingProperties:(NSNotification*)notification {
}
- (void)windowChangedGlobalFrame:(NSNotification*)notification {
- renderWidgetHostView_->UpdateScreenInfo(
- renderWidgetHostView_->GetNativeView());
+ renderWidgetHostView_->UpdateBackingStoreProperties();
}
- (void)setFrameSize:(NSSize)newSize {
@@ -3343,22 +3344,6 @@ WebMouseEvent event(WebInputEvent::kMouseUp, WebInputEvent::kNoModifiers,
}
}
-- (void)viewDidChangeBackingProperties {
- NSScreen* screen = [[self window] screen];
- if (screen) {
- CGColorSpaceRef color_space = [[screen colorSpace] CGColorSpace];
- // On Sierra, we need to operate in a single screen's color space because
- // IOSurfaces do not opt-out of color correction.
- // https://crbug.com/654488
- if (base::mac::IsAtLeastOS10_12())
- color_space = base::mac::GetSystemColorSpace();
- gfx::ICCProfile icc_profile =
- gfx::ICCProfile::FromCGColorSpace(color_space);
- renderWidgetHostView_->browser_compositor_->SetDisplayColorSpace(
- icc_profile.GetColorSpace());
- }
-}
-
- (void)undo:(id)sender {
WebContents* web_contents = renderWidgetHostView_->GetWebContents();
if (web_contents)

Powered by Google App Engine
This is Rietveld 408576698