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

Unified Diff: ui/aura/window.cc

Issue 102313002: Wires up painting of layerless children (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 7 years 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 | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index fcb5ac966eade1a8ed9952c9bb8a7e18c24e8d10..692e345753bfe0f9e8366b3f350294e1377ac7b5 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -32,6 +32,7 @@
#include "ui/gfx/animation/multi_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/path.h"
+#include "ui/gfx/scoped_canvas.h"
#include "ui/gfx/screen.h"
namespace aura {
@@ -829,7 +830,8 @@ void Window::SetBoundsInternal(const gfx::Rect& new_bounds) {
}
void Window::SetVisible(bool visible) {
- if (visible == layer_->GetTargetVisibility())
+ if ((layer_ && visible == layer_->GetTargetVisibility()) ||
+ (!layer_ && visible == visible_))
return; // No change.
FOR_EACH_OBSERVER(WindowObserver, observers_,
@@ -843,7 +845,7 @@ void Window::SetVisible(bool visible) {
client::GetVisibilityClient(this);
if (visibility_client)
visibility_client->UpdateLayerVisibility(this, visible);
- else
+ else if (layer_)
layer_->SetVisible(visible);
visible_ = visible;
SchedulePaint();
@@ -863,6 +865,25 @@ void Window::SchedulePaint() {
SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height()));
}
+void Window::Paint(gfx::Canvas* canvas) {
+ if (delegate_)
+ delegate_->OnPaint(canvas);
+ PaintLayerlessChildren(canvas);
+}
+
+void Window::PaintLayerlessChildren(gfx::Canvas* canvas) {
+ for (size_t i = 0, count = children_.size(); i < count; ++i) {
+ Window* child = children_[i];
+ if (!child->layer_ && child->visible_) {
+ gfx::ScopedCanvas scoped_canvas(canvas);
+ if (canvas->ClipRect(child->bounds())) {
+ canvas->Translate(child->bounds().OffsetFromOrigin());
+ child->Paint(canvas);
+ }
+ }
+ }
+}
+
Window* Window::GetWindowForPoint(const gfx::Point& local_point,
bool return_tightest,
bool for_event_handling) {
@@ -1293,8 +1314,7 @@ void Window::OnWindowBoundsChanged(const gfx::Rect& old_bounds,
}
void Window::OnPaintLayer(gfx::Canvas* canvas) {
- if (delegate_)
- delegate_->OnPaint(canvas);
+ Paint(canvas);
}
base::Closure Window::PrepareForLayerBoundsChange() {
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698