Closed
Bug 1052123
Opened 11 years ago
Closed 11 years ago
Autohide ruby annotations which are identical to their ruby bases
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: sgbowen8, Assigned: xidorn)
References
(Blocks 2 open bugs, )
Details
Attachments
(2 files, 4 obsolete files)
When ruby annotation content is identical to the content of its matching ruby base, the spec requires that the annotation content be hidden (see the URL).
Blocks: enable-css-ruby
There was a patch for this attached to bug 1030993. I'm attaching that version here for history purposes, but it needs to be rebased or even completely rewritten at this point.
(Per Xidorn, no other browsers support autohiding, so moving off the ruby list that blocks enabling the feature onto the other list.)
| Assignee | ||
Comment 3•11 years ago
|
||
Assignee: nobody → quanxunzhen
Attachment #8471092 -
Attachment is obsolete: true
| Assignee | ||
Comment 4•11 years ago
|
||
Attachment #8526372 -
Attachment is obsolete: true
Attachment #8529694 -
Flags: review?(dbaron)
| Assignee | ||
Updated•11 years ago
|
Attachment #8529694 -
Flags: review?(dbaron) → review?(dholbert)
Are you relying on making the overflow area empty causing us to not paint anything? That doesn't seem reliable -- would it be better to also make its BuildDisplayList method return early?
How closely does what nsContentUtils::GetNodeTextContent do match the definition of equality used in the spec?
| Assignee | ||
Comment 6•11 years ago
|
||
The spec says:
The content comparison for this auto-hiding behavior takes place prior to white space collapsing (white-space) and text transformation (text-transform) and ignores elements (considers only the textContent of the boxes).
Hence nsContentUtils::GetNodeTextContent exactly matches the spec, as we use this function for element.textContent.
| Assignee | ||
Comment 7•11 years ago
|
||
Attachment #8529694 -
Attachment is obsolete: true
Attachment #8529694 -
Flags: review?(dholbert)
Attachment #8529967 -
Flags: review?(dbaron)
Comment on attachment 8529967 [details] [diff] [review]
patch
nsRubyBaseContainerFrame.cpp:
>+ static_cast<nsRubyTextFrame*>(textFrame)->
>+ SetAutoHide(annotationText.Equals(baseText));
Please comment that the spec explicitly says that:
The content comparison for this auto-hiding behavior takes place prior
to white space collapsing (white-space) and text transformation
(text-transform) and ignores elements (considers only the textContent
of the boxes).
which means that using the content tree text comparison is correct.
nsRubyTextFrame.h:
>+ virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
>+ const nsRect& aDirtyRect,
>+ const nsDisplayListSet& aLists);
Please use MOZ_OVERRIDE.
>+ bool mAutoHide;
Instead of using an additional boolean member, please use a frame
state bit. (I realize I probably should have had you do this for a
few other things as well.) See nsFrameStateBits.h, and make sure
to add the bits after the inline bits.
(In this case it's not all that important given that there aren't going
to be a really large number of ruby text frames, but I think it's good
practice.)
nsRubyTextFrame.cpp:
>+ // Even if we want to hide this frame, we have to reflow it first.
>+ // If we leave it dirty, changes to its content will never be
>+ // propagated to the ancestors, then it won't be displayed even if
>+ // the content is no longer the same, until next reflow triggered by
>+ // some other change.
I think you should also comment that in general we always reflow
all the frames we create; there might be other problems that would
result.
>+ if (mAutoHide) {
>+ aDesiredSize.ClearSize();
>+ }
You should also (after the ClearSize()) call
aDesiredSize.SetOverflowAreasToDesiredBounds().
You should also comment that the intent (per spec) is to not affect
layout at all.
This might mean you also need to consider mAutoHide when you
do the line height calculations (so probably worth leaving a note
in that bug).
r=dbaron with those changes, although perhaps I should have a
look at the changes to use a frame state bit
Attachment #8529967 -
Flags: review?(dbaron) → review+
| Assignee | ||
Comment 9•11 years ago
|
||
I guess you should have a look at the state bit. I'm not quite confident about it.
Attachment #8529967 -
Attachment is obsolete: true
Attachment #8532074 -
Flags: feedback?(dbaron)
| Assignee | ||
Comment 10•11 years ago
|
||
It seems hard to remove all impacts of the frames once we reflow them. Would it work if we clear their dirty flag recursively without reflowing them?
Flags: needinfo?(dbaron)
| Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(dbaron)
Comment on attachment 8532074 [details] [diff] [review]
patch, r=dbaron
Please add a comment in nsFrameStateBits.h saying that nsRubyTextFrame
inherits from nsInlineFrame (actually, probably 2 comments, one at the end of the nsInlineFrame section, and another at the start of the nsRubyTextFrame section).
>+ // and text transformation (text-transform) and, ignore elements
" and, ignore" -> ", and ignores" (move comma, add s to ignore)
r=dbaron with that
Attachment #8532074 -
Flags: review+
Attachment #8532074 -
Flags: feedback?(dbaron)
Attachment #8532074 -
Flags: feedback+
| Assignee | ||
Comment 12•11 years ago
|
||
| Assignee | ||
Comment 13•11 years ago
|
||
Backed out for linux and android reftest failures: https://hg.mozilla.org/integration/mozilla-inbound/rev/cdefc124ccaa
https://treeherder.mozilla.org/ui/logviewer.html#?job_id=4701762&repo=mozilla-inbound
Flags: needinfo?(quanxunzhen)
| Assignee | ||
Comment 15•11 years ago
|
||
Flags: needinfo?(quanxunzhen)
Comment 16•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Comment 17•9 years ago
|
||
This bug doesn't seem to be fixed. (I've attached a test case.)
You have to explicitly declare |display: ruby-base| or use the disallowed |rb| element to get auto-hiding behavior and then it breaks again if you insert characters using the |::before| and |::after| pseudo-elements even though the CSS1 Ruby spec only requires a |textContent| match to trigger it.
| Assignee | ||
Comment 18•9 years ago
|
||
It is HTML spec's fault for not having <rb> element. CSS Ruby encourages using <rb> with <rt>. You should read https://www.w3.org/International/articles/ruby/markup.en.html
You need to log in
before you can comment on or make changes to this bug.
Description
•