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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>33269</bug_id>
          
          <creation_ts>2010-01-06 13:53:35 -0800</creation_ts>
          <short_desc>Improve HTMLElement::tagPriority()</short_desc>
          <delta_ts>2010-01-07 20:24:50 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</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>P3</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kent Tamura">tkent</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
    
    <cc>mjs</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>177744</commentid>
    <comment_count>0</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-01-06 13:53:35 -0800</bug_when>
    <thetext>HTMLElement::tagPriority() compares AtomicStringImpl pointers 18 times for a generic element such as &lt;span&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177749</commentid>
    <comment_count>1</comment_count>
      <attachid>45992</attachid>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-01-06 13:58:15 -0800</bug_when>
    <thetext>Created attachment 45992
Proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177752</commentid>
    <comment_count>2</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2010-01-06 13:58:55 -0800</bug_when>
    <thetext>style-queue ran check-webkit-style on attachment 45992 without any errors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177758</commentid>
    <comment_count>3</comment_count>
      <attachid>45992</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-01-06 14:08:12 -0800</bug_when>
    <thetext>Comment on attachment 45992
Proposed patch

&gt; +struct Empty1IntHashTraits : HashTraits&lt;int&gt; {

This seems a slightly heavyweight wait of making this use a map. I wonder if there&apos;s some other clever approach that avoids custom hash traits.

One thing we could do is this:

    1) Increase all tag priorities by 1 in all the code.
    2) Use find and return a tag priority of 2 if we don&apos;t find anything, instead of using get.

I guess your way is probably better.

&gt; +    static const bool emptyValueIsZero = false;
&gt; +    static const bool needsDestruction = false;
&gt; +    static int emptyValue() { return 1; }
&gt; +    static void constructDeletedValue(int&amp; slot) { slot = -1; }
&gt; +    static bool isDeletedValue(int value) { return value == -1; }

There&apos;s no need for you to override needsDestruction, constructDeletedValue, or isDeletedValue. You can just use the inherited versions of those from the base class.

&gt; +    DEFINE_STATIC_LOCAL(TagPriorityMap, tagPriorityMap, ());
&gt; +    if (tagPriorityMap.isEmpty()) {
&gt; +        tagPriorityMap.add(wbrTag.localName().impl(), 0);
&gt; +
&gt; +        tagPriorityMap.add(addressTag.localName().impl(), 3);
&gt; +        tagPriorityMap.add(ddTag.localName().impl(), 3);
&gt; +        tagPriorityMap.add(dtTag.localName().impl(), 3);
&gt; +        tagPriorityMap.add(noscriptTag.localName().impl(), 3);
&gt; +        tagPriorityMap.add(rpTag.localName().impl(), 3);
&gt; +        tagPriorityMap.add(rtTag.localName().impl(), 3);
&gt; +
&gt; +        // 5 is same as &lt;div&gt;&apos;s priority.
&gt; +        tagPriorityMap.add(articleTag.localName().impl(), 5);
&gt; +        tagPriorityMap.add(asideTag.localName().impl(), 5);
&gt; +        tagPriorityMap.add(centerTag.localName().impl(), 5);
&gt; +        tagPriorityMap.add(footerTag.localName().impl(), 5);
&gt; +        tagPriorityMap.add(headerTag.localName().impl(), 5);
&gt; +        tagPriorityMap.add(nobrTag.localName().impl(), 5);
&gt; +        tagPriorityMap.add(rubyTag.localName().impl(), 5);
&gt; +        tagPriorityMap.add(navTag.localName().impl(), 5);
&gt; +        tagPriorityMap.add(sectionTag.localName().impl(), 5);
&gt; +
&gt; +        tagPriorityMap.add(noembedTag.localName().impl(), 10);
&gt; +        tagPriorityMap.add(noframesTag.localName().impl(), 10);
&gt; +
&gt; +        // Return 1 for other tags. It&apos;s same as &lt;span&gt;.
&gt; +        // This way custom tag name elements will behave like inline spans.
&gt; +    }
&gt;  
&gt; -    // Same values as &lt;span&gt;.  This way custom tag name elements will behave like inline spans.
&gt; -    return 1;
&gt; +    return tagPriorityMap.get(localName().impl());
&gt;  }

I think it would be best to put the code to initialize the map into a separate function, initializeTagPriorityMap, that takes the map as an argument. That will make the tagPriorityMap function easier to read and even ever so slightly more efficient since it will be smaller with better code locality.

Is there a guarantee that localName().impl() is never 0?

review- so you can at least take out the unneeded overrides</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177801</commentid>
    <comment_count>4</comment_count>
      <attachid>45999</attachid>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-01-06 15:02:36 -0800</bug_when>
    <thetext>Created attachment 45999
Proposed patch (rev.2)

(In reply to comment #3)
&gt; (From update of attachment 45992 [details])
&gt; &gt; +    static const bool emptyValueIsZero = false;
&gt; &gt; +    static const bool needsDestruction = false;
&gt; &gt; +    static int emptyValue() { return 1; }
&gt; &gt; +    static void constructDeletedValue(int&amp; slot) { slot = -1; }
&gt; &gt; +    static bool isDeletedValue(int value) { return value == -1; }
&gt; 
&gt; There&apos;s no need for you to override needsDestruction, constructDeletedValue, or
&gt; isDeletedValue. You can just use the inherited versions of those from the base
&gt; class.

ok, I removed them.

&gt; I think it would be best to put the code to initialize the map into a separate
&gt; function, initializeTagPriorityMap, that takes the map as an argument. That
&gt; will make the tagPriorityMap function easier to read and even ever so slightly
&gt; more efficient since it will be smaller with better code locality.

Done.

&gt; Is there a guarantee that localName().impl() is never 0?

I think so for the current code though there is no ASSERTION for it.
However, 0 makes no problems because the HashMap key is AtomicStringImpl*. The generic PtrHash is used and tagPriorityMap.get(0) simply returns emptyValue().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177803</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2010-01-06 15:03:41 -0800</bug_when>
    <thetext>style-queue ran check-webkit-style on attachment 45999 without any errors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177844</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-01-06 16:15:28 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; Is there a guarantee that localName().impl() is never 0?
&gt; 
&gt; I think so for the current code though there is no ASSERTION for it.
&gt; However, 0 makes no problems because the HashMap key is AtomicStringImpl*. The
&gt; generic PtrHash is used and tagPriorityMap.get(0) simply returns emptyValue().

That&apos;s not true.

If you call tagPriorityMap.get(0) there’s a chance that you could get an uninitialized value from an empty hash table entry. There is no special check for the empty value and if the value you pass hashes to a slot that has a 0 in it, then it will return the value in that slot.

It is *not* safe to call get(0).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177850</commentid>
    <comment_count>7</comment_count>
      <attachid>45999</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-01-06 16:26:36 -0800</bug_when>
    <thetext>Comment on attachment 45999
Proposed patch (rev.2)

&gt; +// TagPriorityMap returns 1 for unregistered tags. It&apos;s same as &lt;span&gt;.
&gt; +// This way custom tag name elements will behave like inline spans.

I think this comment should be at the bottom of initializeTagPriorityMap.

&gt; +static const TagPriorityMap* initializeTagPriorityMap()

Given that this actually creates the map too, I suggest naming it createTagPriorityMap.

r=me assuming that localName().impl() is *not* ever 0

If it can be zero, then this patch is not OK.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177911</commentid>
    <comment_count>8</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-01-06 18:30:42 -0800</bug_when>
    <thetext>I have confirmed that impl() never be null, and this is off-topic. But I&apos;d like to understand this.

(In reply to comment #6)
&gt; &gt; However, 0 makes no problems because the HashMap key is AtomicStringImpl*. The
&gt; &gt; generic PtrHash is used and tagPriorityMap.get(0) simply returns emptyValue().
&gt; 
&gt; That&apos;s not true.
&gt; 
&gt; If you call tagPriorityMap.get(0) there’s a chance that you could get an
&gt; uninitialized value from an empty hash table entry. There is no special check
&gt; for the empty value and if the value you pass hashes to a slot that has a 0 in
&gt; it, then it will return the value in that slot.
&gt; 
&gt; It is *not* safe to call get(0).

I read the code of HashTable.h and HashMap.h, and still wonder why it is not safe.
You are talking about a case of empty HashTable, and it&apos;s safe for non-empty HashTable, right?
In the empty case, HashTable::m_table is 0 and HashTable::lookup() seems to return (Value*)0 correctly for any keys. HashMap::get() returns emptyValue() for (Value*)0.
I couldn&apos;t find a case that HashMap::get() returns uninitialized value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177913</commentid>
    <comment_count>9</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-01-06 18:35:14 -0800</bug_when>
    <thetext>(In reply to comment #7)
&gt; (From update of attachment 45999 [details])
&gt; &gt; +// TagPriorityMap returns 1 for unregistered tags. It&apos;s same as &lt;span&gt;.
&gt; &gt; +// This way custom tag name elements will behave like inline spans.
&gt; 
&gt; I think this comment should be at the bottom of initializeTagPriorityMap.

Moved it.

&gt; 
&gt; &gt; +static const TagPriorityMap* initializeTagPriorityMap()
&gt; 
&gt; Given that this actually creates the map too, I suggest naming it
&gt; createTagPriorityMap.

Renamed it.

&gt; r=me assuming that localName().impl() is *not* ever 0
&gt; 
&gt; If it can be zero, then this patch is not OK.

I read the HTMLParser, HTMLTokenizer, HTMLDocument, Document classes carefully and confirmed localName() never be null.  I also confirmed all LayoutTests passed with ASSERT(localName().impl()).
I&apos;ll add this assertion and will commit it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>177956</commentid>
    <comment_count>10</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-01-06 20:47:49 -0800</bug_when>
    <thetext>Landed as r52899 &lt;http://trac.webkit.org/changeset/52899&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>178230</commentid>
    <comment_count>11</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-01-07 09:39:10 -0800</bug_when>
    <thetext>(In reply to comment #8)
&gt; I read the code of HashTable.h and HashMap.h, and still wonder why it is not
&gt; safe.
&gt; You are talking about a case of empty HashTable, and it&apos;s safe for non-empty
&gt; HashTable, right?

I am talking about a non-empty map.

HashTable::lookup will hash the empty key and get a hash value of 0, then the loop will look at the 0&apos;th bucket in the hash table and if it is an empty bucket, will return a pointer to it. I believe the empty bucket is guaranteed to have a key of zero, but could easily have a value that&apos;s non-zero.

That&apos;s how I understand the code. There may be something wrong with my analysis.

In general, I have long believed that both the empty and deleted values are illegal as arguments to the HashTable::lookup function. I believe we need assertions to catch cases like that to make correct programming with this class template easier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>178500</commentid>
    <comment_count>12</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-01-07 20:24:50 -0800</bug_when>
    <thetext>(In reply to comment #11)

I catch you.

HashTraits&lt;P*&gt; has emptyValueisZero=true, and HashTable::checkKey() called by HashTable::lookup() has
  ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key));

It&apos;s enough for the reason of the wrong HashMap::get(0).

Thank you!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>45992</attachid>
            <date>2010-01-06 13:58:15 -0800</date>
            <delta_ts>2010-01-06 15:02:36 -0800</delta_ts>
            <desc>Proposed patch</desc>
            <filename>0001-element-hash-1.patch</filename>
            <type>text/plain</type>
            <size>4241</size>
            <attacher name="Kent Tamura">tkent</attacher>
            
              <data encoding="base64">RnJvbSA0YjI4ZWFlNjk0ZTEwNWU1MDYyYmZkYzcxMTY0ZTI2OGUxNGJmM2VhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBLZW50IFRhbXVyYSA8dGtlbnRAY2hyb21pdW0ub3JnPgpEYXRl
OiBUaHUsIDcgSmFuIDIwMTAgMDY6NDk6NTYgKzA5MDAKU3ViamVjdDogW1BBVENIXSBlbGVtZW50
LWhhc2gtMQoKLS0tCiBXZWJDb3JlL0NoYW5nZUxvZyAgICAgICAgICAgIHwgICAxNiArKysrKysr
KysrKysrKwogV2ViQ29yZS9odG1sL0hUTUxFbGVtZW50LmNwcCB8ICAgNDggKysrKysrKysrKysr
KysrKysrKysrKysrKysrKysrKysrLS0tLS0tLS0KIDIgZmlsZXMgY2hhbmdlZCwgNTQgaW5zZXJ0
aW9ucygrKSwgMTAgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0IGEvV2ViQ29yZS9DaGFuZ2VMb2cg
Yi9XZWJDb3JlL0NoYW5nZUxvZwppbmRleCAyNTViZDU4Li44MWY5MGJkIDEwMDY0NAotLS0gYS9X
ZWJDb3JlL0NoYW5nZUxvZworKysgYi9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE5IEBA
CisyMDEwLTAxLTA2ICBLZW50IFRhbXVyYSAgPHRrZW50QGNocm9taXVtLm9yZz4KKworICAgICAg
ICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBVc2UgYSBzdGF0aWMgSGFz
aE1hcCBmb3IgSFRNTEVsZW1lbnQ6OnRhZ1ByaW9yaXR5KCkuCisgICAgICAgIGh0dHBzOi8vYnVn
cy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0zMzI2OQorCisgICAgICAgIFRoZSBwcmlvciBj
b2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Gxpa2UgaW5saW5lIHNwYW5zLgorICAgIH0KIAotICAgIC8vIFNhbWUgdmFsdWVzIGFzIDxzcGFu
Pi4gIFRoaXMgd2F5IGN1c3RvbSB0YWcgbmFtZSBlbGVtZW50cyB3aWxsIGJlaGF2ZSBsaWtlIGlu
bGluZSBzcGFucy4KLSAgICByZXR1cm4gMTsKKyAgICByZXR1cm4gdGFnUHJpb3JpdHlNYXAuZ2V0
KGxvY2FsTmFtZSgpLmltcGwoKSk7CiB9CiAKIGJvb2wgSFRNTEVsZW1lbnQ6Om1hcFRvRW50cnko
Y29uc3QgUXVhbGlmaWVkTmFtZSYgYXR0ck5hbWUsIE1hcHBlZEF0dHJpYnV0ZUVudHJ5JiByZXN1
bHQpIGNvbnN0Ci0tIAoxLjYuMy4zCgo=
</data>
<flag name="review"
          id="28179"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>45999</attachid>
            <date>2010-01-06 15:02:36 -0800</date>
            <delta_ts>2010-01-06 16:26:36 -0800</delta_ts>
            <desc>Proposed patch (rev.2)</desc>
            <filename>0001-element-hash-2.patch</filename>
            <type>text/plain</type>
            <size>4074</size>
            <attacher name="Kent Tamura">tkent</attacher>
            
              <data encoding="base64">RnJvbSA5Njc2MTYzOGMzMWM1NGNmY2JjNjE3NWFhOTYyOWU0Njg1N2MxNzdhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBLZW50IFRhbXVyYSA8dGtlbnRAY2hyb21pdW0ub3JnPgpEYXRl
OiBUaHUsIDcgSmFuIDIwMTAgMDY6NDk6NTYgKzA5MDAKU3ViamVjdDogW1BBVENIXSBlbGVtZW50
LWhhc2gtMgoKLS0tCiBXZWJDb3JlL0NoYW5nZUxvZyAgICAgICAgICAgIHwgICAxNyArKysrKysr
KysrKysrKwogV2ViQ29yZS9odG1sL0hUTUxFbGVtZW50LmNwcCB8ICAgNTEgKysrKysrK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YWxOYW1lKCkuaW1wbCgpLCA1KTsKKyAgICBtYXAtPmFkZChzZWN0aW9uVGFnLmxvY2FsTmFtZSgp
LmltcGwoKSwgNSk7CisKKyAgICBtYXAtPmFkZChub2VtYmVkVGFnLmxvY2FsTmFtZSgpLmltcGwo
KSwgMTApOworICAgIG1hcC0+YWRkKG5vZnJhbWVzVGFnLmxvY2FsTmFtZSgpLmltcGwoKSwgMTAp
OworCisgICAgcmV0dXJuIG1hcDsKK30KIAotICAgIC8vIFNhbWUgdmFsdWVzIGFzIDxzcGFuPi4g
IFRoaXMgd2F5IGN1c3RvbSB0YWcgbmFtZSBlbGVtZW50cyB3aWxsIGJlaGF2ZSBsaWtlIGlubGlu
ZSBzcGFucy4KLSAgICByZXR1cm4gMTsKK2ludCBIVE1MRWxlbWVudDo6dGFnUHJpb3JpdHkoKSBj
b25zdAoreworICAgIHN0YXRpYyBjb25zdCBUYWdQcmlvcml0eU1hcCogdGFnUHJpb3JpdHlNYXAg
PSBpbml0aWFsaXplVGFnUHJpb3JpdHlNYXAoKTsKKyAgICByZXR1cm4gdGFnUHJpb3JpdHlNYXAt
PmdldChsb2NhbE5hbWUoKS5pbXBsKCkpOwogfQogCiBib29sIEhUTUxFbGVtZW50OjptYXBUb0Vu
dHJ5KGNvbnN0IFF1YWxpZmllZE5hbWUmIGF0dHJOYW1lLCBNYXBwZWRBdHRyaWJ1dGVFbnRyeSYg
cmVzdWx0KSBjb25zdAotLSAKMS42LjMuMwoK
</data>
<flag name="review"
          id="28189"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>