-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create span
instead of rb
elements
#238
Conversation
Closes sandflow#237. Empirically, it appears that browsers (Firefox and Chrome) do not implement layout on the currently deprecated `rb` element in the same way as on other elements. Specifically, they seem not to extend the padding rectangle to include the padded rectangles of child `span`s. Replacing the `rb` elements with `span` elements works around this. If at some point `rb` is un-deprecated, and this feature/bug of layout is improved, this change should be reverted.
Checking back against the example provided in #237, this may in fact only partially resolve that issue. However it does solve the problem with linePadding caused when the last text on the line is a ruby base. |
Correctly puts the background-color attribute on merged spans.
2nd commit abff02b addresses the problem of |
There may be an additional problem, probably should be opened as a separate issue, where the computation of line edges for |
@nigelmegitt @btsimonh See resulting render at w3c/imsc-tests#107 Note that |
Co-authored-by: Pierre-Anthony Lemieux <pal@sandflow.com>
https://w3c.github.io/csswg-drafts/css-ruby-1/#box-style (similarly on the older TR version) says (last 2 paragraphs):
(NB the "nor the any" grammar errors in both those paragraphs are correctly quoted) It is not clear from this what properties apply to ruby containers, but the fact that they are omitted from the lists suggests that the background properties should apply to ruby containers. Additionally, the section on Line Spacing shows that ruby annotations can overflow the lines, but doesn't say anything about the However, assuming that ruby text generally behaves like inline text that is positioned outside its inline area parent, it looks like the normal expectation is that the padding area of the parent does not extend to encompass the inline children. This is true for both ruby and span, demonstrated by this Codepen. TTML2 on the other hand doesn't say anything about this, that I can find. So my conclusion is that the behaviour introduced in this pull request is by design. Edited to say that the behaviour is by design, not wrong. |
Apologies, previous comment edited: the behaviour is by design and I believe that with this pull request the behaviour is correct. I realised that my test setup was confounding my view of the output by doing some BBC-specific behaviours, namely: 1. Pushing Incidentally, I have verified that setting Rendering of the example from #237 with Rendering of the same example with (renderings from Firefox 106.0.5 on MacOS 11.7.1) |
I agree that the definition and behaviour of ruby in browsers is not well defined. @nigelmegitt - what's going on with overlapping lines between 1 & 2 in the first render? looks like 'filllinegap' is always filling 'up' for all three lines. |
@btsimonh yes, I tried to describe the reason why in the paragraph above that first rendering. Unfortunately, I believe it is correct as per CSS, even if undesirable. It matches the Line Spacing section in the CSS Ruby spec. Authors can do something about this in a couple of possible ways:
|
again, it's not right. The first line has a ruby above, has reserved below, but has doubled the space above? |
Yeah, I'm not sure how the rubyReserve is implemented, I see what you mean @btsimonh - I can't spend more time on this now, but I wonder if we need to return to the fact that ruby text is not (directly) included in I'm not sure if what we're seeing is an artefact of how the edges are discovered when applying |
Closes #237.
Empirically, it appears that browsers (Firefox and Chrome) do not implement layout on the currently deprecated
rb
element in the same way as on other elements. Specifically, they seem not to extend the padding rectangle to include the padded rectangles of childspan
s. Replacing therb
elements withspan
elements works around this.If at some point
rb
is un-deprecated, and this feature/bug of layout is improved, this change should be reverted.