Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upwriting mode needs to affect computed display #15754
Comments
|
I would like to look into this, if I can get some help on how to get started |
|
Hi @bd339, thanks for taking a look at this! So, the specified display adjustment lives at
Note that may be somewhat tricky because we need to skip text nodes from this, which is tricky because even though they inherit style from the parent, the writing mode should not change, but could with display: contents. |
|
I should note that there are some spec-side issues here too. I just sent https://lists.w3.org/Archives/Public/www-style/2017Mar/0045.html describing those. But it sounds like @emilio's suggestion matches Gecko which is about right for now. |
|
Yeah, note that for this to match gecko, as noted in the email above, that piece of code should be under the existing display adjustments, and should call |
|
Thanks for pointing me in the right direction @bzbarsky and @emilio . I'm not sure I understand what you said about text nodes, so I'll show an example so you can correct me. First off, if we assume Finally (because <div>
<span style="writing-mode: vertical-rl; display: contents">A text node</span>
</div>As in: "A text node" inherits the vertical-rl writing-mode from the span but because of display: contents, it would be as if "A text node" is a direct child of the div, and its writing-mode would actually differ from its parent's? |
|
@bd339 That's correct. For what it's worth, Gecko skips this writing mode fixup at this point in two situations: for text and for first-letter continuations. I think first-letter continuations can never have a writing-mode different from their "containing block", because they inherit either from the block directly or from the first-line, the "writing-mode" property does not apply to either first-letter or first-line, and things with "display:contents" don't generate first-letters. We should probably add asserts that we don't have a first-letter continuation ever hitting this case... |
If a box has a different writing-mode than its containing block, and has a specified display of inline, change the computed display to inline-block. Also adds the second manual testcase from servo#15754 as a WPT to assert that the computed display does in fact change.
Make writing-mode affect computed display <!-- Please describe your changes on the following line: --> The first manual test-case in #15754 passes now, but the second test-case still renders "Text" horizontally, which is apparently because of servo's experimental support for writing-mode. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15754 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16044) <!-- Reviewable:end -->
Make writing-mode affect computed display <!-- Please describe your changes on the following line: --> The first manual test-case in #15754 passes now, but the second test-case still renders "Text" horizontally, which is apparently because of servo's experimental support for writing-mode. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15754 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16044) <!-- Reviewable:end -->
If a box has a different writing-mode than its containing block, and has a specified display of inline, change the computed display to inline-block. Also adds the second manual testcase from servo#15754 as a WPT to assert that the computed display does in fact change.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1342739 and the following two testcases that stylo fails but gecko passes:
(should output "inline-block") and:
(should not have the green border overlapping the text). That's because servo doesn't implement the provisions in https://drafts.csswg.org/css-writing-modes-3/#block-flow for boxes with specified display of "inline".
For stylo this should happen unconditionally. For servo, I guess this should happen only when "layout.writing-mode.enabled" is on? The rendering in that mode is way more broken than the stylo rendering anyway; there be problems there.