RESOLVED FIXED Bug 84882
Remove owner node pointer from StyleSheetInternal
https://bugs.webkit.org/show_bug.cgi?id=84882
Summary Remove owner node pointer from StyleSheetInternal
Antti Koivisto
Reported 2012-04-25 12:32:25 PDT
To make sharing between multiple nodes possible, StyleSheetInternal should not have a Node pointer.
Attachments
patch (40.56 KB, patch)
2012-04-25 14:39 PDT, Antti Koivisto
kling: review+
Antti Koivisto
Comment 1 2012-04-25 14:39:34 PDT
Andreas Kling
Comment 2 2012-04-25 15:32:54 PDT
Comment on attachment 138875 [details] patch 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..
Antti Koivisto
Comment 3 2012-04-25 16:10:15 PDT
Note You need to log in before you can comment on or make changes to this bug.