| 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 14 matching lines...) Expand all Loading... |
| 25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "sky/engine/config.h" | 28 #include "sky/engine/config.h" |
| 29 #include "sky/engine/core/dom/StyleEngine.h" | 29 #include "sky/engine/core/dom/StyleEngine.h" |
| 30 | 30 |
| 31 #include "sky/engine/core/css/CSSFontSelector.h" | 31 #include "sky/engine/core/css/CSSFontSelector.h" |
| 32 #include "sky/engine/core/css/CSSStyleSheet.h" | 32 #include "sky/engine/core/css/CSSStyleSheet.h" |
| 33 #include "sky/engine/core/css/FontFaceCache.h" | 33 #include "sky/engine/core/css/FontFaceCache.h" |
| 34 #include "sky/engine/core/css/StyleSheetContents.h" | 34 #include "sky/engine/core/css/StyleSheetContents.h" |
| 35 #include "sky/engine/core/dom/DocumentStyleSheetCollector.h" | |
| 36 #include "sky/engine/core/dom/Element.h" | 35 #include "sky/engine/core/dom/Element.h" |
| 37 #include "sky/engine/core/dom/ShadowTreeStyleSheetCollection.h" | 36 #include "sky/engine/core/dom/ShadowTreeStyleSheetCollection.h" |
| 38 #include "sky/engine/core/dom/shadow/ShadowRoot.h" | 37 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
| 39 #include "sky/engine/core/frame/Settings.h" | 38 #include "sky/engine/core/frame/Settings.h" |
| 40 #include "sky/engine/core/html/HTMLStyleElement.h" | 39 #include "sky/engine/core/html/HTMLStyleElement.h" |
| 41 #include "sky/engine/core/html/imports/HTMLImportsController.h" | 40 #include "sky/engine/core/html/imports/HTMLImportsController.h" |
| 42 #include "sky/engine/core/page/Page.h" | 41 #include "sky/engine/core/page/Page.h" |
| 43 | 42 |
| 44 namespace blink { | 43 namespace blink { |
| 45 | 44 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 inline Document* StyleEngine::master() | 88 inline Document* StyleEngine::master() |
| 90 { | 89 { |
| 91 if (isMaster()) | 90 if (isMaster()) |
| 92 return m_document; | 91 return m_document; |
| 93 HTMLImportsController* import = document().importsController(); | 92 HTMLImportsController* import = document().importsController(); |
| 94 if (!import) // Document::import() can return null while executing its destr
uctor. | 93 if (!import) // Document::import() can return null while executing its destr
uctor. |
| 95 return 0; | 94 return 0; |
| 96 return import->master(); | 95 return import->master(); |
| 97 } | 96 } |
| 98 | 97 |
| 98 const Vector<RefPtr<CSSStyleSheet>>& StyleEngine::activeAuthorStyleSheetsFor(Tre
eScope& treeScope) |
| 99 { |
| 100 if (treeScope == m_document) |
| 101 return documentStyleSheetCollection()->activeAuthorStyleSheets(); |
| 102 return ensureStyleSheetCollectionFor(treeScope)->activeAuthorStyleSheets(); |
| 103 } |
| 104 |
| 99 void StyleEngine::insertTreeScopeInDocumentOrder(TreeScopeSet& treeScopes, TreeS
cope* treeScope) | 105 void StyleEngine::insertTreeScopeInDocumentOrder(TreeScopeSet& treeScopes, TreeS
cope* treeScope) |
| 100 { | 106 { |
| 101 if (treeScopes.isEmpty()) { | 107 if (treeScopes.isEmpty()) { |
| 102 treeScopes.add(treeScope); | 108 treeScopes.add(treeScope); |
| 103 return; | 109 return; |
| 104 } | 110 } |
| 105 if (treeScopes.contains(treeScope)) | 111 if (treeScopes.contains(treeScope)) |
| 106 return; | 112 return; |
| 107 | 113 |
| 108 TreeScopeSet::iterator begin = treeScopes.begin(); | 114 TreeScopeSet::iterator begin = treeScopes.begin(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 138 { | 144 { |
| 139 if (treeScope == m_document) | 145 if (treeScope == m_document) |
| 140 return documentStyleSheetCollection(); | 146 return documentStyleSheetCollection(); |
| 141 | 147 |
| 142 StyleSheetCollectionMap::iterator it = m_styleSheetCollectionMap.find(&treeS
cope); | 148 StyleSheetCollectionMap::iterator it = m_styleSheetCollectionMap.find(&treeS
cope); |
| 143 if (it == m_styleSheetCollectionMap.end()) | 149 if (it == m_styleSheetCollectionMap.end()) |
| 144 return 0; | 150 return 0; |
| 145 return it->value.get(); | 151 return it->value.get(); |
| 146 } | 152 } |
| 147 | 153 |
| 148 const Vector<RefPtr<CSSStyleSheet> >& StyleEngine::styleSheetsForStyleSheetList(
TreeScope& treeScope) | |
| 149 { | |
| 150 if (treeScope == m_document) | |
| 151 return documentStyleSheetCollection()->styleSheetsForStyleSheetList(); | |
| 152 | |
| 153 return ensureStyleSheetCollectionFor(treeScope)->styleSheetsForStyleSheetLis
t(); | |
| 154 } | |
| 155 | |
| 156 void StyleEngine::modifiedStyleSheet(CSSStyleSheet* sheet) | 154 void StyleEngine::modifiedStyleSheet(CSSStyleSheet* sheet) |
| 157 { | 155 { |
| 158 if (!sheet) | 156 if (!sheet) |
| 159 return; | 157 return; |
| 160 | 158 |
| 161 Node* node = sheet->ownerNode(); | 159 Node* node = sheet->ownerNode(); |
| 162 if (!node || !node->inDocument()) | 160 if (!node || !node->inDocument()) |
| 163 return; | 161 return; |
| 164 | 162 |
| 165 TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : *m_do
cument; | 163 TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : *m_do
cument; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 { | 427 { |
| 430 if (!document().isActive()) | 428 if (!document().isActive()) |
| 431 return; | 429 return; |
| 432 | 430 |
| 433 if (m_resolver) | 431 if (m_resolver) |
| 434 m_resolver->invalidateMatchedPropertiesCache(); | 432 m_resolver->invalidateMatchedPropertiesCache(); |
| 435 document().setNeedsStyleRecalc(SubtreeStyleChange); | 433 document().setNeedsStyleRecalc(SubtreeStyleChange); |
| 436 } | 434 } |
| 437 | 435 |
| 438 } | 436 } |
| OLD | NEW |