Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: Source/core/dom/TreeScopeStyleSheetCollection.cpp

Issue 1181023004: Move rem handling out of CSSParserValues.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Another attempt Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/TreeScopeStyleSheetCollection.h ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/dom/TreeScopeStyleSheetCollection.h ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698