[webkit-reviews] review granted: [Bug 84882] Remove owner node pointer from StyleSheetInternal : [Attachment 138875] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 25 15:32:54 PDT 2012


Andreas Kling <kling at webkit.org> has granted Antti Koivisto <koivisto at iki.fi>'s
request for review:
Bug 84882: Remove owner node pointer from StyleSheetInternal
https://bugs.webkit.org/show_bug.cgi?id=84882

Attachment 138875: patch
https://bugs.webkit.org/attachment.cgi?id=138875&action=review

------- Additional Comments from Andreas Kling <kling at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=138875&action=review


r=me with the Node reffing change we discussed.

> Source/WebCore/css/CSSImportRule.cpp:67
> +    CSSParserContext context = m_parentStyleSheet ?
m_parentStyleSheet->parserContext() : CSSStrictMode;

Not a huge fan of this construction syntax. But NABD.

> Source/WebCore/css/CSSStyleSheet.cpp:326
> -    RefPtr<Node> owner = ownerNode();
> -    if (!owner)
> +    StyleSheetInternal* parentSheet = parentStyleSheet();
> +    if (parentSheet) {
> +	   parentSheet->checkLoaded();
> +	   m_loadCompleted = true;
> +	   return;
> +    }
> +    Node* ownerNode = singleOwnerNode();
> +    if (!ownerNode) {
>	   m_loadCompleted = true;
> -    else {
> -	   m_loadCompleted = owner->sheetLoaded();
> -	   if (m_loadCompleted)
> -	      
owner->notifyLoadedSheetAndAllCriticalSubresources(m_didLoadErrorOccur);
> +	   return;
>      }
> +    // This may run javascript and kill the node.
> +    m_loadCompleted = ownerNode->sheetLoaded();
> +    // Get the node again.
> +    ownerNode = singleOwnerNode();
> +    if (m_loadCompleted && ownerNode)
> +	  
ownerNode->notifyLoadedSheetAndAllCriticalSubresources(m_didLoadErrorOccur);

We should hold a ref on the owner Node throughout the sheetLoaded() call to
prevent it from disappearing under us. (Like the old code did.)

> Source/WebCore/dom/Document.cpp:2626
> +	   // Element sheet is a silly. It never contains anything.

I agree. :)
I have an occasional daydream where we remove it. Someday..


More information about the webkit-reviews mailing list