| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // required by some inspector tests, at least. I theory this should not be | 154 // required by some inspector tests, at least. I theory this should not be |
| 155 // necessary. Need to investigate to figure out if/why. | 155 // necessary. Need to investigate to figure out if/why. |
| 156 updateActiveStyle(); | 156 updateActiveStyle(); |
| 157 return *m_inspectorStyleSheet; | 157 return *m_inspectorStyleSheet; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void StyleEngine::addPendingSheet(StyleEngineContext& context) { | 160 void StyleEngine::addPendingSheet(StyleEngineContext& context) { |
| 161 m_pendingScriptBlockingStylesheets++; | 161 m_pendingScriptBlockingStylesheets++; |
| 162 | 162 |
| 163 context.addingPendingSheet(document()); | 163 context.addingPendingSheet(document()); |
| 164 if (context.addedPendingSheetBeforeBody()) | 164 if (context.addedPendingSheetBeforeBody()) { |
| 165 m_pendingRenderBlockingStylesheets++; | 165 m_pendingRenderBlockingStylesheets++; |
| 166 } else { |
| 167 m_pendingBodyStylesheets++; |
| 168 document().didAddPendingStylesheetInBody(); |
| 169 } |
| 166 } | 170 } |
| 167 | 171 |
| 168 // This method is called whenever a top-level stylesheet has finished loading. | 172 // This method is called whenever a top-level stylesheet has finished loading. |
| 169 void StyleEngine::removePendingSheet(Node& styleSheetCandidateNode, | 173 void StyleEngine::removePendingSheet(Node& styleSheetCandidateNode, |
| 170 const StyleEngineContext& context) { | 174 const StyleEngineContext& context) { |
| 171 if (styleSheetCandidateNode.isConnected()) | 175 if (styleSheetCandidateNode.isConnected()) |
| 172 setNeedsActiveStyleUpdate(styleSheetCandidateNode.treeScope()); | 176 setNeedsActiveStyleUpdate(styleSheetCandidateNode.treeScope()); |
| 173 | 177 |
| 174 if (context.addedPendingSheetBeforeBody()) { | 178 if (context.addedPendingSheetBeforeBody()) { |
| 175 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); | 179 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); |
| 176 m_pendingRenderBlockingStylesheets--; | 180 m_pendingRenderBlockingStylesheets--; |
| 181 } else { |
| 182 DCHECK_GT(m_pendingBodyStylesheets, 0); |
| 183 m_pendingBodyStylesheets--; |
| 184 if (!m_pendingBodyStylesheets) |
| 185 document().didRemoveAllPendingBodyStylesheets(); |
| 177 } | 186 } |
| 178 | 187 |
| 179 // Make sure we knew this sheet was pending, and that our count isn't out of | 188 // Make sure we knew this sheet was pending, and that our count isn't out of |
| 180 // sync. | 189 // sync. |
| 181 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0); | 190 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0); |
| 182 | 191 |
| 183 m_pendingScriptBlockingStylesheets--; | 192 m_pendingScriptBlockingStylesheets--; |
| 184 if (m_pendingScriptBlockingStylesheets) | 193 if (m_pendingScriptBlockingStylesheets) |
| 185 return; | 194 return; |
| 186 | 195 |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 } | 1146 } |
| 1138 | 1147 |
| 1139 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1148 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
| 1140 for (auto sheet : m_injectedAuthorStyleSheets) { | 1149 for (auto sheet : m_injectedAuthorStyleSheets) { |
| 1141 visitor->traceWrappers(sheet); | 1150 visitor->traceWrappers(sheet); |
| 1142 } | 1151 } |
| 1143 visitor->traceWrappers(m_documentStyleSheetCollection); | 1152 visitor->traceWrappers(m_documentStyleSheetCollection); |
| 1144 } | 1153 } |
| 1145 | 1154 |
| 1146 } // namespace blink | 1155 } // namespace blink |
| OLD | NEW |