OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 if (software_frame_manager_->GetCurrentFrameDeviceScaleFactor() != | 2270 if (software_frame_manager_->GetCurrentFrameDeviceScaleFactor() != |
2271 [software_layer_ contentsScale]) { | 2271 [software_layer_ contentsScale]) { |
2272 [software_layer_ setContentsScale: | 2272 [software_layer_ setContentsScale: |
2273 software_frame_manager_->GetCurrentFrameDeviceScaleFactor()]; | 2273 software_frame_manager_->GetCurrentFrameDeviceScaleFactor()]; |
2274 } | 2274 } |
2275 } | 2275 } |
2276 // Changing the software layer's bounds and position doesn't always result | 2276 // Changing the software layer's bounds and position doesn't always result |
2277 // in the layer being anchored to the top-left. Set the layer's frame | 2277 // in the layer being anchored to the top-left. Set the layer's frame |
2278 // explicitly, since this is more reliable in practice. | 2278 // explicitly, since this is more reliable in practice. |
2279 if (software_layer_) { | 2279 if (software_layer_) { |
2280 [software_layer_ setFrame:new_background_frame]; | 2280 bool frame_changed = !CGRectEqualToRect( |
| 2281 new_background_frame, [software_layer_ frame]); |
| 2282 if (frame_changed) { |
| 2283 [software_layer_ setFrame:new_background_frame]; |
| 2284 [software_layer_ setNeedsDisplay]; |
| 2285 } |
2281 } | 2286 } |
2282 } | 2287 } |
2283 | 2288 |
2284 SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() { | 2289 SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() { |
2285 return SkBitmap::kARGB_8888_Config; | 2290 return SkBitmap::kARGB_8888_Config; |
2286 } | 2291 } |
2287 | 2292 |
2288 } // namespace content | 2293 } // namespace content |
2289 | 2294 |
2290 // RenderWidgetHostViewCocoa --------------------------------------------------- | 2295 // RenderWidgetHostViewCocoa --------------------------------------------------- |
(...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4312 } | 4317 } |
4313 | 4318 |
4314 - (void)disableRendering { | 4319 - (void)disableRendering { |
4315 // Disable the fade-out animation as the layer is removed. | 4320 // Disable the fade-out animation as the layer is removed. |
4316 ScopedCAActionDisabler disabler; | 4321 ScopedCAActionDisabler disabler; |
4317 [self removeFromSuperlayer]; | 4322 [self removeFromSuperlayer]; |
4318 renderWidgetHostView_ = nil; | 4323 renderWidgetHostView_ = nil; |
4319 } | 4324 } |
4320 | 4325 |
4321 @end // implementation SoftwareLayer | 4326 @end // implementation SoftwareLayer |
OLD | NEW |