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, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
36 #include "core/dom/StyleEngine.h" | 36 #include "core/dom/StyleEngine.h" |
37 #include "core/html/HTMLLinkElement.h" | 37 #include "core/html/HTMLLinkElement.h" |
38 #include "core/html/HTMLStyleElement.h" | 38 #include "core/html/HTMLStyleElement.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScop
e) | 42 TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScop
e) |
43 : m_treeScope(treeScope) | 43 : m_treeScope(treeScope) |
44 , m_hadActiveLoadingStylesheet(false) | 44 , m_hadActiveLoadingStylesheet(false) |
45 , m_usesRemUnits(false) | |
46 { | 45 { |
47 } | 46 } |
48 | 47 |
49 void TreeScopeStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool
createdByParser) | 48 void TreeScopeStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool
createdByParser) |
50 { | 49 { |
51 if (!node->inDocument()) | 50 if (!node->inDocument()) |
52 return; | 51 return; |
53 | 52 |
54 // Until the <body> exists, we have no choice but to compare document positi
ons, | 53 // Until the <body> exists, we have no choice but to compare document positi
ons, |
55 // since styles outside of the body and head continue to be shunted into the
head | 54 // since styles outside of the body and head continue to be shunted into the
head |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 168 |
170 void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets() | 169 void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets() |
171 { | 170 { |
172 for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) { | 171 for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) { |
173 StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents(); | 172 StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents(); |
174 if (contents->hasMediaQueries()) | 173 if (contents->hasMediaQueries()) |
175 contents->clearRuleSet(); | 174 contents->clearRuleSet(); |
176 } | 175 } |
177 } | 176 } |
178 | 177 |
179 static bool styleSheetsUseRemUnits(const WillBeHeapVector<RefPtrWillBeMember<CSS
StyleSheet>>& sheets) | |
180 { | |
181 for (unsigned i = 0; i < sheets.size(); ++i) { | |
182 if (sheets[i]->contents()->usesRemUnits()) | |
183 return true; | |
184 } | |
185 return false; | |
186 } | |
187 | |
188 void TreeScopeStyleSheetCollection::updateUsesRemUnits() | |
189 { | |
190 m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets); | |
191 } | |
192 | |
193 DEFINE_TRACE(TreeScopeStyleSheetCollection) | 178 DEFINE_TRACE(TreeScopeStyleSheetCollection) |
194 { | 179 { |
195 visitor->trace(m_treeScope); | 180 visitor->trace(m_treeScope); |
196 visitor->trace(m_styleSheetCandidateNodes); | 181 visitor->trace(m_styleSheetCandidateNodes); |
197 StyleSheetCollection::trace(visitor); | 182 StyleSheetCollection::trace(visitor); |
198 } | 183 } |
199 | 184 |
200 } | 185 } |
OLD | NEW |