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

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') | no next file » | 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..2ec383da8bb1440d60af701f23227f7881438b32 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.
@@ -2980,6 +2981,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
}
- (void)viewDidMoveToWindow {
+ if ([self window] != lastWindow_)
Nico 2012/08/08 00:47:52 nit: I'd just say "if ([self window])", as lastWin
Avi (use Gerrit) 2012/08/08 01:01:28 Grrr. I really dislike lastWindow_; isn't that wha
sail 2012/08/09 00:25:18 Ahh makes sense.
+ [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') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698