Chromium Code Reviews| Index: views/view.cc |
| diff --git a/views/view.cc b/views/view.cc |
| index 81866d4aa2c69927f2fc6f84b42a1b451a121283..fc915c32e8b0154c6c3f7ad8b767684615a31e73 100644 |
| --- a/views/view.cc |
| +++ b/views/view.cc |
| @@ -6,6 +6,7 @@ |
| #include <algorithm> |
| +#include "base/debug/trace_event.h" |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/message_loop.h" |
| @@ -116,6 +117,7 @@ View::View() |
| previous_focusable_view_(NULL), |
| focusable_(false), |
| accessibility_focusable_(false), |
| + painting_enabled_(true), |
| context_menu_controller_(NULL), |
| drag_controller_(NULL) { |
| } |
| @@ -432,11 +434,6 @@ void View::SetTransform(const ui::Transform& transform) { |
| SchedulePaint(); |
| } else { |
| - // Make sure if the view didn't have its own texture and was painting onto |
| - // something else, that gets refreshed too. |
| - if (!ShouldPaintToLayer()) |
|
sky
2011/08/17 16:39:42
How come you're removing this case?
|
| - MarkLayerDirty(); |
| - |
| if (!layer_helper_.get()) |
| layer_helper_.reset(new internal::LayerHelper()); |
| layer_helper_->SetTransform(transform); |
| @@ -445,15 +442,7 @@ void View::SetTransform(const ui::Transform& transform) { |
| SchedulePaint(); |
| } else { |
| layer_helper_->property_setter()->SetTransform(layer(), transform); |
| - // We have a layer. When the transform changes and the layer is up to |
| - // date we don't want to SchedulePaint as it'll trigger painting to the |
| - // layer. Instead we tell the Widget to paint, which makes the |
| - // compositor draw using the existing layer. |
| - // We schedule paint the complete bounds as compositor generally don't |
| - // support partial painting. |
| - Widget* widget = GetWidget(); |
| - if (widget) |
| - widget->SchedulePaintInRect(widget->GetRootView()->bounds()); |
| + ScheduleComposite(); |
| } |
| } |
| } |
| @@ -534,6 +523,7 @@ int View::GetMirroredXWithWidthInView(int x, int w) const { |
| // Layout ---------------------------------------------------------------------- |
| void View::Layout() { |
| + TRACE_EVENT0("View", "Layout"); |
| needs_layout_ = false; |
| // If we have a layout manager, let it handle the layout for us. |
| @@ -702,8 +692,15 @@ void View::SchedulePaintInRect(const gfx::Rect& rect) { |
| SchedulePaintInternal(rect); |
| } |
| +void View::ScheduleComposite() { |
| + if (parent_) { |
|
sky
2011/08/17 16:39:42
no {}
|
| + parent_->ScheduleComposite(); |
| + } |
| +} |
| + |
| void View::Paint(gfx::Canvas* canvas) { |
| - if (!IsVisible()) |
| + TRACE_EVENT0("View", "Paint"); |
| + if (!IsVisible() || !painting_enabled()) |
| return; |
| ScopedCanvas scoped_canvas(NULL); |
| @@ -1170,6 +1167,7 @@ void View::OnPaintFocusBorder(gfx::Canvas* canvas) { |
| // Accelerated Painting -------------------------------------------------------- |
| void View::PaintComposite() { |
| + TRACE_EVENT0("View", "PaintComposite"); |
| if (!IsVisible()) |
| return; |