| 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 |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 11 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 12 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| 11 * | 13 * |
| 12 * This library is free software; you can redistribute it and/or | 14 * This library is free software; you can redistribute it and/or |
| 13 * modify it under the terms of the GNU Library General Public | 15 * modify it under the terms of the GNU Library General Public |
| 14 * License as published by the Free Software Foundation; either | 16 * License as published by the Free Software Foundation; either |
| 15 * version 2 of the License, or (at your option) any later version. | 17 * version 2 of the License, or (at your option) any later version. |
| 16 * | 18 * |
| 17 * This library is distributed in the hope that it will be useful, | 19 * This library is distributed in the hope that it will be useful, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 StyleEngine::~StyleEngine() {} | 77 StyleEngine::~StyleEngine() {} |
| 76 | 78 |
| 77 static bool isStyleElement(Node& node) { | 79 static bool isStyleElement(Node& node) { |
| 78 return isHTMLStyleElement(node) || isSVGStyleElement(node); | 80 return isHTMLStyleElement(node) || isSVGStyleElement(node); |
| 79 } | 81 } |
| 80 | 82 |
| 81 inline Document* StyleEngine::master() { | 83 inline Document* StyleEngine::master() { |
| 82 if (isMaster()) | 84 if (isMaster()) |
| 83 return m_document; | 85 return m_document; |
| 84 HTMLImportsController* import = document().importsController(); | 86 HTMLImportsController* import = document().importsController(); |
| 85 if (!import) // Document::import() can return null while executing its destru
ctor. | 87 // Document::import() can return null while executing its destructor. |
| 86 return 0; | 88 if (!import) |
| 89 return nullptr; |
| 87 return import->master(); | 90 return import->master(); |
| 88 } | 91 } |
| 89 | 92 |
| 90 TreeScopeStyleSheetCollection* StyleEngine::ensureStyleSheetCollectionFor( | 93 TreeScopeStyleSheetCollection* StyleEngine::ensureStyleSheetCollectionFor( |
| 91 TreeScope& treeScope) { | 94 TreeScope& treeScope) { |
| 92 if (treeScope == m_document) | 95 if (treeScope == m_document) |
| 93 return documentStyleSheetCollection(); | 96 return documentStyleSheetCollection(); |
| 94 | 97 |
| 95 StyleSheetCollectionMap::AddResult result = | 98 StyleSheetCollectionMap::AddResult result = |
| 96 m_styleSheetCollectionMap.add(&treeScope, nullptr); | 99 m_styleSheetCollectionMap.add(&treeScope, nullptr); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 ? &styleSheetCandidateNode.treeScope() | 165 ? &styleSheetCandidateNode.treeScope() |
| 163 : m_document.get(); | 166 : m_document.get(); |
| 164 if (styleSheetCandidateNode.isConnected()) | 167 if (styleSheetCandidateNode.isConnected()) |
| 165 markTreeScopeDirty(*treeScope); | 168 markTreeScopeDirty(*treeScope); |
| 166 | 169 |
| 167 if (context.addedPendingSheetBeforeBody()) { | 170 if (context.addedPendingSheetBeforeBody()) { |
| 168 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); | 171 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); |
| 169 m_pendingRenderBlockingStylesheets--; | 172 m_pendingRenderBlockingStylesheets--; |
| 170 } | 173 } |
| 171 | 174 |
| 172 // Make sure we knew this sheet was pending, and that our count isn't out of s
ync. | 175 // Make sure we knew this sheet was pending, and that our count isn't out of |
| 176 // sync. |
| 173 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0); | 177 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0); |
| 174 | 178 |
| 175 m_pendingScriptBlockingStylesheets--; | 179 m_pendingScriptBlockingStylesheets--; |
| 176 if (m_pendingScriptBlockingStylesheets) | 180 if (m_pendingScriptBlockingStylesheets) |
| 177 return; | 181 return; |
| 178 | 182 |
| 179 document().didRemoveAllPendingStylesheet(); | 183 document().didRemoveAllPendingStylesheet(); |
| 180 } | 184 } |
| 181 | 185 |
| 182 void StyleEngine::setNeedsActiveStyleUpdate( | 186 void StyleEngine::setNeedsActiveStyleUpdate( |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 const SpaceSplitString& newClasses, | 637 const SpaceSplitString& newClasses, |
| 634 Element& element) { | 638 Element& element) { |
| 635 if (shouldSkipInvalidationFor(element)) | 639 if (shouldSkipInvalidationFor(element)) |
| 636 return; | 640 return; |
| 637 | 641 |
| 638 if (!oldClasses.size()) { | 642 if (!oldClasses.size()) { |
| 639 classChangedForElement(newClasses, element); | 643 classChangedForElement(newClasses, element); |
| 640 return; | 644 return; |
| 641 } | 645 } |
| 642 | 646 |
| 643 // Class vectors tend to be very short. This is faster than using a hash table
. | 647 // Class vectors tend to be very short. This is faster than using a hash |
| 648 // table. |
| 644 BitVector remainingClassBits; | 649 BitVector remainingClassBits; |
| 645 remainingClassBits.ensureSize(oldClasses.size()); | 650 remainingClassBits.ensureSize(oldClasses.size()); |
| 646 | 651 |
| 647 InvalidationLists invalidationLists; | 652 InvalidationLists invalidationLists; |
| 648 RuleFeatureSet& ruleFeatureSet = | 653 RuleFeatureSet& ruleFeatureSet = |
| 649 ensureResolver().ensureUpdatedRuleFeatureSet(); | 654 ensureResolver().ensureUpdatedRuleFeatureSet(); |
| 650 | 655 |
| 651 for (unsigned i = 0; i < newClasses.size(); ++i) { | 656 for (unsigned i = 0; i < newClasses.size(); ++i) { |
| 652 bool found = false; | 657 bool found = false; |
| 653 for (unsigned j = 0; j < oldClasses.size(); ++j) { | 658 for (unsigned j = 0; j < oldClasses.size(); ++j) { |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 } | 965 } |
| 961 | 966 |
| 962 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 967 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
| 963 for (auto sheet : m_injectedAuthorStyleSheets) { | 968 for (auto sheet : m_injectedAuthorStyleSheets) { |
| 964 visitor->traceWrappers(sheet); | 969 visitor->traceWrappers(sheet); |
| 965 } | 970 } |
| 966 visitor->traceWrappers(m_documentStyleSheetCollection); | 971 visitor->traceWrappers(m_documentStyleSheetCollection); |
| 967 } | 972 } |
| 968 | 973 |
| 969 } // namespace blink | 974 } // namespace blink |
| OLD | NEW |