Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_widget_host_view_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 // Paint(scroll_rect) above. | 275 // Paint(scroll_rect) above. |
| 276 gfx::Rect rect = copy_rects[i].Subtract(scroll_rect); | 276 gfx::Rect rect = copy_rects[i].Subtract(scroll_rect); |
| 277 if (rect.IsEmpty()) | 277 if (rect.IsEmpty()) |
| 278 continue; | 278 continue; |
| 279 | 279 |
| 280 if (about_to_validate_and_paint_) | 280 if (about_to_validate_and_paint_) |
| 281 invalid_rect_ = invalid_rect_.Union(rect); | 281 invalid_rect_ = invalid_rect_.Union(rect); |
| 282 else | 282 else |
| 283 SchedulePaint(rect, false); | 283 SchedulePaint(rect, false); |
| 284 } | 284 } |
| 285 invalid_rect_ = invalid_rect_.Intersect(bounds()); | |
|
sadrul
2011/01/21 16:36:19
We need to either sanitize invalid_rect_ here, or
| |
| 285 } | 286 } |
| 286 | 287 |
| 287 void RenderWidgetHostViewViews::RenderViewGone(base::TerminationStatus status, | 288 void RenderWidgetHostViewViews::RenderViewGone(base::TerminationStatus status, |
| 288 int error_code) { | 289 int error_code) { |
| 289 GetRenderWidgetHost()->ViewDestroyed(); | 290 GetRenderWidgetHost()->ViewDestroyed(); |
| 290 Destroy(); | 291 Destroy(); |
| 291 } | 292 } |
| 292 | 293 |
| 293 void RenderWidgetHostViewViews::Destroy() { | 294 void RenderWidgetHostViewViews::Destroy() { |
| 294 // host_'s destruction brought us here, null it out so we don't use it | 295 // host_'s destruction brought us here, null it out so we don't use it |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 } | 352 } |
| 352 | 353 |
| 353 void RenderWidgetHostViewViews::Paint(gfx::Canvas* canvas) { | 354 void RenderWidgetHostViewViews::Paint(gfx::Canvas* canvas) { |
| 354 if (is_hidden_) { | 355 if (is_hidden_) { |
| 355 return; | 356 return; |
| 356 } | 357 } |
| 357 | 358 |
| 358 // Paint a "hole" in the canvas so that the render of the web page is on | 359 // Paint a "hole" in the canvas so that the render of the web page is on |
| 359 // top of whatever else has already been painted in the views hierarchy. | 360 // top of whatever else has already been painted in the views hierarchy. |
| 360 // Later views might still get to paint on top. | 361 // Later views might still get to paint on top. |
| 361 canvas->FillRectInt(SK_ColorBLACK, 0, 0, kMaxWindowWidth, kMaxWindowHeight, | 362 canvas->FillRectInt(SK_ColorBLACK, 0, 0, |
| 363 bounds().width(), bounds().height(), | |
| 362 SkXfermode::kClear_Mode); | 364 SkXfermode::kClear_Mode); |
| 363 | 365 |
| 364 // Don't do any painting if the GPU process is rendering directly | 366 // Don't do any painting if the GPU process is rendering directly |
| 365 // into the View. | 367 // into the View. |
| 366 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); | 368 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); |
| 367 if (render_widget_host->is_accelerated_compositing_active()) { | 369 if (render_widget_host->is_accelerated_compositing_active()) { |
| 368 return; | 370 return; |
| 369 } | 371 } |
| 370 | 372 |
| 371 GdkWindow* window = GetInnerNativeView()->window; | 373 GdkWindow* window = GetInnerNativeView()->window; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 766 } | 768 } |
| 767 | 769 |
| 768 // static | 770 // static |
| 769 RenderWidgetHostView* | 771 RenderWidgetHostView* |
| 770 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 772 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 771 gfx::NativeView widget) { | 773 gfx::NativeView widget) { |
| 772 gpointer user_data = g_object_get_data(G_OBJECT(widget), | 774 gpointer user_data = g_object_get_data(G_OBJECT(widget), |
| 773 kRenderWidgetHostViewKey); | 775 kRenderWidgetHostViewKey); |
| 774 return reinterpret_cast<RenderWidgetHostView*>(user_data); | 776 return reinterpret_cast<RenderWidgetHostView*>(user_data); |
| 775 } | 777 } |
| OLD | NEW |