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

Unified Diff: ui/views/view.cc

Issue 819273003: View: Resizing a layer in RTL now correctly repositions its children. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move recursive call out of MirroredBoundsChanged (equivalent). Created 5 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
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_unittest.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 7bf2ee68bc5512afdb7cb7ecbedbbf1fe6b0de2a..f8477959242a7fb47f2b46669f61228769f19939 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -1894,7 +1894,7 @@ void View::VisibilityChangedImpl(View* starting_from, bool is_visible) {
VisibilityChanged(starting_from, is_visible);
}
-void View::BoundsChanged(const gfx::Rect& previous_bounds) {
+void View::MirroredBoundsChanged(const gfx::Rect& previous_bounds) {
sky 2015/01/08 03:33:27 I'm still against a new method here. As previously
Matt Giuca 2015/01/08 04:22:15 Is this what you want? I find this new version pr
sky 2015/01/08 22:05:02 What do you mean? UpdateChildLayerBounds handles t
Matt Giuca 2015/01/09 03:28:05 OK I see how you simplified it. I've verified that
// Mark our bounds as dirty for the paint root, also see if we need to
// recompute our children's bounds due to origin change.
bool origin_changed =
@@ -1921,6 +1921,19 @@ void View::BoundsChanged(const gfx::Rect& previous_bounds) {
// changed. Update them accordingly.
UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL));
}
+}
+
+void View::BoundsChanged(const gfx::Rect& previous_bounds) {
+ MirroredBoundsChanged(previous_bounds);
+
+ // In RTL mode, if our width has changed, our children's mirrored bounds will
+ // have changed. Notify them, so that they can update their layer bounds, etc.
+ if (base::i18n::IsRTL() && bounds_.width() != previous_bounds.width()) {
+ for (int i = 0; i < child_count(); ++i) {
+ View* child = child_at(i);
+ child->MirroredBoundsChanged(child->bounds());
+ }
+ }
OnBoundsChanged(previous_bounds);
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698