[Webkit-unassigned] [Bug 84882] Remove owner node pointer from StyleSheetInternal

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


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


Andreas Kling <kling at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #138875|review?                     |review+
               Flag|                            |




--- Comment #2 from Andreas Kling <kling at webkit.org>  2012-04-25 15:32:54 PST ---
(From update of attachment 138875)
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..

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list