Closed Bug 1079157 Opened 10 years ago Closed 10 years ago

Logical coordinate support for columns

Categories

(Core :: Layout: Text and Fonts, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: smontagu, Assigned: jfkthame)

References

(Blocks 1 open bug)

Details

Attachments

(5 files, 6 obsolete files)

8.02 KB, text/html
Details
1.68 KB, text/html
Details
45.77 KB, patch
smontagu
: review+
Details | Diff | Splinter Review
16.34 KB, patch
smontagu
: review+
Details | Diff | Splinter Review
28.81 KB, patch
smontagu
: review+
Details | Diff | Splinter Review
Part of support for vertical text
Here's a WIP patch. This seems to make columns basically work in vertical writing modes, though hasn't been tested much yet.
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Updated and tidied up this patch a bit; it seems pretty functional in my simple testing. (We'll want a bunch of proper testcases...)
Attachment #8530275 - Flags: review?(smontagu)
Attachment #8519084 - Attachment is obsolete: true
Here's a simple example to play with. Note that it behaves quite erratically (chunks of the text disappear or are smashed together on the right) during horizontal resizing, and sometimes when changing the various options. I'm about to file a separate bug on this; it's not specific to columns.
(In reply to Jonathan Kew (:jfkthame) from comment #3) > Created attachment 8530287 [details] > sample with columns in vertical writing mode > > Here's a simple example to play with. > > Note that it behaves quite erratically (chunks of the text disappear or are > smashed together on the right) during horizontal resizing, and sometimes > when changing the various options. I'm about to file a separate bug on this; > it's not specific to columns. smontagu got there first, and filed bug 1106083 on this.
The patch above doesn't return proper metrics for the columnset, with the result that things break badly in vertical-rl mode when the columnset frame is only one of several children of its container; it's liable to disappear, as in this example.
And here's a slightly revised patch that works much better; the testcase above now looks good in all writing modes.
Attachment #8530513 - Flags: review?(smontagu)
Attachment #8530275 - Attachment is obsolete: true
Attachment #8530275 - Flags: review?(smontagu)
Comment on attachment 8530513 [details] [diff] [review] Make nsColumnSetFrame support vertical writing mode To make this a bit easier to review (I hope), I'm splitting it into two patches; first, purely mechanical renaming of a bunch of local variables and members in nsColumnSetFrame, generated with sed; and then the manual changes that actually make things work in vertical mode. That way, the first patch should need little more than a rubber-stamp, and it'll be easier to follow the real changes in the second.
Attachment #8530513 - Attachment is obsolete: true
Attachment #8530513 - Flags: review?(smontagu)
Attachment #8530527 - Flags: review?(smontagu)
Please excuse the churn, but I'm going to refresh these patches once more: in addition to the mechanical renaming in part 1, I've split a bunch of comment-only hunks, as well as some whitespace cleanup, out into a new part 2 patch, to make it easier to see the actual code changes in the final part 3.
Attachment #8530526 - Attachment is obsolete: true
Attachment #8530526 - Flags: review?(smontagu)
Attachment #8530527 - Attachment is obsolete: true
Attachment #8530527 - Flags: review?(smontagu)
Comment on attachment 8530533 [details] [diff] [review] part 1 - Purely mechanical renaming of local variables and members in nsColumnSetFrame Review of attachment 8530533 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for doing the split!
Attachment #8530533 - Flags: review?(smontagu) → review+
Attachment #8530534 - Flags: review?(smontagu) → review+
Comment on attachment 8530535 [details] [diff] [review] part 3 - Make nsColumnSetFrame support vertical writing mode Review of attachment 8530535 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsColumnSetFrame.cpp @@ +771,5 @@ > } > } > > aColData.mMaxBSize = contentBEnd; > contentRect.height = std::max(contentRect.height, contentBEnd); This seems like mixing logical and physical coordinates, as does the initialization of contentSize a few lines below. Is there any reason why contentRect can't be a LogicalRect?
You're right, things were a little fishy there. Here's an updated patch that fixes the confusion, and appears to work better too. It seemed easier to keep contentRect as physical while it's being computed (unioning in the rects of the child frames), but then the final contentSize is converted properly to logical coordinates.
Attachment #8531014 - Flags: review?(smontagu)
Attachment #8530535 - Attachment is obsolete: true
Attachment #8530535 - Flags: review?(smontagu)
Comment on attachment 8531014 [details] [diff] [review] part 3 - Make nsColumnSetFrame support vertical writing mode Review of attachment 8531014 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsColumnSetFrame.cpp @@ -721,3 @@ > > - WritingMode wm = aReflowState.GetWritingMode(); > - LogicalSize contentSize(wm, nsSize(contentRect.XMost(), contentRect.YMost())); So instead of these two lines you just have LogicalSize contentSize = LogicalSize(wm, contentRect.Size()); Do subtracting border padding and the difference between the size and the XMost/YMost necessarily cancel out?
*sigh*. "review" doesn't show the same quoted content in the preview of a comment that appears when publishing. Do we have a bug on that? "These two lines" in comment 17 mean - contentRect -= nsPoint(physicalBP.left, physicalBP.top); and - // contentRect included the borderPadding.left,borderPadding.top of the child rects - LogicalSize contentSize(wm, nsSize(contentRect.XMost(), contentRect.YMost()));
(In reply to Simon Montagu :smontagu from comment #17) > Comment on attachment 8531014 [details] [diff] [review] > part 3 - Make nsColumnSetFrame support vertical writing mode > > Review of attachment 8531014 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: layout/generic/nsColumnSetFrame.cpp > @@ -721,3 @@ > > > > - WritingMode wm = aReflowState.GetWritingMode(); > > - LogicalSize contentSize(wm, nsSize(contentRect.XMost(), contentRect.YMost())); > > So instead of these two lines you just have > LogicalSize contentSize = LogicalSize(wm, contentRect.Size()); > > Do subtracting border padding and the difference between the size and the > XMost/YMost necessarily cancel out? AFAICT, yes. The accumulated contentRect will have been "offset" by the topLeft of the borderPadding; subtracting that leaves its topLeft at 0,0, and its XMost/YMost is then the same as Size. I tried putting a big fat border on the columnSet frame and confirmed that this still behaves as expected.
Comment on attachment 8531014 [details] [diff] [review] part 3 - Make nsColumnSetFrame support vertical writing mode Review of attachment 8531014 [details] [diff] [review]: ----------------------------------------------------------------- OK, I'll buy that
Attachment #8531014 - Flags: review?(smontagu) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: