<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:darin&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - NULL Reference Error in ElementRuleCollector"
   href="https://bugs.webkit.org/show_bug.cgi?id=160362">bug 160362</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #284910 Flags</td>
           <td>review?
           </td>
           <td>review-
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - NULL Reference Error in ElementRuleCollector"
   href="https://bugs.webkit.org/show_bug.cgi?id=160362#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - NULL Reference Error in ElementRuleCollector"
   href="https://bugs.webkit.org/show_bug.cgi?id=160362">bug 160362</a>
              from <span class="vcard"><a class="email" href="mailto:darin&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=284910&amp;action=diff" name="attach_284910" title="Patch">attachment 284910</a> <a href="attachment.cgi?id=284910&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=284910&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=284910&amp;action=review</a>

I’m not sure this change is the best fix.

Before landing this we need to understand why authorStyle is null. It doesn’t make sense because StyleResolver is the only place I see us creating a DocumentRuleSets object, and when creating it we call resetAuthorStyle. If authorStyle is null I suppose that means this is happening inside the StyleResolver constructor before resetAuthorStyle is called. If so, this can be fixed by reordering the code so it is called earlier.

In fact, I think DocumentRuleSets could probably call resetAuthorStyle inside its own constructor; there is no reason it has to wait until later. Then we could remove the explicit call to it inside the StyleResolver. And we could even change the authorStyle() function to return a reference rather than a pointer.

<span class="quote">&gt; Source/WebCore/css/ElementRuleCollector.cpp:299
&gt; +        collectMatchingRulesForList(&amp;(m_authorStyle-&gt;slottedPseudoElementRules()), matchRequest, ruleRange);</span >

No need to add the parentheses to this expression. Please don’t add them.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>