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

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

Issue 11829040: Fix the content_browsertests everywhere maybe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | content/browser/web_contents/web_contents_view_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 window_->SetBounds(rect); 460 window_->SetBounds(rect);
461 host_->WasResized(); 461 host_->WasResized();
462 } 462 }
463 463
464 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { 464 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const {
465 return window_; 465 return window_;
466 } 466 }
467 467
468 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { 468 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const {
469 #if defined(OS_WIN) 469 #if defined(OS_WIN)
470 HWND window = window_->GetRootWindow()->GetAcceleratedWidget(); 470 aura::RootWindow* root_window = window_->GetRootWindow();
471 return reinterpret_cast<gfx::NativeViewId>(window); 471 if (root_window) {
472 #else 472 HWND window = root_window->GetAcceleratedWidget();
473 return reinterpret_cast<gfx::NativeViewId>(window);
474 }
475 #endif
473 return static_cast<gfx::NativeViewId>(NULL); 476 return static_cast<gfx::NativeViewId>(NULL);
474 #endif
475 } 477 }
476 478
477 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { 479 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() {
478 NOTIMPLEMENTED(); 480 NOTIMPLEMENTED();
479 return static_cast<gfx::NativeViewAccessible>(NULL); 481 return static_cast<gfx::NativeViewAccessible>(NULL);
480 } 482 }
481 483
482 void RenderWidgetHostViewAura::MovePluginWindows( 484 void RenderWidgetHostViewAura::MovePluginWindows(
483 const gfx::Vector2d& scroll_offset, 485 const gfx::Vector2d& scroll_offset,
484 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { 486 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 gfx::Rect clip_rect; 619 gfx::Rect clip_rect;
618 if (paint_canvas_) { 620 if (paint_canvas_) {
619 SkRect sk_clip_rect; 621 SkRect sk_clip_rect;
620 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) 622 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect))
621 clip_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(sk_clip_rect)); 623 clip_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(sk_clip_rect));
622 } 624 }
623 625
624 if (!scroll_rect.IsEmpty()) 626 if (!scroll_rect.IsEmpty())
625 SchedulePaintIfNotInClip(scroll_rect, clip_rect); 627 SchedulePaintIfNotInClip(scroll_rect, clip_rect);
626 628
629 #if defined(OS_WIN)
630 aura::RootWindow* root_window = window_->GetRootWindow();
631 #endif
627 for (size_t i = 0; i < copy_rects.size(); ++i) { 632 for (size_t i = 0; i < copy_rects.size(); ++i) {
628 gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect); 633 gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect);
629 if (rect.IsEmpty()) 634 if (rect.IsEmpty())
630 continue; 635 continue;
631 636
632 SchedulePaintIfNotInClip(rect, clip_rect); 637 SchedulePaintIfNotInClip(rect, clip_rect);
633 638
634 #if defined(OS_WIN) 639 #if defined(OS_WIN)
635 // Send the invalid rect in screen coordinates. 640 if (root_window) {
636 gfx::Rect screen_rect = GetViewBounds(); 641 // Send the invalid rect in screen coordinates.
637 gfx::Rect invalid_screen_rect(rect); 642 gfx::Rect screen_rect = GetViewBounds();
638 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); 643 gfx::Rect invalid_screen_rect(rect);
639 HWND hwnd = window_->GetRootWindow()->GetAcceleratedWidget(); 644 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y());
640 PaintPluginWindowsHelper(hwnd, invalid_screen_rect); 645 HWND hwnd = root_window->GetAcceleratedWidget();
646 PaintPluginWindowsHelper(hwnd, invalid_screen_rect);
647 }
641 #endif // defined(OS_WIN) 648 #endif // defined(OS_WIN)
642 } 649 }
643 } 650 }
644 651
645 void RenderWidgetHostViewAura::RenderViewGone(base::TerminationStatus status, 652 void RenderWidgetHostViewAura::RenderViewGone(base::TerminationStatus status,
646 int error_code) { 653 int error_code) {
647 UpdateCursorIfOverSelf(); 654 UpdateCursorIfOverSelf();
648 Destroy(); 655 Destroy();
649 } 656 }
650 657
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 --render_widget_host_view->pending_thumbnail_tasks_; 1020 --render_widget_host_view->pending_thumbnail_tasks_;
1014 } 1021 }
1015 1022
1016 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { 1023 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) {
1017 RenderWidgetHostViewBase::SetBackground(background); 1024 RenderWidgetHostViewBase::SetBackground(background);
1018 host_->SetBackground(background); 1025 host_->SetBackground(background);
1019 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); 1026 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque());
1020 } 1027 }
1021 1028
1022 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { 1029 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) {
1023 GetScreenInfoForWindow(results, window_); 1030 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL);
1024 } 1031 }
1025 1032
1026 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { 1033 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
1027 return window_->GetToplevelWindow()->GetBoundsInScreen(); 1034 return window_->GetToplevelWindow()->GetBoundsInScreen();
1028 } 1035 }
1029 1036
1030 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( 1037 void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
1031 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { 1038 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) {
1032 ScopedVector<ui::TouchEvent> events; 1039 ScopedVector<ui::TouchEvent> events;
1033 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events)) 1040 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events))
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1183
1177 bool RenderWidgetHostViewAura::CanComposeInline() const { 1184 bool RenderWidgetHostViewAura::CanComposeInline() const {
1178 return can_compose_inline_; 1185 return can_compose_inline_;
1179 } 1186 }
1180 1187
1181 gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(const gfx::Rect& rect) { 1188 gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(const gfx::Rect& rect) {
1182 gfx::Point origin = rect.origin(); 1189 gfx::Point origin = rect.origin();
1183 gfx::Point end = gfx::Point(rect.right(), rect.bottom()); 1190 gfx::Point end = gfx::Point(rect.right(), rect.bottom());
1184 1191
1185 aura::RootWindow* root_window = window_->GetRootWindow(); 1192 aura::RootWindow* root_window = window_->GetRootWindow();
1186 aura::client::ScreenPositionClient* screen_position_client = 1193 if (root_window) {
1187 aura::client::GetScreenPositionClient(root_window); 1194 aura::client::ScreenPositionClient* screen_position_client =
1188 screen_position_client->ConvertPointToScreen(window_, &origin); 1195 aura::client::GetScreenPositionClient(root_window);
1189 screen_position_client->ConvertPointToScreen(window_, &end); 1196 screen_position_client->ConvertPointToScreen(window_, &origin);
1190 return gfx::Rect(origin.x(), 1197 screen_position_client->ConvertPointToScreen(window_, &end);
1191 origin.y(), 1198 return gfx::Rect(origin.x(),
1192 end.x() - origin.x(), 1199 origin.y(),
1193 end.y() - origin.y()); 1200 end.x() - origin.x(),
1201 end.y() - origin.y());
1202 }
1203
1204 return rect;
1194 } 1205 }
1195 1206
1196 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() { 1207 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() {
1197 const gfx::Rect rect = 1208 const gfx::Rect rect =
1198 gfx::UnionRects(selection_start_rect_, selection_end_rect_); 1209 gfx::UnionRects(selection_start_rect_, selection_end_rect_);
1199 return ConvertRectToScreen(rect); 1210 return ConvertRectToScreen(rect);
1200 } 1211 }
1201 1212
1202 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(uint32 index, 1213 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(uint32 index,
1203 gfx::Rect* rect) { 1214 gfx::Rect* rect) {
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 1686
1676 // If a gesture is not processed by the webpage, then WebKit processes it 1687 // If a gesture is not processed by the webpage, then WebKit processes it
1677 // (e.g. generates synthetic mouse events). 1688 // (e.g. generates synthetic mouse events).
1678 event->SetHandled(); 1689 event->SetHandled();
1679 } 1690 }
1680 1691
1681 //////////////////////////////////////////////////////////////////////////////// 1692 ////////////////////////////////////////////////////////////////////////////////
1682 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: 1693 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation:
1683 1694
1684 bool RenderWidgetHostViewAura::ShouldActivate() const { 1695 bool RenderWidgetHostViewAura::ShouldActivate() const {
1685 const ui::Event* event = window_->GetRootWindow()->current_event(); 1696 aura::RootWindow* root_window = window_->GetRootWindow();
1697 if (!root_window)
1698 return true;
1699 const ui::Event* event = root_window->current_event();
1686 if (!event) 1700 if (!event)
1687 return true; 1701 return true;
1688 return is_fullscreen_; 1702 return is_fullscreen_;
1689 } 1703 }
1690 1704
1691 //////////////////////////////////////////////////////////////////////////////// 1705 ////////////////////////////////////////////////////////////////////////////////
1692 // RenderWidgetHostViewAura, 1706 // RenderWidgetHostViewAura,
1693 // aura::client::ActivationChangeObserver implementation: 1707 // aura::client::ActivationChangeObserver implementation:
1694 1708
1695 void RenderWidgetHostViewAura::OnWindowActivated(aura::Window* gained_active, 1709 void RenderWidgetHostViewAura::OnWindowActivated(aura::Window* gained_active,
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 RenderWidgetHost* widget) { 2016 RenderWidgetHost* widget) {
2003 return new RenderWidgetHostViewAura(widget); 2017 return new RenderWidgetHostViewAura(widget);
2004 } 2018 }
2005 2019
2006 // static 2020 // static
2007 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 2021 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
2008 GetScreenInfoForWindow(results, NULL); 2022 GetScreenInfoForWindow(results, NULL);
2009 } 2023 }
2010 2024
2011 } // namespace content 2025 } // namespace content
OLDNEW
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | content/browser/web_contents/web_contents_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698