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/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/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 RenderViewHost* rvh = RenderViewHost::From(host_); | 755 RenderViewHost* rvh = RenderViewHost::From(host_); |
756 FrameTreeNode* focused_frame = | 756 FrameTreeNode* focused_frame = |
757 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); | 757 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); |
758 if (!focused_frame) | 758 if (!focused_frame) |
759 return NULL; | 759 return NULL; |
760 | 760 |
761 return focused_frame->current_frame_host(); | 761 return focused_frame->current_frame_host(); |
762 } | 762 } |
763 | 763 |
764 void RenderWidgetHostViewAura::MovePluginWindows( | 764 void RenderWidgetHostViewAura::MovePluginWindows( |
765 const gfx::Vector2d& scroll_offset, | |
766 const std::vector<WebPluginGeometry>& plugin_window_moves) { | 765 const std::vector<WebPluginGeometry>& plugin_window_moves) { |
767 #if defined(OS_WIN) | 766 #if defined(OS_WIN) |
768 // We need to clip the rectangle to the tab's viewport, otherwise we will draw | 767 // We need to clip the rectangle to the tab's viewport, otherwise we will draw |
769 // over the browser UI. | 768 // over the browser UI. |
770 if (!window_->GetRootWindow()) { | 769 if (!window_->GetRootWindow()) { |
771 DCHECK(plugin_window_moves.empty()); | 770 DCHECK(plugin_window_moves.empty()); |
772 return; | 771 return; |
773 } | 772 } |
774 HWND parent = window_->GetHost()->GetAcceleratedWidget(); | 773 HWND parent = window_->GetHost()->GetAcceleratedWidget(); |
775 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); | 774 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); |
776 std::vector<WebPluginGeometry> moves = plugin_window_moves; | 775 std::vector<WebPluginGeometry> moves = plugin_window_moves; |
777 | 776 |
778 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), | 777 gfx::Rect view_port(view_bounds.size()); |
779 view_bounds.height()); | |
780 | 778 |
781 for (size_t i = 0; i < moves.size(); ++i) { | 779 for (size_t i = 0; i < moves.size(); ++i) { |
782 gfx::Rect clip(moves[i].clip_rect); | 780 gfx::Rect clip(moves[i].clip_rect); |
783 gfx::Vector2d view_port_offset( | 781 gfx::Vector2d view_port_offset( |
784 moves[i].window_rect.OffsetFromOrigin() + scroll_offset); | 782 moves[i].window_rect.OffsetFromOrigin()); |
785 clip.Offset(view_port_offset); | 783 clip.Offset(view_port_offset); |
jbauman
2014/04/25 23:42:35
This was just offsetting both clip and view_port b
| |
786 clip.Intersect(view_port); | 784 clip.Intersect(view_port); |
787 clip.Offset(-view_port_offset); | 785 clip.Offset(-view_port_offset); |
788 moves[i].clip_rect = clip; | 786 moves[i].clip_rect = clip; |
789 | 787 |
790 moves[i].window_rect.Offset(view_bounds.OffsetFromOrigin()); | 788 moves[i].window_rect.Offset(view_bounds.OffsetFromOrigin()); |
791 | 789 |
792 plugin_window_moves_[moves[i].window] = moves[i]; | 790 plugin_window_moves_[moves[i].window] = moves[i]; |
793 | 791 |
794 // constrained_rects_ are relative to the root window. We want to convert | 792 // constrained_rects_ are relative to the root window. We want to convert |
795 // them to be relative to the plugin window. | 793 // them to be relative to the plugin window. |
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3170 RenderWidgetHost* widget) { | 3168 RenderWidgetHost* widget) { |
3171 return new RenderWidgetHostViewAura(widget); | 3169 return new RenderWidgetHostViewAura(widget); |
3172 } | 3170 } |
3173 | 3171 |
3174 // static | 3172 // static |
3175 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3173 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3176 GetScreenInfoForWindow(results, NULL); | 3174 GetScreenInfoForWindow(results, NULL); |
3177 } | 3175 } |
3178 | 3176 |
3179 } // namespace content | 3177 } // namespace content |
OLD | NEW |