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

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: Directly call UpdateChildLayerBounds instead of a new method. 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 | « no previous file | ui/views/view_unittest.cc » ('j') | ui/views/view_unittest.cc » ('J')
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..6e366e7c467f9e1ef531e7a5b24995148f506dfd 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -1922,6 +1922,25 @@ 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. Update the child's layer bounds, or if it is not a layer, the
+ // bounds of any layers inside the child.
+ if (base::i18n::IsRTL() && bounds_.width() != previous_bounds.width()) {
+ for (int i = 0; i < child_count(); ++i) {
+ View* child = child_at(i);
+ gfx::Vector2d offset;
+ if (child->layer()) {
+ offset = gfx::Vector2d(child->GetMirroredX(), child->y()) +
+ CalculateOffsetToAncestorWithLayer(NULL);
+ } else {
+ // If the child's bounds have changed, then any descendant layer bounds
+ // may have changed. Update them accordingly.
+ offset = child->CalculateOffsetToAncestorWithLayer(NULL);
+ }
+ child->UpdateChildLayerBounds(offset);
+ }
+ }
+
OnBoundsChanged(previous_bounds);
if (previous_bounds.size() != size()) {
« no previous file with comments | « no previous file | ui/views/view_unittest.cc » ('j') | ui/views/view_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698