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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 aura::client::SetTooltipText(window_, NULL); | 239 aura::client::SetTooltipText(window_, NULL); |
240 } | 240 } |
241 | 241 |
242 //////////////////////////////////////////////////////////////////////////////// | 242 //////////////////////////////////////////////////////////////////////////////// |
243 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 243 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
244 | 244 |
245 void RenderWidgetHostViewAura::InitAsChild( | 245 void RenderWidgetHostViewAura::InitAsChild( |
246 gfx::NativeView parent_view) { | 246 gfx::NativeView parent_view) { |
247 window_->Init(ui::LAYER_TEXTURED); | 247 window_->Init(ui::LAYER_TEXTURED); |
248 window_->SetName("RenderWidgetHostViewAura"); | 248 window_->SetName("RenderWidgetHostViewAura"); |
| 249 window_->layer()->set_scale_content(false); |
249 } | 250 } |
250 | 251 |
251 void RenderWidgetHostViewAura::InitAsPopup( | 252 void RenderWidgetHostViewAura::InitAsPopup( |
252 RenderWidgetHostView* parent_host_view, | 253 RenderWidgetHostView* parent_host_view, |
253 const gfx::Rect& pos) { | 254 const gfx::Rect& pos) { |
254 popup_parent_host_view_ = | 255 popup_parent_host_view_ = |
255 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 256 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
256 popup_parent_host_view_->popup_child_host_view_ = this; | 257 popup_parent_host_view_->popup_child_host_view_ = this; |
257 window_->SetType(aura::client::WINDOW_TYPE_MENU); | 258 window_->SetType(aura::client::WINDOW_TYPE_MENU); |
258 window_->Init(ui::LAYER_TEXTURED); | 259 window_->Init(ui::LAYER_TEXTURED); |
259 window_->SetName("RenderWidgetHostViewAura"); | 260 window_->SetName("RenderWidgetHostViewAura"); |
260 | 261 |
261 window_->SetParent(NULL); | 262 window_->SetParent(NULL); |
| 263 window_->layer()->set_scale_content(false); |
262 SetBounds(pos); | 264 SetBounds(pos); |
263 Show(); | 265 Show(); |
264 } | 266 } |
265 | 267 |
266 void RenderWidgetHostViewAura::InitAsFullscreen( | 268 void RenderWidgetHostViewAura::InitAsFullscreen( |
267 RenderWidgetHostView* reference_host_view) { | 269 RenderWidgetHostView* reference_host_view) { |
268 is_fullscreen_ = true; | 270 is_fullscreen_ = true; |
269 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 271 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
270 window_->Init(ui::LAYER_TEXTURED); | 272 window_->Init(ui::LAYER_TEXTURED); |
271 window_->SetName("RenderWidgetHostViewAura"); | 273 window_->SetName("RenderWidgetHostViewAura"); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 } | 485 } |
484 | 486 |
485 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { | 487 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { |
486 // Delay UpdateExternalTexture until we actually got a software frame. | 488 // Delay UpdateExternalTexture until we actually got a software frame. |
487 // Sometimes (e.g. on a page load) the renderer will spuriously disable then | 489 // Sometimes (e.g. on a page load) the renderer will spuriously disable then |
488 // re-enable accelerated compositing, causing us to flash. | 490 // re-enable accelerated compositing, causing us to flash. |
489 // TODO(piman): factor the enable/disable accelerated compositing message into | 491 // TODO(piman): factor the enable/disable accelerated compositing message into |
490 // the UpdateRect/AcceleratedSurfaceBuffersSwapped messages so that we have | 492 // the UpdateRect/AcceleratedSurfaceBuffersSwapped messages so that we have |
491 // fewer inconsistent temporary states. | 493 // fewer inconsistent temporary states. |
492 needs_update_texture_ = true; | 494 needs_update_texture_ = true; |
493 | |
494 // Don't scale contents on high density screen when content is accelerated | |
495 // because renderer takes care of it. | |
496 // TODO(pkotwicz): Implement DIP backing store such that renderer always | |
497 // scales web contents. | |
498 window_->layer()->set_scale_content( | |
499 !host_->is_accelerated_compositing_active()); | |
500 } | 495 } |
501 | 496 |
502 void RenderWidgetHostViewAura::UpdateExternalTexture() { | 497 void RenderWidgetHostViewAura::UpdateExternalTexture() { |
503 needs_update_texture_ = false; | 498 needs_update_texture_ = false; |
504 if (current_surface_ != 0 && | 499 if (current_surface_ != 0 && |
505 host_->is_accelerated_compositing_active()) { | 500 host_->is_accelerated_compositing_active()) { |
506 | 501 |
507 ImageTransportClient* container = | 502 ImageTransportClient* container = |
508 image_transport_clients_[current_surface_]; | 503 image_transport_clients_[current_surface_]; |
509 if (container) | 504 if (container) |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 1338 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
1344 RenderWidgetHost* widget) { | 1339 RenderWidgetHost* widget) { |
1345 return new RenderWidgetHostViewAura(widget); | 1340 return new RenderWidgetHostViewAura(widget); |
1346 } | 1341 } |
1347 | 1342 |
1348 // static | 1343 // static |
1349 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1344 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
1350 WebKit::WebScreenInfo* results) { | 1345 WebKit::WebScreenInfo* results) { |
1351 GetScreenInfoForWindow(results, NULL); | 1346 GetScreenInfoForWindow(results, NULL); |
1352 } | 1347 } |
OLD | NEW |