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/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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 void RenderWidget::didAutoResize(const WebSize& new_size) { | 1407 void RenderWidget::didAutoResize(const WebSize& new_size) { |
1408 if (size_.width() != new_size.width || size_.height() != new_size.height) { | 1408 if (size_.width() != new_size.width || size_.height() != new_size.height) { |
1409 size_ = new_size; | 1409 size_ = new_size; |
1410 | 1410 |
1411 // If we don't clear PaintAggregator after changing autoResize state, then | 1411 // If we don't clear PaintAggregator after changing autoResize state, then |
1412 // we might end up in a situation where bitmap_rect is larger than the | 1412 // we might end up in a situation where bitmap_rect is larger than the |
1413 // view_size. By clearing PaintAggregator, we ensure that we don't end up | 1413 // view_size. By clearing PaintAggregator, we ensure that we don't end up |
1414 // with invalid damage rects. | 1414 // with invalid damage rects. |
1415 paint_aggregator_.ClearPendingUpdate(); | 1415 paint_aggregator_.ClearPendingUpdate(); |
1416 | 1416 |
1417 if (RenderThreadImpl::current()->short_circuit_size_updates()) { | 1417 if (RenderThreadImpl::current()->layout_test_mode()) { |
1418 WebRect new_pos(rootWindowRect().x, | 1418 WebRect new_pos(rootWindowRect().x, |
1419 rootWindowRect().y, | 1419 rootWindowRect().y, |
1420 new_size.width, | 1420 new_size.width, |
1421 new_size.height); | 1421 new_size.height); |
1422 view_screen_rect_ = new_pos; | 1422 view_screen_rect_ = new_pos; |
1423 window_screen_rect_ = new_pos; | 1423 window_screen_rect_ = new_pos; |
1424 } | 1424 } |
1425 | 1425 |
1426 AutoResizeCompositor(); | 1426 AutoResizeCompositor(); |
1427 | 1427 |
1428 if (!RenderThreadImpl::current()->short_circuit_size_updates()) | 1428 if (!RenderThreadImpl::current()->layout_test_mode()) |
1429 need_update_rect_for_auto_resize_ = true; | 1429 need_update_rect_for_auto_resize_ = true; |
1430 } | 1430 } |
1431 } | 1431 } |
1432 | 1432 |
1433 void RenderWidget::AutoResizeCompositor() { | 1433 void RenderWidget::AutoResizeCompositor() { |
1434 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, | 1434 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, |
1435 device_scale_factor_)); | 1435 device_scale_factor_)); |
1436 if (compositor_) | 1436 if (compositor_) |
1437 compositor_->setViewportSize(size_, physical_backing_size_); | 1437 compositor_->setViewportSize(size_, physical_backing_size_); |
1438 } | 1438 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 return view_screen_rect_; | 1675 return view_screen_rect_; |
1676 } | 1676 } |
1677 | 1677 |
1678 void RenderWidget::setToolTipText(const WebKit::WebString& text, | 1678 void RenderWidget::setToolTipText(const WebKit::WebString& text, |
1679 WebTextDirection hint) { | 1679 WebTextDirection hint) { |
1680 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint)); | 1680 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint)); |
1681 } | 1681 } |
1682 | 1682 |
1683 void RenderWidget::setWindowRect(const WebRect& pos) { | 1683 void RenderWidget::setWindowRect(const WebRect& pos) { |
1684 if (did_show_) { | 1684 if (did_show_) { |
1685 if (!RenderThreadImpl::current()->short_circuit_size_updates()) { | 1685 if (!RenderThreadImpl::current()->layout_test_mode()) { |
1686 Send(new ViewHostMsg_RequestMove(routing_id_, pos)); | 1686 Send(new ViewHostMsg_RequestMove(routing_id_, pos)); |
1687 SetPendingWindowRect(pos); | 1687 SetPendingWindowRect(pos); |
1688 } else { | 1688 } else { |
1689 WebSize new_size(pos.width, pos.height); | 1689 WebSize new_size(pos.width, pos.height); |
1690 Resize(new_size, new_size, overdraw_bottom_height_, | 1690 Resize(new_size, new_size, overdraw_bottom_height_, |
1691 WebRect(), is_fullscreen_, NO_RESIZE_ACK); | 1691 WebRect(), is_fullscreen_, NO_RESIZE_ACK); |
1692 view_screen_rect_ = pos; | 1692 view_screen_rect_ = pos; |
1693 window_screen_rect_ = pos; | 1693 window_screen_rect_ = pos; |
1694 } | 1694 } |
1695 } else { | 1695 } else { |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 | 2389 |
2390 if (!context->Initialize( | 2390 if (!context->Initialize( |
2391 attributes, | 2391 attributes, |
2392 false /* bind generates resources */, | 2392 false /* bind generates resources */, |
2393 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2393 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2394 return NULL; | 2394 return NULL; |
2395 return context.release(); | 2395 return context.release(); |
2396 } | 2396 } |
2397 | 2397 |
2398 } // namespace content | 2398 } // namespace content |
OLD | NEW |