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

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

Issue 10837154: Mac HiDPI: Fix scale factor on external display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 4 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 | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | ui/base/layout_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7408ae19a590733ec0cd67cdaa08c006277cbc2f..bd8c8ea8b0c73eb58bb69379dad5217835ecc537 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -368,10 +368,6 @@ void RenderWidgetHostViewMac::WasShown() {
if (!is_hidden_)
return;
- // Check if the backing scale factor changed while the tab was in the
- // background.
- [cocoa_view_ updateTabBackingStoreScaleFactor];
-
if (web_contents_switch_paint_time_.is_null())
web_contents_switch_paint_time_ = base::TimeTicks::Now();
is_hidden_ = false;
@@ -1436,6 +1432,7 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) {
renderWidgetHostView_.reset(r);
canBeKeyView_ = YES;
focusedPluginIdentifier_ = -1;
+ deviceScaleFactor_ = ScaleFactor(self);
// OpenGL support:
if ([self respondsToSelector:
@@ -2029,6 +2026,10 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) {
return;
float scaleFactor = ScaleFactor(self);
+ if (scaleFactor == deviceScaleFactor_)
+ return;
+ deviceScaleFactor_ = scaleFactor;
+
BackingStoreMac* backingStore = static_cast<BackingStoreMac*>(
renderWidgetHostView_->render_widget_host_->GetBackingStore(false));
if (backingStore) // NULL in hardware path.
@@ -2047,8 +2048,8 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) {
[[notification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey])
doubleValue];
if (newBackingScaleFactor != oldBackingScaleFactor) {
- // Background tabs check if their scale factor changed when they become
- // active, in WasShown().
+ // Background tabs check if their scale factor changed when they are added
+ // to a window.
// Allocating a CGLayerRef with the current scale factor immediately from
// this handler doesn't work. Schedule the backing store update on the
@@ -2980,6 +2981,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
}
- (void)viewDidMoveToWindow {
+ if ([self window])
+ [self updateTabBackingStoreScaleFactor];
+
if (canBeKeyView_) {
NSWindow* newWindow = [self window];
// Pointer comparison only, since we don't know if lastWindow_ is still
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | ui/base/layout_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698