| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Rob Buis | 2 * Copyright (C) 2006, 2007 Rob Buis |
| 3 * Copyright (C) 2008 Apple, Inc. All rights reserved. | 3 * Copyright (C) 2008 Apple, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 StyleElement::~StyleElement() | 53 StyleElement::~StyleElement() |
| 54 { | 54 { |
| 55 if (m_sheet) | 55 if (m_sheet) |
| 56 clearSheet(); | 56 clearSheet(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void StyleElement::processStyleSheet(Document& document, Element* element) | 59 void StyleElement::processStyleSheet(Document& document, Element* element) |
| 60 { | 60 { |
| 61 TRACE_EVENT0("webkit", "StyleElement::processStyleSheet"); | 61 TRACE_EVENT0("webkit", "StyleElement::processStyleSheet"); |
| 62 ASSERT(element); | 62 ASSERT(element); |
| 63 ASSERT(element->inDocument()); |
| 63 | 64 |
| 64 m_registeredAsCandidate = true; | 65 m_registeredAsCandidate = true; |
| 65 document.styleEngine()->addStyleSheetCandidateNode(element, m_createdByParse
r); | 66 document.styleEngine()->addStyleSheetCandidateNode(element, m_createdByParse
r); |
| 66 if (m_createdByParser) | 67 if (m_createdByParser) |
| 67 return; | 68 return; |
| 68 | 69 |
| 69 process(element); | 70 process(element); |
| 70 } | 71 } |
| 71 | 72 |
| 72 void StyleElement::removedFromDocument(Document& document, Element* element) | 73 void StyleElement::removedFromDocument(Document& document, Element* element) |
| 73 { | 74 { |
| 74 removedFromDocument(document, element, 0, document); | 75 removedFromDocument(document, element, 0, document); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void StyleElement::removedFromDocument(Document& document, Element* element, Con
tainerNode* scopingNode, TreeScope& treeScope) | 78 void StyleElement::removedFromDocument(Document& document, Element* element, Con
tainerNode* scopingNode, TreeScope& treeScope) |
| 78 { | 79 { |
| 79 ASSERT(element); | 80 ASSERT(element); |
| 80 | 81 |
| 81 if (!m_registeredAsCandidate) { | 82 if (m_registeredAsCandidate) { |
| 82 ASSERT(!m_sheet); | 83 document.styleEngine()->removeStyleSheetCandidateNode(element, scopingNo
de, treeScope); |
| 83 return; | 84 m_registeredAsCandidate = false; |
| 84 } | 85 } |
| 85 | 86 |
| 86 document.styleEngine()->removeStyleSheetCandidateNode(element, scopingNode,
treeScope); | |
| 87 m_registeredAsCandidate = false; | |
| 88 | |
| 89 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet.get(); | 87 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet.get(); |
| 90 | 88 |
| 91 if (m_sheet) | 89 if (m_sheet) |
| 92 clearSheet(element); | 90 clearSheet(element); |
| 93 | 91 if (removedSheet) |
| 94 document.removedStyleSheet(removedSheet.get(), RecalcStyleDeferred, Analyzed
StyleUpdate); | 92 document.removedStyleSheet(removedSheet.get(), RecalcStyleDeferred, Anal
yzedStyleUpdate); |
| 95 } | 93 } |
| 96 | 94 |
| 97 void StyleElement::clearDocumentData(Document& document, Element* element) | 95 void StyleElement::clearDocumentData(Document& document, Element* element) |
| 98 { | 96 { |
| 99 if (m_sheet) | 97 if (m_sheet) |
| 100 m_sheet->clearOwnerNode(); | 98 m_sheet->clearOwnerNode(); |
| 101 | 99 |
| 102 if (element->inDocument()) { | 100 if (element->inDocument()) { |
| 103 ContainerNode* scopingNode = isHTMLStyleElement(element) ? toHTMLStyleEl
ement(element)->scopingNode() : 0; | 101 ContainerNode* scopingNode = isHTMLStyleElement(element) ? toHTMLStyleEl
ement(element)->scopingNode() : 0; |
| 104 TreeScope& treeScope = scopingNode ? scopingNode->treeScope() : element-
>treeScope(); | 102 TreeScope& treeScope = scopingNode ? scopingNode->treeScope() : element-
>treeScope(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 document.styleEngine()->removePendingSheet(m_sheet->ownerNode()); | 181 document.styleEngine()->removePendingSheet(m_sheet->ownerNode()); |
| 184 return true; | 182 return true; |
| 185 } | 183 } |
| 186 | 184 |
| 187 void StyleElement::startLoadingDynamicSheet(Document& document) | 185 void StyleElement::startLoadingDynamicSheet(Document& document) |
| 188 { | 186 { |
| 189 document.styleEngine()->addPendingSheet(); | 187 document.styleEngine()->addPendingSheet(); |
| 190 } | 188 } |
| 191 | 189 |
| 192 } | 190 } |
| OLD | NEW |