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

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: And fix the final ExtensionApiTest.AlertBasic case. 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
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 5c2bc7bcb4f6c6a79be3fa1a69b5a9ef0d0d519a..5c43acc04efe173d53838838efd7962cb26efe70 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -466,11 +466,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();
Elliot Glaysher 2013/01/18 20:31:38 If you search through this file, you'll see that h
+ 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() {
@@ -621,6 +623,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())
@@ -629,12 +634,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)
}
}
@@ -1013,7 +1020,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() {
@@ -1176,14 +1183,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() {
@@ -1673,7 +1684,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_;

Powered by Google App Engine
This is Rietveld 408576698