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

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

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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 | Annotate | Revision Log
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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 return static_cast<gfx::NativeViewId>(NULL); 439 return static_cast<gfx::NativeViewId>(NULL);
440 #endif 440 #endif
441 } 441 }
442 442
443 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { 443 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() {
444 NOTIMPLEMENTED(); 444 NOTIMPLEMENTED();
445 return static_cast<gfx::NativeViewAccessible>(NULL); 445 return static_cast<gfx::NativeViewAccessible>(NULL);
446 } 446 }
447 447
448 void RenderWidgetHostViewAura::MovePluginWindows( 448 void RenderWidgetHostViewAura::MovePluginWindows(
449 const gfx::Point& scroll_offset, 449 const gfx::Vector2d& scroll_offset,
450 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { 450 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) {
451 #if defined(OS_WIN) 451 #if defined(OS_WIN)
452 // We need to clip the rectangle to the tab's viewport, otherwise we will draw 452 // We need to clip the rectangle to the tab's viewport, otherwise we will draw
453 // over the browser UI. 453 // over the browser UI.
454 if (!window_->GetRootWindow()) { 454 if (!window_->GetRootWindow()) {
455 DCHECK(plugin_window_moves.empty()); 455 DCHECK(plugin_window_moves.empty());
456 return; 456 return;
457 } 457 }
458 HWND parent = window_->GetRootWindow()->GetAcceleratedWidget(); 458 HWND parent = window_->GetRootWindow()->GetAcceleratedWidget();
459 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); 459 gfx::Rect view_bounds = window_->GetBoundsInRootWindow();
460 std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves; 460 std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves;
461 461
462 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), 462 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(),
463 view_bounds.height()); 463 view_bounds.height());
464 464
465 for (size_t i = 0; i < moves.size(); ++i) { 465 for (size_t i = 0; i < moves.size(); ++i) {
466 gfx::Rect clip = moves[i].clip_rect; 466 gfx::Rect clip(moves[i].clip_rect);
467 clip.Offset(moves[i].window_rect.origin()); 467 gfx::Vector2d view_port_offset(
468 clip.Offset(scroll_offset); 468 moves[i].window_rect.OffsetFromOrigin() + scroll_offset);
469 clip.Offset(view_port_offset);
469 clip.Intersect(view_port); 470 clip.Intersect(view_port);
470 clip.Offset(-moves[i].window_rect.x(), -moves[i].window_rect.y()); 471 clip.Offset(-view_port_offset);
471 clip.Offset(-scroll_offset.x(), -scroll_offset.y());
472 moves[i].clip_rect = clip; 472 moves[i].clip_rect = clip;
473 473
474 moves[i].window_rect.Offset(view_bounds.origin()); 474 moves[i].window_rect.Offset(view_bounds.OffsetFromOrigin());
475 } 475 }
476 MovePluginWindowsHelper(parent, moves); 476 MovePluginWindowsHelper(parent, moves);
477 477
478 // Make sure each plugin window (or its wrapper if it exists) has a pointer to 478 // Make sure each plugin window (or its wrapper if it exists) has a pointer to
479 // |this|. 479 // |this|.
480 for (size_t i = 0; i < moves.size(); ++i) { 480 for (size_t i = 0; i < moves.size(); ++i) {
481 HWND window = moves[i].window; 481 HWND window = moves[i].window;
482 if (GetParent(window) != parent) { 482 if (GetParent(window) != parent) {
483 window = GetParent(window); 483 window = GetParent(window);
484 DCHECK(GetParent(window) == parent); 484 DCHECK(GetParent(window) == parent);
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 RenderWidgetHost* widget) { 1916 RenderWidgetHost* widget) {
1917 return new RenderWidgetHostViewAura(widget); 1917 return new RenderWidgetHostViewAura(widget);
1918 } 1918 }
1919 1919
1920 // static 1920 // static
1921 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1921 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1922 GetScreenInfoForWindow(results, NULL); 1922 GetScreenInfoForWindow(results, NULL);
1923 } 1923 }
1924 1924
1925 } // namespace content 1925 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698