[Webkit-unassigned] [Bug 160362] NULL Reference Error in ElementRuleCollector

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 1 09:30:34 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=160362

--- Comment #7 from Jonathan Bedard <jbedard at apple.com> ---
(In reply to comment #3)
> Comment on attachment 284910 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=284910&action=review
> 
> 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.
> 
> > Source/WebCore/css/ElementRuleCollector.cpp:299
> > +        collectMatchingRulesForList(&(m_authorStyle->slottedPseudoElementRules()), matchRequest, ruleRange);
> 
> No need to add the parentheses to this expression. Please don’t add them.

I think your points here center around the question I had when I first encountered this bug: should the authorStyle ever be undefined?  I'm not familiar enough with the desired behavior here to answer this question.

If the author style should always be defined, then should it not be an object in the DocumentRulesSets instead of a pointer?  And, if the author style should always be defined, what about the user style, which has a very similar pattern to the author style in the DocumentRulesSets (i.e.: both are pointers, instantiated through member functions but left undefined after the constructor).  I modeled the handling of the author style in ElementRuleCollector after the way the class handles the user style.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160801/63bd0577/attachment.html>


More information about the webkit-unassigned mailing list