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

Side by Side Diff: content/renderer/render_widget.cc

Issue 12328080: Plumb physical backing size from RWHV to renderer CC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust for call renamed to GetViewportSizePix() Created 7 years, 9 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 unified diff | Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen_pepper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 323
324 // If given a messsage without a routing ID, then assign our routing ID. 324 // If given a messsage without a routing ID, then assign our routing ID.
325 if (message->routing_id() == MSG_ROUTING_NONE) 325 if (message->routing_id() == MSG_ROUTING_NONE)
326 message->set_routing_id(routing_id_); 326 message->set_routing_id(routing_id_);
327 327
328 return RenderThread::Get()->Send(message); 328 return RenderThread::Get()->Send(message);
329 } 329 }
330 330
331 void RenderWidget::Resize(const gfx::Size& new_size, 331 void RenderWidget::Resize(const gfx::Size& new_size,
332 const gfx::Size& physical_backing_size,
332 const gfx::Rect& resizer_rect, 333 const gfx::Rect& resizer_rect,
333 bool is_fullscreen, 334 bool is_fullscreen,
334 ResizeAck resize_ack) { 335 ResizeAck resize_ack) {
335 // A resize ack shouldn't be requested if we have not ACK'd the previous one. 336 // A resize ack shouldn't be requested if we have not ACK'd the previous one.
336 DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack()); 337 DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack());
337 DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK); 338 DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK);
338 339
339 // Ignore this during shutdown. 340 // Ignore this during shutdown.
340 if (!webwidget_) 341 if (!webwidget_)
341 return; 342 return;
342 343
343 // Remember the rect where the resize corner will be drawn. 344 if (compositor_)
345 compositor_->setViewportSize(new_size, physical_backing_size);
346
347 physical_backing_size_ = physical_backing_size_;
344 resizer_rect_ = resizer_rect; 348 resizer_rect_ = resizer_rect;
345 349
346 // NOTE: We may have entered fullscreen mode without changing our size. 350 // NOTE: We may have entered fullscreen mode without changing our size.
347 bool fullscreen_change = is_fullscreen_ != is_fullscreen; 351 bool fullscreen_change = is_fullscreen_ != is_fullscreen;
348 if (fullscreen_change) 352 if (fullscreen_change)
349 WillToggleFullscreen(); 353 WillToggleFullscreen();
350 is_fullscreen_ = is_fullscreen; 354 is_fullscreen_ = is_fullscreen;
351 355
352 if (size_ != new_size) { 356 if (size_ != new_size) {
353 // TODO(darin): We should not need to reset this here. 357 // TODO(darin): We should not need to reset this here.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 411
408 // Got a response from the browser after the renderer decided to create a new 412 // Got a response from the browser after the renderer decided to create a new
409 // view. 413 // view.
410 void RenderWidget::OnCreatingNewAck() { 414 void RenderWidget::OnCreatingNewAck() {
411 DCHECK(routing_id_ != MSG_ROUTING_NONE); 415 DCHECK(routing_id_ != MSG_ROUTING_NONE);
412 416
413 CompleteInit(); 417 CompleteInit();
414 } 418 }
415 419
416 void RenderWidget::OnResize(const gfx::Size& new_size, 420 void RenderWidget::OnResize(const gfx::Size& new_size,
421 const gfx::Size& physical_backing_size,
417 const gfx::Rect& resizer_rect, 422 const gfx::Rect& resizer_rect,
418 bool is_fullscreen) { 423 bool is_fullscreen) {
419 Resize(new_size, resizer_rect, is_fullscreen, SEND_RESIZE_ACK); 424 Resize(new_size, physical_backing_size, resizer_rect, is_fullscreen,
425 SEND_RESIZE_ACK);
420 } 426 }
421 427
422 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { 428 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) {
423 if (resizer_rect_ != resizer_rect) { 429 if (resizer_rect_ != resizer_rect) {
424 gfx::Rect view_rect(size_); 430 gfx::Rect view_rect(size_);
425 431
426 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_); 432 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_);
427 if (!old_damage_rect.IsEmpty()) 433 if (!old_damage_rect.IsEmpty())
428 paint_aggregator_.InvalidateRect(old_damage_rect); 434 paint_aggregator_.InvalidateRect(old_damage_rect);
429 435
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 1346
1341 void RenderWidget::initializeLayerTreeView( 1347 void RenderWidget::initializeLayerTreeView(
1342 WebKit::WebLayerTreeViewClient* client, 1348 WebKit::WebLayerTreeViewClient* client,
1343 const WebKit::WebLayer& root_layer, 1349 const WebKit::WebLayer& root_layer,
1344 const WebKit::WebLayerTreeView::Settings& settings) { 1350 const WebKit::WebLayerTreeView::Settings& settings) {
1345 compositor_ = RenderWidgetCompositor::Create(this, client, settings); 1351 compositor_ = RenderWidgetCompositor::Create(this, client, settings);
1346 if (!compositor_) 1352 if (!compositor_)
1347 return; 1353 return;
1348 1354
1349 compositor_->setRootLayer(root_layer); 1355 compositor_->setRootLayer(root_layer);
1356 compositor_->setViewportSize(size_, physical_backing_size_);
1350 if (init_complete_) 1357 if (init_complete_)
1351 compositor_->setSurfaceReady(); 1358 compositor_->setSurfaceReady();
1352 } 1359 }
1353 1360
1354 WebKit::WebLayerTreeView* RenderWidget::layerTreeView() { 1361 WebKit::WebLayerTreeView* RenderWidget::layerTreeView() {
1355 return compositor_.get(); 1362 return compositor_.get();
1356 } 1363 }
1357 1364
1358 void RenderWidget::suppressCompositorScheduling(bool enable) { 1365 void RenderWidget::suppressCompositorScheduling(bool enable) {
1359 if (compositor_) 1366 if (compositor_)
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 bool RenderWidget::WillHandleGestureEvent( 2155 bool RenderWidget::WillHandleGestureEvent(
2149 const WebKit::WebGestureEvent& event) { 2156 const WebKit::WebGestureEvent& event) {
2150 return false; 2157 return false;
2151 } 2158 }
2152 2159
2153 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { 2160 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const {
2154 return true; 2161 return true;
2155 } 2162 }
2156 2163
2157 } // namespace content 2164 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen_pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698