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