Last Comment Bug 126620 - [FIX]dir="reverse" confuses wrapped text
: [FIX]dir="reverse" confuses wrapped text
Product: Core
Classification: Components
Component: XUL (show other bugs)
: Trunk
: All All
P1 normal (vote)
: mozilla1.8beta1
Assigned To: Boris Zbarsky [:bz] (still a bit busy)
: Neil Deakin
: 235898 (view as bug list)
Depends on:
Blocks: 272420
  Show dependency treegraph
Reported: 2002-02-20 04:02 PST by
Modified: 2008-07-31 03:06 PDT (History)
9 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Test Case (1.67 KB, application/vnd.mozilla.xul+xml)
2002-02-20 04:06 PST,
no flags Details
Proposed patch (1.92 KB, patch)
2005-01-10 23:24 PST, Boris Zbarsky [:bz] (still a bit busy)
dbaron: review+
dbaron: superreview+
Details | Diff | Splinter Review

Description User image 2002-02-20 04:02:43 PST
Direct children of a <vbox dir="reverse"> will display in the wrong position if
they contain wrapped text either automatically or manually via e.g.
<label style="white-space: -moz-pre-wrap;">wrapped
The position is offset exactly by the amount of extra height required for the
wrapping. The computed height is correct, and adjacent elements will compute
their position correctly if they do not contain wrapped text.
Comment 1 User image 2002-02-20 04:06:23 PST
Created attachment 70494 [details]
Test Case

To see the effect, click on the vbox, the handler reverses the direction.
Comment 2 User image 2004-02-28 04:06:21 PST
*** Bug 235898 has been marked as a duplicate of this bug. ***
Comment 3 User image Boris Zbarsky [:bz] (still a bit busy) 2005-01-10 23:24:49 PST
Created attachment 170892 [details] [diff] [review]
Proposed patch

The basic problem is that the wrapping changes the size of the box in the
layout loop.  So we go through the "if the child was a block or inline (e.g.,
HTML) it may have changed its rect *during* layout" branch of Layout().  In
this branch, the child's new rect is simply passed to SetBounds() when all is
said and done.	For normal-direction layout this is fine, since the child's
rect will have changed size but not changed position.  But for reverse layout,
we need to keep the rect at the same "far" (XMost or YMost) end, so a change in
size means we need to adjust the origin accordingly.

That's all this patch does.
Comment 4 User image Simon Montagu :smontagu 2005-01-11 00:16:39 PST
Have you tested the patch in left-to-right and right-to-left contexts? The
interaction of dir="reverse" with right-to-left layout can be tricky.
Comment 5 User image Boris Zbarsky [:bz] (still a bit busy) 2005-01-11 10:28:33 PST
I've done some testing, yes.  I can't actually get the original bug to appear in
a horizontal context (because of the way XUL layout works), which is where this
could possibly be relevant.  So the testing was necessarily somewhat limited --
I just verified that the layout is correct both with and without the patch.
Comment 6 User image David Baron :dbaron: ⌚️UTC-8 2005-01-15 11:11:26 PST
Comment on attachment 170892 [details] [diff] [review]
Proposed patch

r+sr=dbaron, but does anyone do things like reposition views for this movement?
Comment 7 User image Boris Zbarsky [:bz] (still a bit busy) 2005-01-15 13:51:57 PST
Yes, the SetBounds() call handles that.  Checked in for 1.8b.

Note You need to log in before you can comment on or make changes to this bug.