<?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>102765</bug_id>
          
          <creation_ts>2012-11-19 21:29:38 -0800</creation_ts>
          <short_desc>Remove unneeded null check in NodeRendererFactory::createRendererIfNeeded</short_desc>
          <delta_ts>2012-11-19 22:29:39 -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>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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="Elliott Sprehn">esprehn</reporter>
          <assigned_to name="Elliott Sprehn">esprehn</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>dglazkov</cc>
    
    <cc>morrita</cc>
    
    <cc>ojan</cc>
    
    <cc>tasak</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>771475</commentid>
    <comment_count>0</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2012-11-19 21:29:38 -0800</bug_when>
    <thetext>Remove unneeded null check in NodeRendererFactory::createRendererIfNeeded</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771480</commentid>
    <comment_count>1</comment_count>
      <attachid>175136</attachid>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2012-11-19 21:36:03 -0800</bug_when>
    <thetext>Created attachment 175136
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771491</commentid>
    <comment_count>2</comment_count>
      <attachid>175136</attachid>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2012-11-19 21:49:55 -0800</bug_when>
    <thetext>Comment on attachment 175136
Patch

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

&gt; Source/WebCore/dom/NodeRenderingContext.cpp:255
&gt; +    ASSERT(m_context.parentRenderer());

Can you move this line to be above the if/else. It makes more sense to me to assert before the line that depends on the assert.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771492</commentid>
    <comment_count>3</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2012-11-19 21:50:11 -0800</bug_when>
    <thetext>Actually, even better, but it directly in the else statement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771496</commentid>
    <comment_count>4</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2012-11-19 21:53:07 -0800</bug_when>
    <thetext>I was about to r- because I think the ASSERTs should be positioned higher in the code flow, but Ojan beat me to it.

If m_context.parentRenderer() might ever ASSERT, then it&apos;s possible the new code will blow up before having a chance to assert.

I also had a question about the behavior of parentRenderer(), which I think is probably NOT a problem, but I&apos;d feel better if you confirmed it.

&gt; Source/WebCore/ChangeLog:10
&gt; +        so there&apos;s no reason to check for it again.

Is it possible for parentRenderer() to return null, but parentFlowRenderer to be non-null?  From a brief look it seems like the answer is no.  But if I&apos;m wrong, this change would modify the behavior.  Can you please confirm that this is not a problem?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771499</commentid>
    <comment_count>5</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2012-11-19 21:57:15 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Actually, even better, but it directly in the else statement.

I&apos;m not actually asserting about the line in the else, I&apos;m asserting about the rendererIsNeeded() on the following line after the assert. Calling that method on a context that doesn&apos;t have a style or a parentRenderer is always a mistake.

Also if I put it in the else it makes it look like if  isElementNode() is true and we don&apos;t go down the else that we may not have a renderer (which is never true). Also if we do go through that else we&apos;ll crash on the null dereference so there&apos;s no reason to ASSERT about it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771500</commentid>
    <comment_count>6</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2012-11-19 22:01:41 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; I was about to r- because I think the ASSERTs should be positioned higher in the code flow, but Ojan beat me to it.
&gt; 
&gt; If m_context.parentRenderer() might ever ASSERT, then it&apos;s possible the new code will blow up before having a chance to assert.

Yes, that was intended. We do this all over webkit, and it&apos;s even been requested by Apple on my patches before that I NOT assert about nulls and instead just let the program crash the null dereference.

&gt; 
&gt; I also had a question about the behavior of parentRenderer(), which I think is probably NOT a problem, but I&apos;d feel better if you confirmed it.
&gt; 
&gt; &gt; Source/WebCore/ChangeLog:10
&gt; &gt; +        so there&apos;s no reason to check for it again.
&gt; 
&gt; Is it possible for parentRenderer() to return null, but parentFlowRenderer to be non-null?  From a brief look it seems like the answer is no.  But if I&apos;m wrong, this change would modify the behavior.  Can you please confirm that this is not a problem?

I don&apos;t understand what you&apos;re asking. parentRenderer never returns null in this code path because shouldCreateRenderer would have returned before we got here. There&apos;s no behavior change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771508</commentid>
    <comment_count>7</comment_count>
      <attachid>175138</attachid>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2012-11-19 22:06:19 -0800</bug_when>
    <thetext>Created attachment 175138
Patch for landing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771509</commentid>
    <comment_count>8</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2012-11-19 22:06:45 -0800</bug_when>
    <thetext>(In reply to comment #7)
&gt; Created an attachment (id=175138) [details]
&gt; Patch for landing

I moved the assert bove the if/else.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771513</commentid>
    <comment_count>9</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2012-11-19 22:11:46 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #4)
&gt; &gt; Is it possible for parentRenderer() to return null, but parentFlowRenderer to be non-null?  From a brief look it seems like the answer is no.  But if I&apos;m wrong, this change would modify the behavior.  Can you please confirm that this is not a problem?
&gt; 
&gt; I don&apos;t understand what you&apos;re asking. parentRenderer never returns null in this code path because shouldCreateRenderer would have returned before we got here. There&apos;s no behavior change.

I actually went and looked at the routine, and see that you are correct.  Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771525</commentid>
    <comment_count>10</comment_count>
      <attachid>175138</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-11-19 22:29:35 -0800</bug_when>
    <thetext>Comment on attachment 175138
Patch for landing

Clearing flags on attachment: 175138

Committed r135252: &lt;http://trac.webkit.org/changeset/135252&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>771526</commentid>
    <comment_count>11</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-11-19 22:29:39 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>175136</attachid>
            <date>2012-11-19 21:36:03 -0800</date>
            <delta_ts>2012-11-19 22:06:14 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-102765-20121120003352.patch</filename>
            <type>text/plain</type>
            <size>2078</size>
            <attacher name="Elliott Sprehn">esprehn</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTM1MjQ1CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNTgxODkzN2NhOGIwZmRi
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BlbHNlIGlmIChSZW5kZXJP
YmplY3QqIHBhcmVudFJlbmRlcmVyID0gbV9jb250ZXh0LnBhcmVudFJlbmRlcmVyKCkpCi0gICAg
ICAgIG1fY29udGV4dC5zZXRTdHlsZShwYXJlbnRSZW5kZXJlci0+c3R5bGUoKSk7CisgICAgZWxz
ZQorICAgICAgICBtX2NvbnRleHQuc2V0U3R5bGUobV9jb250ZXh0LnBhcmVudFJlbmRlcmVyKCkt
PnN0eWxlKCkpOworCisgICAgQVNTRVJUKG1fY29udGV4dC5zdHlsZSgpKTsKKyAgICBBU1NFUlQo
bV9jb250ZXh0LnBhcmVudFJlbmRlcmVyKCkpOwogCiAgICAgaWYgKCFub2RlLT5yZW5kZXJlcklz
TmVlZGVkKG1fY29udGV4dCkpIHsKICAgICAgICAgaWYgKGVsZW1lbnQgJiYgbV9jb250ZXh0LnN0
eWxlKCktPmFmZmVjdGVkQnlFbXB0eSgpKQo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>175138</attachid>
            <date>2012-11-19 22:06:19 -0800</date>
            <delta_ts>2012-11-19 22:29:35 -0800</delta_ts>
            <desc>Patch for landing</desc>
            <filename>bug-102765-20121120010408.patch</filename>
            <type>text/plain</type>
            <size>2140</size>
            <attacher name="Elliott Sprehn">esprehn</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTM1MjQ1CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNTgxODkzN2NhOGIwZmRi
ZDA5MDIyMWJhNTNmYWRlODE0YmIzYTA3Yi4uOTE2NWM2YzVhOTE1MDk2NTBiZjc5ZjNmNjI2NDM0
OWIxNzZjY2EyMSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3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G1fY29udGV4dC5wYXJlbnRSZW5kZXJlcigpKQotICAgICAgICBtX2NvbnRl
eHQuc2V0U3R5bGUocGFyZW50UmVuZGVyZXItPnN0eWxlKCkpOworICAgIGVsc2UKKyAgICAgICAg
bV9jb250ZXh0LnNldFN0eWxlKG1fY29udGV4dC5wYXJlbnRSZW5kZXJlcigpLT5zdHlsZSgpKTsK
KworICAgIEFTU0VSVChtX2NvbnRleHQuc3R5bGUoKSk7CiAKICAgICBpZiAoIW5vZGUtPnJlbmRl
cmVySXNOZWVkZWQobV9jb250ZXh0KSkgewogICAgICAgICBpZiAoZWxlbWVudCAmJiBtX2NvbnRl
eHQuc3R5bGUoKS0+YWZmZWN0ZWRCeUVtcHR5KCkpCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>