<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>20354</bug_id>
          
          <creation_ts>2012-12-12 07:57:13 +0000</creation_ts>
          <short_desc>[Shadow]: HOST_RULE should be less than 32.</short_desc>
          <delta_ts>2012-12-14 02:17:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>14978</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Takashi Sakamoto">tasak</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>bugs</cc>
    
    <cc>jackalmage</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>79995</commentid>
    <comment_count>0</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-12-12 07:57:13 +0000</bug_when>
    <thetext>From the viewpoint of WebKit implementation, HOST_RULE type number should be &lt; 32.
I mean, for example,

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

Because we can use only 5 bits for type number. In WebKit&apos;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 &lt; 1024=2^10), m_sourceLine&apos;s max is 4,194,303. I guess, 4,194,303 is a little small for real world web.

Best regards,
Takashi Sakamoto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80000</commentid>
    <comment_count>1</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-12-12 09:14:06 +0000</bug_when>
    <thetext>The reasoning is very much implementation detail. We need something
else for API changes.

Also, it shouldn&apos;t be hard to convert the type internally, effectively
if (m_type == 31) return 1001;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80010</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-12-12 15:26:29 +0000</bug_when>
    <thetext>Olli is right and, at least for now, it can&apos;t be less than 31, because it&apos;s not been approved by CSS WG per http://wiki.csswg.org/spec/cssom-constants.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80057</commentid>
    <comment_count>3</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-12-13 04:37:16 +0000</bug_when>
    <thetext>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 &quot;1001&quot; was fixed or not.

Now I knew &quot;1001&quot; is important and fixed. So I will try another way.

Best regards,
Takashi Sakamoto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80058</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-12-13 04:40:27 +0000</bug_when>
    <thetext>No worries. It will likely be 17 once approved by CSS WG.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80059</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-12-13 04:41:12 +0000</bug_when>
    <thetext>Tab, just wanted to remind you about this. Do I send an email to www-style about this? What&apos;s the best course of action here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80060</commentid>
    <comment_count>6</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2012-12-13 05:55:35 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; Tab, just wanted to remind you about this. Do I send an email to www-style
&gt; about this? What&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80159</commentid>
    <comment_count>7</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-12-14 02:17:40 +0000</bug_when>
    <thetext>Thank you.

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

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

Best regards,
Takashi Sakamoto</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>