Closed
Bug 567663
Opened 15 years ago
Closed 14 years ago
Implement the hidden attribute
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla2.0b3
People
(Reporter: Ms2ger, Assigned: Ms2ger)
References
(Depends on 1 open bug, )
Details
(Keywords: dev-doc-complete, html5, Whiteboard: [parity-webkit])
Attachments
(1 file, 6 obsolete files)
15.86 KB,
patch
|
sicking
:
approval2.0+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•15 years ago
|
||
Attachment #446977 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•15 years ago
|
Attachment #446977 -
Flags: review?(bzbarsky) → review?(Olli.Pettay)
Assignee | ||
Updated•15 years ago
|
Whiteboard: [parity-webkit]
Assignee | ||
Comment 2•15 years ago
|
||
Attachment #446977 -
Attachment is obsolete: true
Attachment #450840 -
Flags: review?(Olli.Pettay)
Attachment #446977 -
Flags: review?(Olli.Pettay)
Assignee | ||
Comment 3•15 years ago
|
||
Attachment #450840 -
Attachment is obsolete: true
Attachment #451887 -
Flags: review?(Olli.Pettay)
Attachment #450840 -
Flags: review?(Olli.Pettay)
Updated•15 years ago
|
Attachment #451887 -
Flags: review?(Olli.Pettay) → review+
Comment 4•15 years ago
|
||
I recall #webkit scrollback to the effect that their implementation wasn't as simple as the rule addition made here, for reasons of perf considerations of checking for an attribute on every element during style resolution. (I think that's the term I want, somebody tell me if I'm mistaken.) Do we not have to worry about this method of implementation having performance impact?
Comment 5•15 years ago
|
||
Uh, right. Need to check how this affects to performance.
Updated•15 years ago
|
Attachment #451887 -
Flags: review+
Comment 6•15 years ago
|
||
> Do we not have to worry about this method of implementation having performance
> impact?
We do, in general. Not sure how much it would show up in practice so far, but as we optimize more and more it could become noticeable....
It's worth looking at how the webkit folks implemented theirs.
What do we do when we check for matches to the :lang() pseudo-class, for example?
Comment 8•15 years ago
|
||
I'm not sure I follow the question in comment 7....
Also note that we already have [dir] rules in html.css. :( This would be no worse....
Since the :lang pseudo-class requires a check of the "lang" attribute on every element, I wondered how we handled that, since it might help us in this bug.
Comment 10•15 years ago
|
||
We check the lang attribute. The :lang pseudo-class is rarely used. This patch, however, would have the [hidden] check for all HTML elements.
Comment 11•15 years ago
|
||
And again, it may be that the concern is not important. Can we get some numbers here (using a stylesheet with such a rule in it, say)? What did webkit end up doing?
Comment 12•15 years ago
|
||
Comment 13•15 years ago
|
||
Thanks. We could do that sort of thing, though our mapped attr code is more similar to our style resolution code (involves attr gets during resolution time). But it would only happen for elements with mapped attributes...
If we want to do that, you'd want to add it to nsGenericHTMLElement::sCommonAttributeMap and change nsGenericHTMLElement::MapCommonAttributesInto.
It's worth getting numbers on the performance impact before resorting to the complicated way, seems like.
Using the attribute mapping code isn't all that complicated, and I think it's also more consistent with other code. And I suspect there would be a big perf impact from changing everything from the attribute mapping code to being written in CSS.
There's also the question of whether this belongs at the preshint or UA level of the cascade.
Comment 15•15 years ago
|
||
That had crossed my mind, but I think putting it in preshint for the time being is fine.
Comment on attachment 451887 [details] [diff] [review]
Patch v1.2, merged to tip
dbaron says that it would be more performant to implement this using nsGenericHTMLElement::MapCommonAttributesInto/nsGenericHTMLElement::sCommonAttributeMap.
Check it to that and ask me for review. Would be great to have this in Firefox 4.
Attachment #451887 -
Flags: review-
... that's instead of the html.css changes.
Assignee | ||
Comment 18•15 years ago
|
||
This doesn't work. I can't find any documentation that explains what I should do instead. David, perhaps you could tell me?
Attachment #458096 -
Flags: feedback?(dbaron)
You don't want mDisplay.SetNoneValue(); instead you want mDisplay.SetIntValue(NS_STYLE_DISPLAY_NONE, eCSSUnit_Enumerated).
Comment on attachment 458096 [details] [diff] [review]
Mapped attribute WIP
(and otherwise this looks fine, assuming that makes it work... except for the fact that the html.css change doesn't need to be added in the other patch and removed in this one)
Attachment #458096 -
Flags: feedback?(dbaron) → feedback+
Assignee | ||
Comment 21•15 years ago
|
||
Thanks, that did make it work.
Attachment #451887 -
Attachment is obsolete: true
Attachment #458096 -
Attachment is obsolete: true
Attachment #458169 -
Flags: review?(jonas)
Comment 22•15 years ago
|
||
Doesn't that patch also need to check that the display is not already set? Seems like this:
<style>
div { display: block !important; }
</style>
<div hidden>This text should show up</div>
would not work with the patch as written...
Er, right, it does. I forgot about that because I was looking at the lang case above, which is the exception. It should probably look like:
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
nsRuleDataDisplay *disp = aData->mDisplayData;
if (disp->mDisplay.GetUnit() == eCSSUnit_Null) {
if (aAttributes->IndexOfAttr(nsGkAtoms::hidden, kNameSpaceID_None) >= 0) {
disp->mDisplay.SetIntValue(NS_STYLE_DISPLAY_NONE, eCSSUnit_Enumerated);
}
}
}
Assignee | ||
Updated•15 years ago
|
Attachment #458169 -
Flags: review?(jonas)
Assignee | ||
Comment 24•15 years ago
|
||
Thanks, it looks like that works.
Attachment #458169 -
Attachment is obsolete: true
Attachment #458397 -
Flags: review?(jonas)
Comment 25•15 years ago
|
||
Presumably comment 22 should be added as a reftest too...
Comment on attachment 458397 [details] [diff] [review]
Patch v2.1
r=me if you also add the testcase in comment 22 as a reftest.
Attachment #458397 -
Flags: review?(jonas) → review+
Assignee | ||
Updated•15 years ago
|
Keywords: checkin-needed,
dev-doc-needed
Comment 28•15 years ago
|
||
You need to request approval2.0 on your patch before it can land.
Keywords: checkin-needed
Assignee | ||
Updated•14 years ago
|
Attachment #458608 -
Flags: approval2.0?
Attachment #458608 -
Flags: approval2.0? → approval2.0+
Assignee | ||
Updated•14 years ago
|
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Comment 30•14 years ago
|
||
I've updated the documentation:
https://developer.mozilla.org/en/HTML/Global_attributes#attr-hidden
and
https://developer.mozilla.org/en/Firefox_4_for_developers
Assignee | ||
Comment 31•14 years ago
|
||
Thanks! You rock!
Keywords: dev-doc-needed → dev-doc-complete
Target Milestone: --- → mozilla2.0b3
Depends on: 585101
Comment 32•14 years ago
|
||
Running Firefox 4 RC, the hidden attribute hides elements on a page with XHTML transitional doctype (i.e not HTML5)? Is this correct?
Assignee | ||
Comment 33•14 years ago
|
||
(In reply to comment #32)
> Running Firefox 4 RC, the hidden attribute hides elements on a page with XHTML
> transitional doctype (i.e not HTML5)? Is this correct?
Yes. We're not IE, we implement everything in all modes, unless there's a good reason not to. This is what the HTML specification requires. If you want to use non-standard attributes, please use the data-* attributes; in that case you're sure we'll never do something with them.
Comment 34•14 years ago
|
||
(In reply to comment #33)
> Yes. We're not IE, we implement everything in all modes, unless there's a good
> reason not to. This is what the HTML specification requires.
I didn't realise that changes like this impacted on previous html versions. I realised after making my post that if I don't fix this now I'd have to do it if we changed to HTML5 anyway, so have addressed the issue.
Thanks for the prompt reply.
Comment 35•14 years ago
|
||
> I didn't realise that changes like this impacted on previous html versions.
The point is we only implement one version of HTML. We ignore the doctype completely, except for deciding on standards or quirks mode...
You need to log in
before you can comment on or make changes to this bug.
Description
•