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

Side by Side Diff: Source/core/css/CSSDefaultStyleSheets.cpp

Issue 1150823004: Make ensureDefaultStyleSheetForElement parameter const reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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/css/CSSDefaultStyleSheets.h ('k') | Source/core/css/resolver/StyleResolver.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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle() 128 RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle()
129 { 129 {
130 if (!m_defaultMobileViewportStyle) { 130 if (!m_defaultMobileViewportStyle) {
131 m_defaultMobileViewportStyle = RuleSet::create(); 131 m_defaultMobileViewportStyle = RuleSet::create();
132 m_mobileViewportStyleSheet = parseUASheet(loadResourceAsASCIIString("vie wportAndroid.css")); 132 m_mobileViewportStyleSheet = parseUASheet(loadResourceAsASCIIString("vie wportAndroid.css"));
133 m_defaultMobileViewportStyle->addRulesFromSheet(m_mobileViewportStyleShe et.get(), screenEval()); 133 m_defaultMobileViewportStyle->addRulesFromSheet(m_mobileViewportStyleShe et.get(), screenEval());
134 } 134 }
135 return m_defaultMobileViewportStyle.get(); 135 return m_defaultMobileViewportStyle.get();
136 } 136 }
137 137
138 void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element, bool& changedDefaultStyle) 138 void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(const Element& el ement, bool& changedDefaultStyle)
139 { 139 {
140 // FIXME: We should assert that the sheet only styles SVG elements. 140 // FIXME: We should assert that the sheet only styles SVG elements.
141 if (element->isSVGElement() && !m_svgStyleSheet) { 141 if (element.isSVGElement() && !m_svgStyleSheet) {
142 m_svgStyleSheet = parseUASheet(loadResourceAsASCIIString("svg.css")); 142 m_svgStyleSheet = parseUASheet(loadResourceAsASCIIString("svg.css"));
143 m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval()); 143 m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval());
144 m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval()); 144 m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval());
145 changedDefaultStyle = true; 145 changedDefaultStyle = true;
146 } 146 }
147 147
148 // FIXME: We should assert that the sheet only styles MathML elements. 148 // FIXME: We should assert that the sheet only styles MathML elements.
149 if (element->namespaceURI() == MathMLNames::mathmlNamespaceURI 149 if (element.namespaceURI() == MathMLNames::mathmlNamespaceURI
150 && !m_mathmlStyleSheet) { 150 && !m_mathmlStyleSheet) {
151 m_mathmlStyleSheet = parseUASheet(loadResourceAsASCIIString("mathml.css" )); 151 m_mathmlStyleSheet = parseUASheet(loadResourceAsASCIIString("mathml.css" ));
152 m_defaultStyle->addRulesFromSheet(mathmlStyleSheet(), screenEval()); 152 m_defaultStyle->addRulesFromSheet(mathmlStyleSheet(), screenEval());
153 m_defaultPrintStyle->addRulesFromSheet(mathmlStyleSheet(), printEval()); 153 m_defaultPrintStyle->addRulesFromSheet(mathmlStyleSheet(), printEval());
154 changedDefaultStyle = true; 154 changedDefaultStyle = true;
155 } 155 }
156 156
157 // FIXME: We should assert that this sheet only contains rules for <video> a nd <audio>. 157 // FIXME: We should assert that this sheet only contains rules for <video> a nd <audio>.
158 if (!m_mediaControlsStyleSheet && (isHTMLVideoElement(*element) || isHTMLAud ioElement(*element))) { 158 if (!m_mediaControlsStyleSheet && (isHTMLVideoElement(element) || isHTMLAudi oElement(element))) {
159 String mediaRules = loadResourceAsASCIIString("mediaControls.css") + Lay outTheme::theme().extraMediaControlsStyleSheet(); 159 String mediaRules = loadResourceAsASCIIString("mediaControls.css") + Lay outTheme::theme().extraMediaControlsStyleSheet();
160 m_mediaControlsStyleSheet = parseUASheet(mediaRules); 160 m_mediaControlsStyleSheet = parseUASheet(mediaRules);
161 m_defaultStyle->addRulesFromSheet(mediaControlsStyleSheet(), screenEval( )); 161 m_defaultStyle->addRulesFromSheet(mediaControlsStyleSheet(), screenEval( ));
162 m_defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet(), printE val()); 162 m_defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet(), printE val());
163 changedDefaultStyle = true; 163 changedDefaultStyle = true;
164 } 164 }
165 165
166 // FIXME: This only works because we Force recalc the entire document so the new sheet 166 // FIXME: This only works because we Force recalc the entire document so the new sheet
167 // is loaded for <html> and the correct styles apply to everyone. 167 // is loaded for <html> and the correct styles apply to everyone.
168 if (!m_fullscreenStyleSheet && Fullscreen::isFullScreen(element->document()) ) { 168 if (!m_fullscreenStyleSheet && Fullscreen::isFullScreen(element.document())) {
169 String fullscreenRules = loadResourceAsASCIIString("fullscreen.css") + L ayoutTheme::theme().extraFullScreenStyleSheet(); 169 String fullscreenRules = loadResourceAsASCIIString("fullscreen.css") + L ayoutTheme::theme().extraFullScreenStyleSheet();
170 m_fullscreenStyleSheet = parseUASheet(fullscreenRules); 170 m_fullscreenStyleSheet = parseUASheet(fullscreenRules);
171 m_defaultStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEval()); 171 m_defaultStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEval());
172 m_defaultQuirksStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEv al()); 172 m_defaultQuirksStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEv al());
173 changedDefaultStyle = true; 173 changedDefaultStyle = true;
174 } 174 }
175 175
176 ASSERT(!m_defaultStyle->features().hasIdsInSelectors()); 176 ASSERT(!m_defaultStyle->features().hasIdsInSelectors());
177 ASSERT(m_defaultStyle->features().siblingRules.isEmpty()); 177 ASSERT(m_defaultStyle->features().siblingRules.isEmpty());
178 } 178 }
179 179
180 DEFINE_TRACE(CSSDefaultStyleSheets) 180 DEFINE_TRACE(CSSDefaultStyleSheets)
181 { 181 {
182 visitor->trace(m_defaultStyle); 182 visitor->trace(m_defaultStyle);
183 visitor->trace(m_defaultMobileViewportStyle); 183 visitor->trace(m_defaultMobileViewportStyle);
184 visitor->trace(m_defaultQuirksStyle); 184 visitor->trace(m_defaultQuirksStyle);
185 visitor->trace(m_defaultPrintStyle); 185 visitor->trace(m_defaultPrintStyle);
186 visitor->trace(m_defaultViewSourceStyle); 186 visitor->trace(m_defaultViewSourceStyle);
187 visitor->trace(m_defaultXHTMLMobileProfileStyle); 187 visitor->trace(m_defaultXHTMLMobileProfileStyle);
188 visitor->trace(m_defaultStyleSheet); 188 visitor->trace(m_defaultStyleSheet);
189 visitor->trace(m_mobileViewportStyleSheet); 189 visitor->trace(m_mobileViewportStyleSheet);
190 visitor->trace(m_quirksStyleSheet); 190 visitor->trace(m_quirksStyleSheet);
191 visitor->trace(m_svgStyleSheet); 191 visitor->trace(m_svgStyleSheet);
192 visitor->trace(m_mathmlStyleSheet); 192 visitor->trace(m_mathmlStyleSheet);
193 visitor->trace(m_mediaControlsStyleSheet); 193 visitor->trace(m_mediaControlsStyleSheet);
194 visitor->trace(m_fullscreenStyleSheet); 194 visitor->trace(m_fullscreenStyleSheet);
195 } 195 }
196 196
197 } // namespace blink 197 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.h ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698