This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20354 - [Shadow]: HOST_RULE should be less than 32.
Summary: [Shadow]: HOST_RULE should be less than 32.
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14978
  Show dependency treegraph
 
Reported: 2012-12-12 07:57 UTC by Takashi Sakamoto
Modified: 2012-12-14 02:17 UTC (History)
2 users (show)

See Also:


Attachments

Description Takashi Sakamoto 2012-12-12 07:57:13 UTC
From the viewpoint of WebKit implementation, HOST_RULE type number should be < 32.
I mean, for example,

"partial interface CSSRule {
-    const unsigned short HOST_RULE = 1001;
+    const unsigned short HOST_RULE = 31;
};"

Because we can use only 5 bits for type number. In WebKit's StyleRuleBase class:
 
class StyleRuleBase : public WTF::RefCountedBase {
...
    unsigned m_type : 5;
    signed m_sourceLine : 27;
}

I think, it would be not acceptable to make StyleRuleBase larger. Probably we have to keep 32 bits (=5+27).
If we change m_sourceLine from 27 bits to 22 bits (1001 < 1024=2^10), m_sourceLine's max is 4,194,303. I guess, 4,194,303 is a little small for real world web.

Best regards,
Takashi Sakamoto
Comment 1 Olli Pettay 2012-12-12 09:14:06 UTC
The reasoning is very much implementation detail. We need something
else for API changes.

Also, it shouldn't be hard to convert the type internally, effectively
if (m_type == 31) return 1001;
Comment 2 Dimitri Glazkov 2012-12-12 15:26:29 UTC
Olli is right and, at least for now, it can't be less than 31, because it's not been approved by CSS WG per http://wiki.csswg.org/spec/cssom-constants.
Comment 3 Takashi Sakamoto 2012-12-13 04:37:16 UTC
Thank you, Olli and Dimitri.

Yeah, I was thinking of the following way:
if (m_type == 31) return 1001;

However I was advised to firstly confirm whether the "1001" was fixed or not.

Now I knew "1001" is important and fixed. So I will try another way.

Best regards,
Takashi Sakamoto
Comment 4 Dimitri Glazkov 2012-12-13 04:40:27 UTC
No worries. It will likely be 17 once approved by CSS WG.
Comment 5 Dimitri Glazkov 2012-12-13 04:41:12 UTC
Tab, just wanted to remind you about this. Do I send an email to www-style about this? What's the best course of action here?
Comment 6 Tab Atkins Jr. 2012-12-13 05:55:35 UTC
(In reply to comment #5)
> Tab, just wanted to remind you about this. Do I send an email to www-style
> about this? What's the best course of action here?

I need to take the time out to write the scoped style spec properly, which will introduce @host.
Comment 7 Takashi Sakamoto 2012-12-14 02:17:40 UTC
Thank you.

I updated WebKit bug about CSSHostRule, https://bugs.webkit.org/show_bug.cgi?id=102344 and added "class StyleRareRuleBlock", which can have 65535 types.

If it is difficult to change CSSHostRule's type, I will try the StyleRareRuleBlock.

Best regards,
Takashi Sakamoto