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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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
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/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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); 428 gfx::Rect view_bounds = window_->GetBoundsInRootWindow();
429 std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves; 429 std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves;
430 430
431 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), 431 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(),
432 view_bounds.height()); 432 view_bounds.height());
433 433
434 for (size_t i = 0; i < moves.size(); ++i) { 434 for (size_t i = 0; i < moves.size(); ++i) {
435 gfx::Rect clip = moves[i].clip_rect; 435 gfx::Rect clip = moves[i].clip_rect;
436 clip.Offset(moves[i].window_rect.origin()); 436 clip.Offset(moves[i].window_rect.origin());
437 clip.Offset(scroll_offset); 437 clip.Offset(scroll_offset);
438 clip = clip.Intersect(view_port); 438 clip.Intersect(view_port);
439 clip.Offset(-moves[i].window_rect.x(), -moves[i].window_rect.y()); 439 clip.Offset(-moves[i].window_rect.x(), -moves[i].window_rect.y());
440 clip.Offset(-scroll_offset.x(), -scroll_offset.y()); 440 clip.Offset(-scroll_offset.x(), -scroll_offset.y());
441 moves[i].clip_rect = clip; 441 moves[i].clip_rect = clip;
442 442
443 moves[i].window_rect.Offset(view_bounds.origin()); 443 moves[i].window_rect.Offset(view_bounds.origin());
444 } 444 }
445 MovePluginWindowsHelper(parent, moves); 445 MovePluginWindowsHelper(parent, moves);
446 446
447 // Make sure each plugin window (or its wrapper if it exists) has a pointer to 447 // Make sure each plugin window (or its wrapper if it exists) has a pointer to
448 // |this|. 448 // |this|.
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 gfx::Rect rect_to_paint = ConvertRectToDIP(this, gfx::Rect( 867 gfx::Rect rect_to_paint = ConvertRectToDIP(this, gfx::Rect(
868 params_in_pixel.x, 868 params_in_pixel.x,
869 surface_size_in_pixel.height() - params_in_pixel.y - 869 surface_size_in_pixel.height() - params_in_pixel.y -
870 params_in_pixel.height, 870 params_in_pixel.height,
871 params_in_pixel.width, 871 params_in_pixel.width,
872 params_in_pixel.height)); 872 params_in_pixel.height));
873 873
874 // Damage may not have been DIP aligned, so inflate damage to compensate 874 // Damage may not have been DIP aligned, so inflate damage to compensate
875 // for any round-off error. 875 // for any round-off error.
876 rect_to_paint.Inset(-1, -1); 876 rect_to_paint.Inset(-1, -1);
877 rect_to_paint = rect_to_paint.Intersect(window_->bounds()); 877 rect_to_paint.Intersect(window_->bounds());
878 878
879 window_->SchedulePaintInRect(rect_to_paint); 879 window_->SchedulePaintInRect(rect_to_paint);
880 880
881 if (!resize_locks_.empty()) { 881 if (!resize_locks_.empty()) {
882 // If we are waiting for the resize, fast-track the ACK. 882 // If we are waiting for the resize, fast-track the ACK.
883 if (compositor->IsThreaded()) { 883 if (compositor->IsThreaded()) {
884 // We need the compositor thread to pick up the active buffer before 884 // We need the compositor thread to pick up the active buffer before
885 // ACKing. 885 // ACKing.
886 on_compositing_did_commit_callbacks_.push_back( 886 on_compositing_did_commit_callbacks_.push_back(
887 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, 887 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK,
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 RenderWidgetHost* widget) { 1874 RenderWidgetHost* widget) {
1875 return new RenderWidgetHostViewAura(widget); 1875 return new RenderWidgetHostViewAura(widget);
1876 } 1876 }
1877 1877
1878 // static 1878 // static
1879 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1879 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1880 GetScreenInfoForWindow(results, NULL); 1880 GetScreenInfoForWindow(results, NULL);
1881 } 1881 }
1882 1882
1883 } // namespace content 1883 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698