Closed Bug 1093553 Opened 7 years ago Closed 7 years ago

improve handling of line-height metrics, block ascent, etc., in vertical writing mode


(Core :: Layout: Block and Inline, defect)

Not set





(Reporter: jfkthame, Assigned: jfkthame)


(Blocks 1 open bug)



(3 files, 1 obsolete file)

We need to tidy up the handling of line-height metrics etc in vertical mode. Using the attached testcase:

* the lines with Latin text are spaced much too widely in vertical mode with sideways-right or mixed orientation, while they're fine in vertical/upright;

* the line with Chinese characters moves horizontally by a substantial distance when switching between upright and sideways display;

* the different sizes of Latin characters are not properly baseline-aligned when displayed with sideways orientation.

Fixing this will provide a better basis for addressing the vertical-align problems (e.g. <sub> and <sup> elements) in bug 1084370.
A couple of things to do here: we need to be more careful to distinguish when we have a vertical text run from when we're using vertical font metrics; and we need to deal with "inverted" lines (sideways-right text in vertical-lr mode) where the block-dir *ascent* will correspond to the text *descent*.
This makes things a lot better; it renames a bunch of 'vertical' flags to clarify whether they're referring to vertical runs or vertical metrics, and fixes ascent/descent issues. What remains after this patch is that with text-orientation:mixed, the different sizes of Latin text appear centered instead of baseline-aligned. (They're fine in sideways-right mode, where we know the run as a whole should have a dominant alphabetic baseline.)
Attachment #8516605 - Flags: review?(smontagu)
Assignee: nobody → jfkthame
Oh, and here's the testcase I intended to attach from the start.
One more thing - with the improved handling of baseline and ascent/descent, we need to make a corresponding fix in nsCaret for the case of "inverted" lines.
Attachment #8516651 - Flags: review?(smontagu)
Attachment #8516605 - Attachment is obsolete: true
Attachment #8516605 - Flags: review?(smontagu)
Oops, attached the wrong patch as the "followup". Here it is for real.
Attachment #8516652 - Flags: review?(smontagu)
Comment on attachment 8516651 [details] [diff] [review]
Improve handling of line-height metrics, block ascent, etc., in vertical writing mode

Review of attachment 8516651 [details] [diff] [review]:

I think this is OK, though I'm not hugely familiar with all the code you're touching here.

::: layout/base/nsCSSRendering.cpp
@@ +4165,5 @@
>        NS_ERROR("Invalid style value!");
>        return;
>    }
>    // The y position should be set to the middle of the line.

Make the comment here and in the next hunk talk about block direction instead of y
Attachment #8516651 - Flags: review?(smontagu) → review+
Attachment #8516652 - Flags: review?(smontagu) → review+
You need to log in before you can comment on or make changes to this bug.