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

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: rebasefinal 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 return static_cast<gfx::NativeViewId>(NULL); 409 return static_cast<gfx::NativeViewId>(NULL);
410 #endif 410 #endif
411 } 411 }
412 412
413 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { 413 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() {
414 NOTIMPLEMENTED(); 414 NOTIMPLEMENTED();
415 return static_cast<gfx::NativeViewAccessible>(NULL); 415 return static_cast<gfx::NativeViewAccessible>(NULL);
416 } 416 }
417 417
418 void RenderWidgetHostViewAura::MovePluginWindows( 418 void RenderWidgetHostViewAura::MovePluginWindows(
419 const gfx::Point& scroll_offset, 419 const gfx::Vector2d& scroll_offset,
420 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { 420 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) {
421 #if defined(OS_WIN) 421 #if defined(OS_WIN)
422 // We need to clip the rectangle to the tab's viewport, otherwise we will draw 422 // We need to clip the rectangle to the tab's viewport, otherwise we will draw
423 // over the browser UI. 423 // over the browser UI.
424 if (!window_->GetRootWindow()) { 424 if (!window_->GetRootWindow()) {
425 DCHECK(plugin_window_moves.empty()); 425 DCHECK(plugin_window_moves.empty());
426 return; 426 return;
427 } 427 }
428 HWND parent = window_->GetRootWindow()->GetAcceleratedWidget(); 428 HWND parent = window_->GetRootWindow()->GetAcceleratedWidget();
429 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); 429 gfx::Rect view_bounds = window_->GetBoundsInRootWindow();
430 std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves; 430 std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves;
431 431
432 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), 432 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(),
433 view_bounds.height()); 433 view_bounds.height());
434 434
435 for (size_t i = 0; i < moves.size(); ++i) { 435 for (size_t i = 0; i < moves.size(); ++i) {
436 gfx::Rect clip = moves[i].clip_rect; 436 gfx::Rect clip = moves[i].clip_rect;
437 clip.Offset(moves[i].window_rect.origin()); 437 clip.Offset(moves[i].window_rect.OffsetFromOrigin());
438 clip.Offset(scroll_offset); 438 clip.Offset(scroll_offset);
439 clip.Intersect(view_port); 439 clip.Intersect(view_port);
440 clip.Offset(-moves[i].window_rect.x(), -moves[i].window_rect.y()); 440 clip.Offset(-moves[i].window_rect.x(), -moves[i].window_rect.y());
441 clip.Offset(-scroll_offset.x(), -scroll_offset.y()); 441 clip.Offset(-scroll_offset);
442 moves[i].clip_rect = clip; 442 moves[i].clip_rect = clip;
443 443
444 moves[i].window_rect.Offset(view_bounds.origin()); 444 moves[i].window_rect.Offset(view_bounds.OffsetFromOrigin());
445 } 445 }
446 MovePluginWindowsHelper(parent, moves); 446 MovePluginWindowsHelper(parent, moves);
447 447
448 // Make sure each plugin window (or its wrapper if it exists) has a pointer to 448 // Make sure each plugin window (or its wrapper if it exists) has a pointer to
449 // |this|. 449 // |this|.
450 for (size_t i = 0; i < moves.size(); ++i) { 450 for (size_t i = 0; i < moves.size(); ++i) {
451 HWND window = moves[i].window; 451 HWND window = moves[i].window;
452 if (GetParent(window) != parent) { 452 if (GetParent(window) != parent) {
453 window = GetParent(window); 453 window = GetParent(window);
454 DCHECK(GetParent(window) == parent); 454 DCHECK(GetParent(window) == parent);
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 RenderWidgetHost* widget) { 1892 RenderWidgetHost* widget) {
1893 return new RenderWidgetHostViewAura(widget); 1893 return new RenderWidgetHostViewAura(widget);
1894 } 1894 }
1895 1895
1896 // static 1896 // static
1897 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1897 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1898 GetScreenInfoForWindow(results, NULL); 1898 GetScreenInfoForWindow(results, NULL);
1899 } 1899 }
1900 1900
1901 } // namespace content 1901 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698