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

Side by Side Diff: sky/engine/core/css/StyleSheetContents.cpp

Issue 799073004: Remove dead code from StyleSheetContents and CSSStyleSheet. (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/css/StyleSheetContents.h ('k') | sky/engine/core/dom/Document.cpp » ('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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 17 matching lines...) Expand all
28 #include "sky/engine/core/css/parser/BisonCSSParser.h" 28 #include "sky/engine/core/css/parser/BisonCSSParser.h"
29 #include "sky/engine/core/dom/Document.h" 29 #include "sky/engine/core/dom/Document.h"
30 #include "sky/engine/core/dom/Node.h" 30 #include "sky/engine/core/dom/Node.h"
31 #include "sky/engine/core/dom/StyleEngine.h" 31 #include "sky/engine/core/dom/StyleEngine.h"
32 #include "sky/engine/core/frame/UseCounter.h" 32 #include "sky/engine/core/frame/UseCounter.h"
33 #include "sky/engine/platform/TraceEvent.h" 33 #include "sky/engine/platform/TraceEvent.h"
34 #include "sky/engine/wtf/Deque.h" 34 #include "sky/engine/wtf/Deque.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 StyleSheetContents::StyleSheetContents(const String& originalURL, const CSSParse rContext& context) 38 StyleSheetContents::StyleSheetContents(const CSSParserContext& context)
39 : m_usesRemUnits(false) 39 : m_usesRemUnits(false)
40 , m_hasMediaQueries(false) 40 , m_hasMediaQueries(false)
41 , m_hasSingleOwnerDocument(true) 41 , m_hasSingleOwnerDocument(true)
42 , m_originalURL(originalURL)
43 , m_parserContext(context) 42 , m_parserContext(context)
44 { 43 {
45 } 44 }
46 45
47 StyleSheetContents::~StyleSheetContents() 46 StyleSheetContents::~StyleSheetContents()
48 { 47 {
49 #if !ENABLE(OILPAN) 48 #if !ENABLE(OILPAN)
50 clearRules(); 49 clearRules();
51 #endif 50 #endif
52 } 51 }
53 52
54 bool StyleSheetContents::isCacheable() const
55 {
56 // FIXME: StyleSheets with media queries can't be cached because their RuleS et
57 // is processed differently based off the media queries, which might resolve
58 // differently depending on the context of the parent CSSStyleSheet (e.g.
59 // if they are in differently sized iframes). Once RuleSets are media query
60 // agnostic, we can restore sharing of StyleSheetContents with medea queries .
61 if (m_hasMediaQueries)
62 return false;
63 return true;
64 }
65
66 void StyleSheetContents::parserAppendRule(PassRefPtr<StyleRuleBase> rule) 53 void StyleSheetContents::parserAppendRule(PassRefPtr<StyleRuleBase> rule)
67 { 54 {
68 // Add warning message to inspector if dpi/dpcm values are used for screen m edia. 55 // Add warning message to inspector if dpi/dpcm values are used for screen m edia.
69 if (rule->isMediaRule()) { 56 if (rule->isMediaRule()) {
70 setHasMediaQueries(); 57 setHasMediaQueries();
71 reportMediaQueryWarningIfNeeded(singleOwnerDocument(), toStyleRuleMedia( rule.get())->mediaQueries()); 58 reportMediaQueryWarningIfNeeded(singleOwnerDocument(), toStyleRuleMedia( rule.get())->mediaQueries());
72 } 59 }
73 60
74 m_childRules.append(rule); 61 m_childRules.append(rule);
75 } 62 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (m_loadingClients.size()) 102 if (m_loadingClients.size())
116 return (*m_loadingClients.begin())->ownerNode(); 103 return (*m_loadingClients.begin())->ownerNode();
117 return (*m_completedClients.begin())->ownerNode(); 104 return (*m_completedClients.begin())->ownerNode();
118 } 105 }
119 106
120 Document* StyleSheetContents::singleOwnerDocument() const 107 Document* StyleSheetContents::singleOwnerDocument() const
121 { 108 {
122 return clientSingleOwnerDocument(); 109 return clientSingleOwnerDocument();
123 } 110 }
124 111
125 KURL StyleSheetContents::completeURL(const String& url) const
126 {
127 // FIXME: This is only OK when we have a singleOwnerNode, right?
128 return m_parserContext.completeURL(url);
129 }
130
131 Document* StyleSheetContents::clientSingleOwnerDocument() const 112 Document* StyleSheetContents::clientSingleOwnerDocument() const
132 { 113 {
133 if (!m_hasSingleOwnerDocument || clientSize() <= 0) 114 if (!m_hasSingleOwnerDocument || clientSize() <= 0)
134 return 0; 115 return 0;
135 116
136 if (m_loadingClients.size()) 117 if (m_loadingClients.size())
137 return (*m_loadingClients.begin())->ownerDocument(); 118 return (*m_loadingClients.begin())->ownerDocument();
138 return (*m_completedClients.begin())->ownerDocument(); 119 return (*m_completedClients.begin())->ownerDocument();
139 } 120 }
140 121
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 198 }
218 } 199 }
219 200
220 void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontF aceRule) 201 void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontF aceRule)
221 { 202 {
222 removeFontFaceRules(m_loadingClients, fontFaceRule); 203 removeFontFaceRules(m_loadingClients, fontFaceRule);
223 removeFontFaceRules(m_completedClients, fontFaceRule); 204 removeFontFaceRules(m_completedClients, fontFaceRule);
224 } 205 }
225 206
226 } 207 }
OLDNEW
« no previous file with comments | « sky/engine/core/css/StyleSheetContents.h ('k') | sky/engine/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698