OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 void StyleEngine::injectAuthorSheet(StyleSheetContents* authorSheet) | 127 void StyleEngine::injectAuthorSheet(StyleSheetContents* authorSheet) |
128 { | 128 { |
129 m_injectedAuthorStyleSheets.append(CSSStyleSheet::create(authorSheet, m_docu
ment)); | 129 m_injectedAuthorStyleSheets.append(CSSStyleSheet::create(authorSheet, m_docu
ment)); |
130 markDocumentDirty(); | 130 markDocumentDirty(); |
131 resolverChanged(AnalyzedStyleUpdate); | 131 resolverChanged(AnalyzedStyleUpdate); |
132 } | 132 } |
133 | 133 |
134 void StyleEngine::addPendingSheet(StyleEngineContext &context) | 134 void StyleEngine::addPendingSheet(StyleEngineContext &context) |
135 { | 135 { |
136 m_pendingStylesheets++; | 136 m_pendingScriptBlockingStylesheets++; |
137 | 137 |
138 context.addingPendingSheet(document()); | 138 context.addingPendingSheet(document()); |
139 if (context.addedPendingSheetBeforeBody()) | 139 if (context.addedPendingSheetBeforeBody()) |
140 m_pendingRenderBlockingStylesheets++; | 140 m_pendingRenderBlockingStylesheets++; |
141 } | 141 } |
142 | 142 |
143 // This method is called whenever a top-level stylesheet has finished loading. | 143 // This method is called whenever a top-level stylesheet has finished loading. |
144 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, const StyleE
ngineContext &context) | 144 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, const StyleE
ngineContext &context) |
145 { | 145 { |
146 DCHECK(styleSheetCandidateNode); | 146 DCHECK(styleSheetCandidateNode); |
147 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee
tCandidateNode->treeScope() : m_document.get(); | 147 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee
tCandidateNode->treeScope() : m_document.get(); |
148 if (styleSheetCandidateNode->inShadowIncludingDocument()) | 148 if (styleSheetCandidateNode->inShadowIncludingDocument()) |
149 markTreeScopeDirty(*treeScope); | 149 markTreeScopeDirty(*treeScope); |
150 | 150 |
151 if (context.addedPendingSheetBeforeBody()) { | 151 if (context.addedPendingSheetBeforeBody()) { |
152 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); | 152 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); |
153 m_pendingRenderBlockingStylesheets--; | 153 m_pendingRenderBlockingStylesheets--; |
154 } | 154 } |
155 | 155 |
156 // Make sure we knew this sheet was pending, and that our count isn't out of
sync. | 156 // Make sure we knew this sheet was pending, and that our count isn't out of
sync. |
157 DCHECK_GT(m_pendingStylesheets, 0); | 157 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0); |
158 | 158 |
159 m_pendingStylesheets--; | 159 m_pendingScriptBlockingStylesheets--; |
160 if (m_pendingStylesheets) | 160 if (m_pendingScriptBlockingStylesheets) |
161 return; | 161 return; |
162 | 162 |
163 document().didRemoveAllPendingStylesheet(); | 163 document().didRemoveAllPendingStylesheet(); |
164 } | 164 } |
165 | 165 |
166 void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda
teMode updateMode) | 166 void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda
teMode updateMode) |
167 { | 167 { |
168 // resolverChanged() is called for inactive non-master documents because | 168 // resolverChanged() is called for inactive non-master documents because |
169 // import documents are inactive documents. resolverChanged() for imports | 169 // import documents are inactive documents. resolverChanged() for imports |
170 // will call resolverChanged() for the master document and update the active | 170 // will call resolverChanged() for the master document and update the active |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 master->styleEngine().clearResolver(); | 420 master->styleEngine().clearResolver(); |
421 } | 421 } |
422 | 422 |
423 void StyleEngine::didDetach() | 423 void StyleEngine::didDetach() |
424 { | 424 { |
425 clearResolver(); | 425 clearResolver(); |
426 } | 426 } |
427 | 427 |
428 bool StyleEngine::shouldClearResolver() const | 428 bool StyleEngine::shouldClearResolver() const |
429 { | 429 { |
430 return !m_didCalculateResolver && !haveStylesheetsLoaded(); | 430 return !m_didCalculateResolver && !haveScriptBlockingStylesheetsLoaded(); |
431 } | 431 } |
432 | 432 |
433 void StyleEngine::resolverChanged(StyleResolverUpdateMode mode) | 433 void StyleEngine::resolverChanged(StyleResolverUpdateMode mode) |
434 { | 434 { |
435 if (!isMaster()) { | 435 if (!isMaster()) { |
436 if (Document* master = this->master()) | 436 if (Document* master = this->master()) |
437 master->styleEngine().resolverChanged(mode); | 437 master->styleEngine().resolverChanged(mode); |
438 return; | 438 return; |
439 } | 439 } |
440 | 440 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 visitor->trace(m_styleInvalidator); | 753 visitor->trace(m_styleInvalidator); |
754 visitor->trace(m_dirtyTreeScopes); | 754 visitor->trace(m_dirtyTreeScopes); |
755 visitor->trace(m_activeTreeScopes); | 755 visitor->trace(m_activeTreeScopes); |
756 visitor->trace(m_fontSelector); | 756 visitor->trace(m_fontSelector); |
757 visitor->trace(m_textToSheetCache); | 757 visitor->trace(m_textToSheetCache); |
758 visitor->trace(m_sheetToTextCache); | 758 visitor->trace(m_sheetToTextCache); |
759 CSSFontSelectorClient::trace(visitor); | 759 CSSFontSelectorClient::trace(visitor); |
760 } | 760 } |
761 | 761 |
762 } // namespace blink | 762 } // namespace blink |
OLD | NEW |