<?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>54105</bug_id>
          
          <creation_ts>2011-02-09 07:32:25 -0800</creation_ts>
          <short_desc>Add convenience method toHTMLElement(Node*)</short_desc>
          <delta_ts>2011-02-09 13:33:11 -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>PC</rep_platform>
          <op_sys>OS X 10.5</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yael">yael</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>commit-queue</cc>
    
    <cc>eric</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>348223</commentid>
    <comment_count>0</comment_count>
    <who name="Yael">yael</who>
    <bug_when>2011-02-09 07:32:25 -0800</bug_when>
    <thetext>While working on https://bugs.webkit.org/show_bug.cgi?id=50916 I noticed that we are missing this convenience method.
There are numerous places in WebCore editing and accessibility that cast a Node to HTMLElement, and would benefit from this convenience method.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348225</commentid>
    <comment_count>1</comment_count>
      <attachid>81812</attachid>
    <who name="Yael">yael</who>
    <bug_when>2011-02-09 07:35:35 -0800</bug_when>
    <thetext>Created attachment 81812
Patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348229</commentid>
    <comment_count>2</comment_count>
      <attachid>81812</attachid>
    <who name="Antonio Gomes">tonikitoo</who>
    <bug_when>2011-02-09 07:42:33 -0800</bug_when>
    <thetext>Comment on attachment 81812
Patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=81812&amp;action=review

Yeal, you should probably convert the callsites and add the helper altogether?

&gt; Source/WebCore/html/HTMLElement.h:113
&gt; +    ASSERT(!node || node-&gt;isHTMLElement());

would not it be clearer if the assert was ASSERT(node &amp;&amp; node-&gt;isHTMLElement());?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348234</commentid>
    <comment_count>3</comment_count>
      <attachid>81812</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-02-09 07:48:05 -0800</bug_when>
    <thetext>Comment on attachment 81812
Patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=81812&amp;action=review

This seems OK, but I have two thoughts.

One is that we want to do this for multiple element classes, not just HTMLElement. The other is that we want to use this type of checked cast whenever we cast. This helps us find bad casts.

I wouldn’t call it a “convenience method”, I would call it a “checked cast function”.

&gt;&gt; Source/WebCore/html/HTMLElement.h:113
&gt;&gt; +    ASSERT(!node || node-&gt;isHTMLElement());
&gt; 
&gt; would not it be clearer if the assert was ASSERT(node &amp;&amp; node-&gt;isHTMLElement());?

Clearer, but incorrect, because we want to allow 0.

Also, when an assert involves &amp;&amp; we normally write it as two asserts.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348240</commentid>
    <comment_count>4</comment_count>
    <who name="Yael">yael</who>
    <bug_when>2011-02-09 07:55:25 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 81812 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=81812&amp;action=review
&gt; 
&gt; Yeal, you should probably convert the callsites and add the helper altogether?
&gt; 
&gt; &gt; Source/WebCore/html/HTMLElement.h:113
&gt; &gt; +    ASSERT(!node || node-&gt;isHTMLElement());
&gt; 
&gt; would not it be clearer if the assert was ASSERT(node &amp;&amp; node-&gt;isHTMLElement());?

Perhaps, I simply copied this from toElement() :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348325</commentid>
    <comment_count>5</comment_count>
      <attachid>81812</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-02-09 09:46:53 -0800</bug_when>
    <thetext>Comment on attachment 81812
Patch.

Clearing flags on attachment: 81812

Committed r78073: &lt;http://trac.webkit.org/changeset/78073&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348326</commentid>
    <comment_count>6</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-02-09 09:46:58 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348510</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-02-09 13:23:18 -0800</bug_when>
    <thetext>http://trac.webkit.org/changeset/78073 might have broken GTK Linux 64-bit Debug</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>348521</commentid>
    <comment_count>8</comment_count>
    <who name="Yael">yael</who>
    <bug_when>2011-02-09 13:33:11 -0800</bug_when>
    <thetext>(In reply to comment #7)
&gt; http://trac.webkit.org/changeset/78073 might have broken GTK Linux 64-bit Debug

This patch added 2 methods without using them. I think it is safe to assume it did not break the GTK bot :)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>81812</attachid>
            <date>2011-02-09 07:35:35 -0800</date>
            <delta_ts>2011-02-09 09:46:53 -0800</delta_ts>
            <desc>Patch.</desc>
            <filename>54105.patch</filename>
            <type>text/plain</type>
            <size>1387</size>
            <attacher name="Yael">yael</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09P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0ZToKICAgICBIVE1MRm9ybUVsZW1lbnQqIHNoYWRvd0FuY2Vz
dG9yT3duZXJGb3JtKCk7CiB9OwogCitpbmxpbmUgSFRNTEVsZW1lbnQqIHRvSFRNTEVsZW1lbnQo
Tm9kZSogbm9kZSkKK3sKKyAgICBBU1NFUlQoIW5vZGUgfHwgbm9kZS0+aXNIVE1MRWxlbWVudCgp
KTsKKyAgICByZXR1cm4gc3RhdGljX2Nhc3Q8SFRNTEVsZW1lbnQqPihub2RlKTsKK30KKworaW5s
aW5lIGNvbnN0IEhUTUxFbGVtZW50KiB0b0hUTUxFbGVtZW50KGNvbnN0IE5vZGUqIG5vZGUpCit7
CisgICAgQVNTRVJUKCFub2RlIHx8IG5vZGUtPmlzSFRNTEVsZW1lbnQoKSk7CisgICAgcmV0dXJu
IHN0YXRpY19jYXN0PGNvbnN0IEhUTUxFbGVtZW50Kj4obm9kZSk7Cit9CisKIGlubGluZSBIVE1M
RWxlbWVudDo6SFRNTEVsZW1lbnQoY29uc3QgUXVhbGlmaWVkTmFtZSYgdGFnTmFtZSwgRG9jdW1l
bnQqIGRvY3VtZW50KQogICAgIDogU3R5bGVkRWxlbWVudCh0YWdOYW1lLCBkb2N1bWVudCwgQ3Jl
YXRlSFRNTEVsZW1lbnQpCiB7Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>