From 19bebd0304fabb04866125d296399a0c68a1955f Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Wed, 6 Apr 2011 18:27:34 +0000 Subject: Fixes bug in View::OnBoundsChange painting the old/new. The code wasn't adjusting for RTL. BUG=none TEST=none R=ben@chromium.org,davemoore@chromium.org Review URL: http://codereview.chromium.org/6793050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80663 0039d316-1c4b-4281-b951-d872f2087c98 --- views/view.cc | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/views/view.cc b/views/view.cc index 5494a4e..c94831a 100644 --- a/views/view.cc +++ b/views/view.cc @@ -1362,13 +1362,24 @@ void View::BoundsChanged(const gfx::Rect& previous_bounds) { if (canvas_.get()) canvas_.reset(gfx::Canvas::CreateCanvas(width(), height(), false)); - if (parent_) { - parent_->SchedulePaintInRect(previous_bounds); - parent_->SchedulePaintInRect(bounds_); - } else { - // Previous bounds has no meaning to an orphan. This should only happen - // when the View is a RootView. - SchedulePaintInRect(gfx::Rect(0, 0, bounds_.width(), bounds_.height())); + if (IsVisible()) { + if (parent_) { + // Paint the old bounds. + if (base::i18n::IsRTL()) { + gfx::Rect paint_rect = previous_bounds; + paint_rect.set_x(parent()->GetMirroredXForRect(paint_rect)); + parent_->SchedulePaintInRect(paint_rect); + } else { + parent_->SchedulePaintInRect(previous_bounds); + } + + // Then the new. + parent_->SchedulePaintInRect(GetMirroredBounds()); + } else { + // Previous bounds has no meaning to an orphan. This should only happen + // when the View is a RootView. + SchedulePaintInRect(gfx::Rect(0, 0, bounds_.width(), bounds_.height())); + } } OnBoundsChanged(previous_bounds); -- cgit v1.1