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

Unified Diff: ui/views/view.cc

Issue 2561253002: [ash-md] Adds support for Z-order iteration in views::View (Closed)
Patch Set: [ash-md] Adds support for Z-order iteration in views::View (nit) Created 3 years, 12 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 | « ui/views/view.h ('k') | ui/views/view_targeter_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index f28af0c153441ac7b965f8f8555b94d4c41ef9e9..68c0e0e752db76243a8ebe287d17b119b2f52c84 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -496,6 +496,10 @@ void View::OnEnabledChanged() {
SchedulePaint();
}
+View::Views View::GetChildrenInZOrder() {
+ return children_;
+}
+
// Transformations -------------------------------------------------------------
gfx::Transform View::GetTransform() const {
@@ -954,7 +958,9 @@ View* View::GetTooltipHandlerForPoint(const gfx::Point& point) {
// Walk the child Views recursively looking for the View that most
// tightly encloses the specified point.
- for (auto* child : base::Reversed(children_)) {
+ View::Views children = GetChildrenInZOrder();
+ DCHECK_EQ(child_count(), static_cast<int>(children.size()));
+ for (auto* child : base::Reversed(children)) {
if (!child->visible())
continue;
@@ -1473,8 +1479,9 @@ void View::NativeViewHierarchyChanged() {
void View::PaintChildren(const ui::PaintContext& context) {
TRACE_EVENT1("views", "View::PaintChildren", "class", GetClassName());
- internal::ScopedChildrenLock lock(this);
- for (auto* child : children_) {
+ View::Views children = GetChildrenInZOrder();
+ DCHECK_EQ(child_count(), static_cast<int>(children.size()));
+ for (auto* child : children) {
if (!child->layer())
child->Paint(context);
}
@@ -1628,10 +1635,10 @@ void View::ReorderChildLayers(ui::Layer* parent_layer) {
// Iterate backwards through the children so that a child with a layer
// which is further to the back is stacked above one which is further to
// the front.
- internal::ScopedChildrenLock lock(this);
- for (auto* child : base::Reversed(children_)) {
+ View::Views children = GetChildrenInZOrder();
+ DCHECK_EQ(child_count(), static_cast<int>(children.size()));
+ for (auto* child : base::Reversed(children))
child->ReorderChildLayers(parent_layer);
- }
}
}
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_targeter_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698