Closed Bug 604505 Opened 14 years ago Closed 6 years ago

inheriting 'content' from an element should always inherit none/normal since the computed value on elements is always 'normal'

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: dbaron, Unassigned)

References

(Blocks 1 open bug, )

Details

(Keywords: css2)

Attachments

(1 file)

Inheriting 'content' from an element should always inherit none/normal since the computed value on elements is always 'normal'.

http://test.csswg.org/suites/css2.1/20101001/html4/content-160.htm
http://test.csswg.org/suites/css2.1/20101001/xhtml1/content-160.xht
Hmm.  Was this a spec change at some point?

But yeah, we should fix.  And fix the tests we have that will fail as a result... and maybe the ones that will stop testing what they're supposed to be testing as a result.  :(
Attached patch patchSplinter Review
Attachment #8525062 - Flags: review?(dbaron)
try: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=9c949b922918

It seems that we have a lot of tests to fix for this bug. In addition, the test for bug 569006 uses this wrong behavior. I'm not sure whether we should get rid of that test or do something different.
Comment on attachment 8525062 [details] [diff] [review]
patch

>diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
>--- a/layout/style/nsRuleNode.cpp
>+++ b/layout/style/nsRuleNode.cpp
>@@ -7977,18 +7977,22 @@ nsRuleNode::ComputeContentData(void* aSt
>                                const bool aCanStoreInRuleTree)
> {
>   uint32_t count;
>   nsAutoString buffer;
> 
>   COMPUTE_START_RESET(Content, (), content, parentContent)
> 
>   // content: [string, url, counter, attr, enum]+, normal, none, inherit
>-  const nsCSSValue* contentValue = aRuleData->ValueForContent();
>-  switch (contentValue->GetUnit()) {
>+  nsCSSValue contentValue(*aRuleData->ValueForContent());
>+  if (!aContext->GetPseudo()) {
>+    // On elements, content is always computed to normal.
>+    contentValue.SetNormalValue();
>+  }
>+  switch (contentValue.GetUnit()) {


This isn't safe, since an element and a pseudo-element might match the same list of rules and thus share the same rule node.

It's also bad because it breaks all partial computation from a start struct (i.e., when ComputeContentData has a non-null aStartStruct, aRuleData only contains the declarations that should override what is already in aStartStruct, and here you're overriding eCSSUnit_Null (which says there's nothing specified and thus you shouldn't override what's already there).

Both of these could cause test failures.

I need to think a little more about the best way around the first problem, though.  (Fixing the second is easy.)
Attachment #8525062 - Flags: review?(dbaron) → review-
Flags: needinfo?(dbaron)
I think this should be WONTFIX (or INVALID), given that bug 215083 needs us to have a computed value other than normal on an element.  Does that sounds right Xidorn?
Flags: needinfo?(xidorn+moz)
Yeah, INVALID I guess. The spec is still very unclear about many cases, but given that values no longer need to be computed to normal for elements, the description of this bug no longer applies.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(xidorn+moz)
Flags: needinfo?(dbaron)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: