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

Side by Side Diff: sky/engine/core/dom/TreeScopeStyleSheetCollection.cpp

Issue 788883005: Remove REM units. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/dom/TreeScopeStyleSheetCollection.h ('k') | no next file » | 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 20 matching lines...) Expand all
31 #include "sky/engine/core/css/StyleSheetContents.h" 31 #include "sky/engine/core/css/StyleSheetContents.h"
32 #include "sky/engine/core/css/resolver/StyleResolver.h" 32 #include "sky/engine/core/css/resolver/StyleResolver.h"
33 #include "sky/engine/core/dom/Element.h" 33 #include "sky/engine/core/dom/Element.h"
34 #include "sky/engine/core/dom/StyleEngine.h" 34 #include "sky/engine/core/dom/StyleEngine.h"
35 #include "sky/engine/core/html/HTMLStyleElement.h" 35 #include "sky/engine/core/html/HTMLStyleElement.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScop e) 39 TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScop e)
40 : m_treeScope(treeScope) 40 : m_treeScope(treeScope)
41 , m_usesRemUnits(false)
42 { 41 {
43 } 42 }
44 43
45 void TreeScopeStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool) 44 void TreeScopeStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool)
46 { 45 {
47 if (!node->inDocument()) 46 if (!node->inDocument())
48 return; 47 return;
49 48
50 // Until the <body> exists, we have no choice but to compare document positi ons, 49 // Until the <body> exists, we have no choice but to compare document positi ons,
51 // since styles outside of the body and head continue to be shunted into the head 50 // since styles outside of the body and head continue to be shunted into the head
52 // (and thus can shift to end up before dynamically added DOM content that i s also 51 // (and thus can shift to end up before dynamically added DOM content that i s also
53 // outside the body). 52 // outside the body).
54 m_styleSheetCandidateNodes.add(node); 53 m_styleSheetCandidateNodes.add(node);
55 } 54 }
56 55
57 void TreeScopeStyleSheetCollection::removeStyleSheetCandidateNode(Node* node, Co ntainerNode* scopingNode) 56 void TreeScopeStyleSheetCollection::removeStyleSheetCandidateNode(Node* node, Co ntainerNode* scopingNode)
58 { 57 {
59 m_styleSheetCandidateNodes.remove(node); 58 m_styleSheetCandidateNodes.remove(node);
60 } 59 }
61 60
62 void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets() 61 void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets()
63 { 62 {
64 for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) { 63 for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) {
65 StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents(); 64 StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents();
66 if (contents->hasMediaQueries()) 65 if (contents->hasMediaQueries())
67 contents->clearRuleSet(); 66 contents->clearRuleSet();
68 } 67 }
69 } 68 }
70 69
71 static bool styleSheetsUseRemUnits(const Vector<RefPtr<CSSStyleSheet> >& sheets)
72 {
73 for (unsigned i = 0; i < sheets.size(); ++i) {
74 if (sheets[i]->contents()->usesRemUnits())
75 return true;
76 }
77 return false;
78 } 70 }
79
80 void TreeScopeStyleSheetCollection::updateUsesRemUnits()
81 {
82 m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets);
83 }
84
85 }
OLDNEW
« no previous file with comments | « sky/engine/core/dom/TreeScopeStyleSheetCollection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698