| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 m_scopedStyleResolvers.clear(); | 78 m_scopedStyleResolvers.clear(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 const Vector<RefPtr<CSSStyleSheet>>& StyleEngine::activeAuthorStyleSheetsFor(Tre
eScope& treeScope) | 81 const Vector<RefPtr<CSSStyleSheet>>& StyleEngine::activeAuthorStyleSheetsFor(Tre
eScope& treeScope) |
| 82 { | 82 { |
| 83 if (treeScope == m_document) | 83 if (treeScope == m_document) |
| 84 return documentStyleSheetCollection()->activeAuthorStyleSheets(); | 84 return documentStyleSheetCollection()->activeAuthorStyleSheets(); |
| 85 return ensureStyleSheetCollectionFor(treeScope)->activeAuthorStyleSheets(); | 85 return ensureStyleSheetCollectionFor(treeScope)->activeAuthorStyleSheets(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void StyleEngine::insertTreeScopeInDocumentOrder(TreeScopeSet& treeScopes, TreeS
cope* treeScope) | |
| 89 { | |
| 90 if (treeScopes.isEmpty()) { | |
| 91 treeScopes.add(treeScope); | |
| 92 return; | |
| 93 } | |
| 94 if (treeScopes.contains(treeScope)) | |
| 95 return; | |
| 96 | |
| 97 TreeScopeSet::iterator begin = treeScopes.begin(); | |
| 98 TreeScopeSet::iterator end = treeScopes.end(); | |
| 99 TreeScopeSet::iterator it = end; | |
| 100 TreeScope* followingTreeScope = 0; | |
| 101 do { | |
| 102 --it; | |
| 103 TreeScope* n = *it; | |
| 104 unsigned short position = n->comparePosition(*treeScope); | |
| 105 if (position & Node::DOCUMENT_POSITION_FOLLOWING) { | |
| 106 treeScopes.insertBefore(followingTreeScope, treeScope); | |
| 107 return; | |
| 108 } | |
| 109 followingTreeScope = n; | |
| 110 } while (it != begin); | |
| 111 | |
| 112 treeScopes.insertBefore(followingTreeScope, treeScope); | |
| 113 } | |
| 114 | |
| 115 StyleSheetCollection* StyleEngine::ensureStyleSheetCollectionFor(TreeScope& tree
Scope) | 88 StyleSheetCollection* StyleEngine::ensureStyleSheetCollectionFor(TreeScope& tree
Scope) |
| 116 { | 89 { |
| 117 if (treeScope == m_document) | 90 if (treeScope == m_document) |
| 118 return documentStyleSheetCollection(); | 91 return documentStyleSheetCollection(); |
| 119 | 92 |
| 120 StyleSheetCollectionMap::AddResult result = m_styleSheetCollectionMap.add(&t
reeScope, nullptr); | 93 StyleSheetCollectionMap::AddResult result = m_styleSheetCollectionMap.add(&t
reeScope, nullptr); |
| 121 if (result.isNewEntry) | 94 if (result.isNewEntry) |
| 122 result.storedValue->value = StyleSheetCollection::create(treeScope); | 95 result.storedValue->value = StyleSheetCollection::create(treeScope); |
| 123 return result.storedValue->value.get(); | 96 return result.storedValue->value.get(); |
| 124 } | 97 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 155 return; | 128 return; |
| 156 | 129 |
| 157 TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : *m_do
cument; | 130 TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : *m_do
cument; |
| 158 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); | 131 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); |
| 159 StyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope); | 132 StyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope); |
| 160 ASSERT(collection); | 133 ASSERT(collection); |
| 161 collection->addStyleSheetCandidateNode(node, createdByParser); | 134 collection->addStyleSheetCandidateNode(node, createdByParser); |
| 162 | 135 |
| 163 markTreeScopeDirty(treeScope); | 136 markTreeScopeDirty(treeScope); |
| 164 if (treeScope != m_document) | 137 if (treeScope != m_document) |
| 165 insertTreeScopeInDocumentOrder(m_activeTreeScopes, &treeScope); | 138 m_activeTreeScopes.add(&treeScope); |
| 166 } | 139 } |
| 167 | 140 |
| 168 void StyleEngine::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopi
ngNode, TreeScope& treeScope) | 141 void StyleEngine::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopi
ngNode, TreeScope& treeScope) |
| 169 { | 142 { |
| 170 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); | 143 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); |
| 171 | 144 |
| 172 StyleSheetCollection* collection = styleSheetCollectionFor(treeScope); | 145 StyleSheetCollection* collection = styleSheetCollectionFor(treeScope); |
| 173 ASSERT(collection); | 146 ASSERT(collection); |
| 174 collection->removeStyleSheetCandidateNode(node, scopingNode); | 147 collection->removeStyleSheetCandidateNode(node, scopingNode); |
| 175 | 148 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 325 } |
| 353 | 326 |
| 354 void StyleEngine::fontsNeedUpdate(CSSFontSelector*) | 327 void StyleEngine::fontsNeedUpdate(CSSFontSelector*) |
| 355 { | 328 { |
| 356 if (m_resolver) | 329 if (m_resolver) |
| 357 m_resolver->invalidateMatchedPropertiesCache(); | 330 m_resolver->invalidateMatchedPropertiesCache(); |
| 358 m_document->setNeedsStyleRecalc(SubtreeStyleChange); | 331 m_document->setNeedsStyleRecalc(SubtreeStyleChange); |
| 359 } | 332 } |
| 360 | 333 |
| 361 } | 334 } |
| OLD | NEW |