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

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: 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..b0a5bf5035bafa1a352a2e8d65d32dc587c2ba67 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) {
// 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 =
@@ -1922,6 +1922,19 @@ void View::BoundsChanged(const gfx::Rect& previous_bounds) {
UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL));
}
+ // 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()) {
sky 2015/01/06 16:45:50 I get that you need to do something in this case,
Matt Giuca 2015/01/07 00:48:44 You can't just call UpdateChildLayerBounds on the
sky 2015/01/07 16:55:56 UpdateChildLayerBounds calls SetLayerBounds.
Matt Giuca 2015/01/07 23:30:00 Hmm, yeah it does (didn't notice that before), but
+ for (int i = 0; i < child_count(); ++i) {
+ View* child = child_at(i);
+ child->MirroredBoundsChanged(child->bounds());
+ }
+ }
+}
+
+void View::BoundsChanged(const gfx::Rect& previous_bounds) {
+ MirroredBoundsChanged(previous_bounds);
+
OnBoundsChanged(previous_bounds);
if (previous_bounds.size() != size()) {
« 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