Closed
Bug 1098272
Opened 10 years ago
Closed 10 years ago
Suppress line breaks inside ruby boxes
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: xidorn, Assigned: xidorn)
References
()
Details
Attachments
(6 files, 1 obsolete file)
9.79 KB,
patch
|
dbaron
:
review+
roc
:
review+
|
Details | Diff | Splinter Review |
3.59 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
4.32 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
3.49 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
2.66 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
8.87 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
The CSS Ruby spec proposed that forced line breaks inside ruby annotations shall be suppressed. I feel that the line breaks should also be suppressed in ruby bases, at least currently, since my current implementation in bug 1052924 cannot properly handle line breaks inside ruby base. We may fix it later.
Assignee | ||
Comment 1•10 years ago
|
||
Assignee: nobody → quanxunzhen
Attachment #8539919 -
Flags: review?(dbaron)
Assignee | ||
Comment 2•10 years ago
|
||
Attachment #8539930 -
Flags: review?(dbaron)
Assignee | ||
Comment 3•10 years ago
|
||
Attachment #8539931 -
Flags: review?(dbaron)
Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8539932 -
Flags: review?(dbaron)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8539933 -
Flags: review?(dbaron)
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8539935 -
Flags: review?(dbaron)
Assignee | ||
Comment 7•10 years ago
|
||
Attachment #8539936 -
Flags: review?(dbaron)
Comment on attachment 8539919 [details] [diff] [review] patch 1 - Suppress line breaks inside ruby Hmmm. The existing IsDirectlyInsideRuby() / NS_STYLE_IS_DIRECTLY_INSIDE_RUBY isn't a great name. "directly" implies that it's the child of the ruby, not any descendant. I'd prefer IsInlineDescendantOfRuby or maybe just IsInsideRuby. Though fixing that should probably happen elsewhere. I'm a little worried about whether this interacts with any of our text run caching. Other than that, I think this looks good, but I'd like roc to have a look, particularly for the caching issue.
Attachment #8539919 -
Flags: review?(roc)
Attachment #8539919 -
Flags: review?(dbaron)
Attachment #8539919 -
Flags: review+
Comment on attachment 8539930 [details] [diff] [review] patch 2 - Assert no line break inside ruby I guess we should find out through fuzzing if this is problematic. In case this is wrong, does the text frame code look like it will safely handle having reported a break status but not having a continuation created? (I'd be more worried about text frames than inline frames.)
Attachment #8539930 -
Flags: review?(dbaron) → review+
Attachment #8539931 -
Flags: review?(dbaron) → review+
Attachment #8539932 -
Flags: review?(dbaron) → review+
Attachment #8539933 -
Flags: review?(dbaron) → review+
Comment on attachment 8539935 [details] [diff] [review] patch 6 - Remove break before check in ruby segment Does this mean we'll change from knowing we need a break in the first pass, to waiting for the second pass? Is that desirable f
Flags: needinfo?(quanxunzhen)
Comment on attachment 8539936 [details] [diff] [review] patch 7 - Check whether line break is allowed inside ruby >+ // Allow line break between ruby bases when white-space allows, >+ // we are not inside a nested ruby, and there is no span. >+ bool allowLineBreak = !inNestedRuby && StyleText()->WhiteSpaceCanWrap(this); >+ bool allowInitialLineBreak = allowLineBreak; >+ if (!GetPrevInFlow()) { >+ allowInitialLineBreak = !inNestedRuby && >+ parent->StyleText()->WhiteSpaceCanWrap(parent); >+ } I think I see the logic here, at least in terms of checking the element's own 'white-space' vs. the parent's 'white-space'. That said, I'm not sure that checking 'white-space' really makes sense here -- 'white-space' should affect what happens when there's actually whitespace. Ruby markup shouldn't introduce new break opportunities where the surroundings and bases weren't already breakable; it should just allow breaking in some (but not all) cases where there would be breaking of the surroundings/bases without the ruby markup. I guess I might be ok with doing this for now, but I don't think this fixes bug 1089431. (I'm actually not even sure it makes progress towards it.) Was there a particular reason you wanted this patch now?
Assignee | ||
Comment 12•10 years ago
|
||
(In reply to David Baron [:dbaron] (UTC-5) (needinfo? for questions) from comment #11) > Comment on attachment 8539936 [details] [diff] [review] > patch 7 - Check whether line break is allowed inside ruby > > >+ // Allow line break between ruby bases when white-space allows, > >+ // we are not inside a nested ruby, and there is no span. > >+ bool allowLineBreak = !inNestedRuby && StyleText()->WhiteSpaceCanWrap(this); > >+ bool allowInitialLineBreak = allowLineBreak; > >+ if (!GetPrevInFlow()) { > >+ allowInitialLineBreak = !inNestedRuby && > >+ parent->StyleText()->WhiteSpaceCanWrap(parent); > >+ } > > I think I see the logic here, at least in terms of checking the element's > own 'white-space' vs. the parent's 'white-space'. > > That said, I'm not sure that checking 'white-space' really makes sense here > -- 'white-space' should affect what happens when there's actually > whitespace. Ruby markup shouldn't introduce new break opportunities where > the surroundings and bases weren't already breakable; it should just allow > breaking in some (but not all) cases where there would be breaking of the > surroundings/bases without the ruby markup. > > > I guess I might be ok with doing this for now, but I don't think this fixes > bug 1089431. (I'm actually not even sure it makes progress towards it.) > > Was there a particular reason you wanted this patch now? The most important reason is that, without checking nested ruby, the nested ruby could break the assertion in patch 2. White-space is checked incidentally. About the surrounding things, I feel it is not trivial to implement, but I don't think we need to care much about that for three reasons: 1. there's no use case that ruby should not be break inside or outside because of surroundings 2. annotations could make ruby base incontinuous, which makes it less sense to respect the surroundings 3. neither trident nor webkit do this Given these reasons, I suggest we at least make bug 1089431 not block enable-css-ruby. Or do you have any advice about fixing that bug?
Assignee | ||
Comment 13•10 years ago
|
||
(In reply to David Baron [:dbaron] (UTC-5) (needinfo? for questions) from comment #10) > Comment on attachment 8539935 [details] [diff] [review] > patch 6 - Remove break before check in ruby segment > > Does this mean we'll change from knowing we need a break in the first pass, > to waiting for the second pass? Is that desirable f I think so. After rethinking about this patch, I do not have a strong reason to do this. I think I did this mostly because it simplifies the logic when I was changing the code. If you don't like this, I can revert it and try another way. It might be even worse that, in the current code, the second pass won't happen until the whole ruby is reflowed, because we only record optional break positions in the first pass. I guess it won't be a big problem, though.
Flags: needinfo?(quanxunzhen)
Comment on attachment 8539936 [details] [diff] [review] patch 7 - Check whether line break is allowed inside ruby OK, but at least remove the comment about fixing bug 1089431.
Attachment #8539936 -
Flags: review?(dbaron) → review+
Is it best to just skip patch 6, then?
Flags: needinfo?(quanxunzhen)
Attachment #8539935 -
Flags: review?(dbaron) → review-
Assignee | ||
Comment 17•10 years ago
|
||
(In reply to David Baron [:dbaron] (UTC-5) (needinfo? for questions) from comment #9) > Comment on attachment 8539930 [details] [diff] [review] > patch 2 - Assert no line break inside ruby > > I guess we should find out through fuzzing if this is problematic. > > In case this is wrong, does the text frame code look like it will safely > handle having reported a break status but not having a continuation created? > (I'd be more worried about text frames than inline frames.) I'm not sure about that. But even if a continuation is created, it will live in the overflow frame list of rb/rt frame, because we won't create continuation for rb/rt. So I guess it would simply make them disappear without causing further problem (like infinite loop before this patch).
Assignee | ||
Updated•10 years ago
|
Attachment #8539935 -
Attachment is obsolete: true
Comment on attachment 8539919 [details] [diff] [review] patch 1 - Suppress line breaks inside ruby Review of attachment 8539919 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/thebes/gfxTextRun.h @@ +307,5 @@ > gfxFloat *aAdvanceWidthDelta, > gfxContext *aRefContext); > > + enum SuppressBreak { > + eSuppressNoBreak, Call this eNoSuppressBreak
Attachment #8539919 -
Flags: review?(roc) → review+
Assignee | ||
Comment 19•10 years ago
|
||
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d467ccdeac85
Assignee | ||
Comment 20•10 years ago
|
||
inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/6a73f9db3885 https://hg.mozilla.org/integration/mozilla-inbound/rev/65952ac62ec9 https://hg.mozilla.org/integration/mozilla-inbound/rev/454264086d2d https://hg.mozilla.org/integration/mozilla-inbound/rev/abcc7ed1585b https://hg.mozilla.org/integration/mozilla-inbound/rev/b00b61276007 https://hg.mozilla.org/integration/mozilla-inbound/rev/aca891c01c88
Comment 21•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6a73f9db3885 https://hg.mozilla.org/mozilla-central/rev/65952ac62ec9 https://hg.mozilla.org/mozilla-central/rev/454264086d2d https://hg.mozilla.org/mozilla-central/rev/abcc7ed1585b https://hg.mozilla.org/mozilla-central/rev/b00b61276007 https://hg.mozilla.org/mozilla-central/rev/aca891c01c88
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in
before you can comment on or make changes to this bug.
Description
•