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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 if (createdByParser && document && document->scriptableDocumentParser() && !
document->isInDocumentWrite()) | 48 if (createdByParser && document && document->scriptableDocumentParser() && !
document->isInDocumentWrite()) |
49 m_startPosition = document->scriptableDocumentParser()->textPosition(); | 49 m_startPosition = document->scriptableDocumentParser()->textPosition(); |
50 } | 50 } |
51 | 51 |
52 StyleElement::~StyleElement() | 52 StyleElement::~StyleElement() |
53 { | 53 { |
54 if (m_sheet) | 54 if (m_sheet) |
55 clearSheet(); | 55 clearSheet(); |
56 } | 56 } |
57 | 57 |
58 void StyleElement::processStyleSheet(Document* document, Element* element) | 58 void StyleElement::processStyleSheet(Document& document, Element* element) |
59 { | 59 { |
60 ASSERT(document); | |
61 ASSERT(element); | 60 ASSERT(element); |
62 document->styleSheetCollections()->addStyleSheetCandidateNode(element, m_cre
atedByParser); | 61 document.styleSheetCollections()->addStyleSheetCandidateNode(element, m_crea
tedByParser); |
63 if (m_createdByParser) | 62 if (m_createdByParser) |
64 return; | 63 return; |
65 | 64 |
66 process(element); | 65 process(element); |
67 } | 66 } |
68 | 67 |
69 void StyleElement::removedFromDocument(Document* document, Element* element, Con
tainerNode* scopingNode) | 68 void StyleElement::removedFromDocument(Document& document, Element* element, Con
tainerNode* scopingNode) |
70 { | 69 { |
71 ASSERT(document); | |
72 ASSERT(element); | 70 ASSERT(element); |
73 document->styleSheetCollections()->removeStyleSheetCandidateNode(element, sc
opingNode); | 71 document.styleSheetCollections()->removeStyleSheetCandidateNode(element, sco
pingNode); |
74 | 72 |
75 RefPtr<StyleSheet> removedSheet = m_sheet; | 73 RefPtr<StyleSheet> removedSheet = m_sheet; |
76 | 74 |
77 if (m_sheet) | 75 if (m_sheet) |
78 clearSheet(); | 76 clearSheet(); |
79 | 77 |
80 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. | 78 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. |
81 if (document->renderer()) | 79 if (document.renderer()) |
82 document->removedStyleSheet(removedSheet.get()); | 80 document.removedStyleSheet(removedSheet.get()); |
83 } | 81 } |
84 | 82 |
85 void StyleElement::clearDocumentData(Document* document, Element* element) | 83 void StyleElement::clearDocumentData(Document& document, Element* element) |
86 { | 84 { |
87 if (m_sheet) | 85 if (m_sheet) |
88 m_sheet->clearOwnerNode(); | 86 m_sheet->clearOwnerNode(); |
89 | 87 |
90 if (element->inDocument()) | 88 if (element->inDocument()) |
91 document->styleSheetCollections()->removeStyleSheetCandidateNode(element
, isHTMLStyleElement(element) ? toHTMLStyleElement(element)->scopingNode() : 0)
; | 89 document.styleSheetCollections()->removeStyleSheetCandidateNode(element,
isHTMLStyleElement(element) ? toHTMLStyleElement(element)->scopingNode() : 0); |
92 } | 90 } |
93 | 91 |
94 void StyleElement::childrenChanged(Element* element) | 92 void StyleElement::childrenChanged(Element* element) |
95 { | 93 { |
96 ASSERT(element); | 94 ASSERT(element); |
97 if (m_createdByParser) | 95 if (m_createdByParser) |
98 return; | 96 return; |
99 | 97 |
100 process(element); | 98 process(element); |
101 } | 99 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 m_sheet->contents()->checkLoaded(); | 154 m_sheet->contents()->checkLoaded(); |
157 } | 155 } |
158 | 156 |
159 bool StyleElement::isLoading() const | 157 bool StyleElement::isLoading() const |
160 { | 158 { |
161 if (m_loading) | 159 if (m_loading) |
162 return true; | 160 return true; |
163 return m_sheet ? m_sheet->isLoading() : false; | 161 return m_sheet ? m_sheet->isLoading() : false; |
164 } | 162 } |
165 | 163 |
166 bool StyleElement::sheetLoaded(Document* document) | 164 bool StyleElement::sheetLoaded(Document& document) |
167 { | 165 { |
168 ASSERT(document); | |
169 if (isLoading()) | 166 if (isLoading()) |
170 return false; | 167 return false; |
171 | 168 |
172 document->styleSheetCollections()->removePendingSheet(m_sheet->ownerNode()); | 169 document.styleSheetCollections()->removePendingSheet(m_sheet->ownerNode()); |
173 return true; | 170 return true; |
174 } | 171 } |
175 | 172 |
176 void StyleElement::startLoadingDynamicSheet(Document* document) | 173 void StyleElement::startLoadingDynamicSheet(Document& document) |
177 { | 174 { |
178 ASSERT(document); | 175 document.styleSheetCollections()->addPendingSheet(); |
179 document->styleSheetCollections()->addPendingSheet(); | |
180 } | 176 } |
181 | 177 |
182 } | 178 } |
OLD | NEW |