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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 81d3a4e7e172cf7ee2baf77302ce26c0c073839e..a7dd91b8787d6cb778d35b937c16e74ea19bb80d 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -467,11 +467,13 @@ gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const {
gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const {
#if defined(OS_WIN)
- HWND window = window_->GetRootWindow()->GetAcceleratedWidget();
- return reinterpret_cast<gfx::NativeViewId>(window);
-#else
- return static_cast<gfx::NativeViewId>(NULL);
+ aura::RootWindow* root_window = window_->GetRootWindow();
+ if (root_window) {
+ HWND window = root_window->GetAcceleratedWidget();
+ return reinterpret_cast<gfx::NativeViewId>(window);
+ }
#endif
+ return static_cast<gfx::NativeViewId>(NULL);
}
gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() {
@@ -624,6 +626,9 @@ void RenderWidgetHostViewAura::DidUpdateBackingStore(
if (!scroll_rect.IsEmpty())
SchedulePaintIfNotInClip(scroll_rect, clip_rect);
+#if defined(OS_WIN)
+ aura::RootWindow* root_window = window_->GetRootWindow();
+#endif
for (size_t i = 0; i < copy_rects.size(); ++i) {
gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect);
if (rect.IsEmpty())
@@ -632,12 +637,14 @@ void RenderWidgetHostViewAura::DidUpdateBackingStore(
SchedulePaintIfNotInClip(rect, clip_rect);
#if defined(OS_WIN)
- // Send the invalid rect in screen coordinates.
- gfx::Rect screen_rect = GetViewBounds();
- gfx::Rect invalid_screen_rect(rect);
- invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y());
- HWND hwnd = window_->GetRootWindow()->GetAcceleratedWidget();
- PaintPluginWindowsHelper(hwnd, invalid_screen_rect);
+ if (root_window) {
+ // Send the invalid rect in screen coordinates.
+ gfx::Rect screen_rect = GetViewBounds();
+ gfx::Rect invalid_screen_rect(rect);
+ invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y());
+ HWND hwnd = root_window->GetAcceleratedWidget();
+ PaintPluginWindowsHelper(hwnd, invalid_screen_rect);
+ }
#endif // defined(OS_WIN)
}
}
@@ -1020,7 +1027,7 @@ void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) {
}
void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) {
- GetScreenInfoForWindow(results, window_);
+ GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL);
}
gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
@@ -1183,14 +1190,18 @@ gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(const gfx::Rect& rect) {
gfx::Point end = gfx::Point(rect.right(), rect.bottom());
aura::RootWindow* root_window = window_->GetRootWindow();
- aura::client::ScreenPositionClient* screen_position_client =
- aura::client::GetScreenPositionClient(root_window);
- screen_position_client->ConvertPointToScreen(window_, &origin);
- screen_position_client->ConvertPointToScreen(window_, &end);
- return gfx::Rect(origin.x(),
- origin.y(),
- end.x() - origin.x(),
- end.y() - origin.y());
+ if (root_window) {
+ aura::client::ScreenPositionClient* screen_position_client =
+ aura::client::GetScreenPositionClient(root_window);
+ screen_position_client->ConvertPointToScreen(window_, &origin);
+ screen_position_client->ConvertPointToScreen(window_, &end);
+ return gfx::Rect(origin.x(),
+ origin.y(),
+ end.x() - origin.x(),
+ end.y() - origin.y());
+ }
+
+ return rect;
}
gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() {
@@ -1682,7 +1693,10 @@ void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
// RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation:
bool RenderWidgetHostViewAura::ShouldActivate() const {
- const ui::Event* event = window_->GetRootWindow()->current_event();
+ aura::RootWindow* root_window = window_->GetRootWindow();
+ if (!root_window)
+ return true;
+ const ui::Event* event = root_window->current_event();
if (!event)
return true;
return is_fullscreen_;
« 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