OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 * | 22 * |
23 * You should have received a copy of the GNU Library General Public License | 23 * You should have received a copy of the GNU Library General Public License |
24 * along with this library; see the file COPYING.LIB. If not, write to | 24 * along with this library; see the file COPYING.LIB. If not, write to |
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 * Boston, MA 02110-1301, USA. | 26 * Boston, MA 02110-1301, USA. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "core/css/CSSDefaultStyleSheets.h" | 30 #include "core/css/CSSDefaultStyleSheets.h" |
31 | 31 |
| 32 #include "MathMLNames.h" |
32 #include "UserAgentStyleSheets.h" | 33 #include "UserAgentStyleSheets.h" |
33 #include "core/css/MediaQueryEvaluator.h" | 34 #include "core/css/MediaQueryEvaluator.h" |
34 #include "core/css/RuleSet.h" | 35 #include "core/css/RuleSet.h" |
35 #include "core/css/StyleSheetContents.h" | 36 #include "core/css/StyleSheetContents.h" |
36 #include "core/dom/FullscreenElementStack.h" | 37 #include "core/dom/FullscreenElementStack.h" |
37 #include "core/html/HTMLAnchorElement.h" | 38 #include "core/html/HTMLAnchorElement.h" |
38 #include "core/html/HTMLHtmlElement.h" | 39 #include "core/html/HTMLHtmlElement.h" |
39 #include "core/rendering/RenderTheme.h" | 40 #include "core/rendering/RenderTheme.h" |
40 | 41 |
41 namespace WebCore { | 42 namespace WebCore { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 : m_defaultStyle(nullptr) | 82 : m_defaultStyle(nullptr) |
82 , m_defaultViewportStyle(nullptr) | 83 , m_defaultViewportStyle(nullptr) |
83 , m_defaultQuirksStyle(nullptr) | 84 , m_defaultQuirksStyle(nullptr) |
84 , m_defaultPrintStyle(nullptr) | 85 , m_defaultPrintStyle(nullptr) |
85 , m_defaultViewSourceStyle(nullptr) | 86 , m_defaultViewSourceStyle(nullptr) |
86 , m_defaultXHTMLMobileProfileStyle(nullptr) | 87 , m_defaultXHTMLMobileProfileStyle(nullptr) |
87 , m_defaultStyleSheet(nullptr) | 88 , m_defaultStyleSheet(nullptr) |
88 , m_viewportStyleSheet(nullptr) | 89 , m_viewportStyleSheet(nullptr) |
89 , m_quirksStyleSheet(nullptr) | 90 , m_quirksStyleSheet(nullptr) |
90 , m_svgStyleSheet(nullptr) | 91 , m_svgStyleSheet(nullptr) |
| 92 , m_mathmlStyleSheet(nullptr) |
91 , m_mediaControlsStyleSheet(nullptr) | 93 , m_mediaControlsStyleSheet(nullptr) |
92 , m_fullscreenStyleSheet(nullptr) | 94 , m_fullscreenStyleSheet(nullptr) |
93 { | 95 { |
94 m_defaultStyle = RuleSet::create(); | 96 m_defaultStyle = RuleSet::create(); |
95 m_defaultViewportStyle = RuleSet::create(); | 97 m_defaultViewportStyle = RuleSet::create(); |
96 m_defaultPrintStyle = RuleSet::create(); | 98 m_defaultPrintStyle = RuleSet::create(); |
97 m_defaultQuirksStyle = RuleSet::create(); | 99 m_defaultQuirksStyle = RuleSet::create(); |
98 | 100 |
99 // Strict-mode rules. | 101 // Strict-mode rules. |
100 String defaultRules = String(htmlUserAgentStyleSheet, sizeof(htmlUserAgentSt
yleSheet)) + RenderTheme::theme().extraDefaultStyleSheet(); | 102 String defaultRules = String(htmlUserAgentStyleSheet, sizeof(htmlUserAgentSt
yleSheet)) + RenderTheme::theme().extraDefaultStyleSheet(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
bool& changedDefaultStyle) | 142 void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
bool& changedDefaultStyle) |
141 { | 143 { |
142 // FIXME: We should assert that the sheet only styles SVG elements. | 144 // FIXME: We should assert that the sheet only styles SVG elements. |
143 if (element->isSVGElement() && !m_svgStyleSheet) { | 145 if (element->isSVGElement() && !m_svgStyleSheet) { |
144 m_svgStyleSheet = parseUASheet(svgUserAgentStyleSheet, sizeof(svgUserAge
ntStyleSheet)); | 146 m_svgStyleSheet = parseUASheet(svgUserAgentStyleSheet, sizeof(svgUserAge
ntStyleSheet)); |
145 m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval()); | 147 m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval()); |
146 m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval()); | 148 m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval()); |
147 changedDefaultStyle = true; | 149 changedDefaultStyle = true; |
148 } | 150 } |
149 | 151 |
| 152 // FIXME: We should assert that the sheet only styles MathML elements. |
| 153 if (element->namespaceURI() == MathMLNames::mathmlNamespaceURI |
| 154 && !m_mathmlStyleSheet) { |
| 155 m_mathmlStyleSheet = parseUASheet(mathmlUserAgentStyleSheet, |
| 156 sizeof(mathmlUserAgentStyleSheet)); |
| 157 m_defaultStyle->addRulesFromSheet(mathmlStyleSheet(), screenEval()); |
| 158 m_defaultPrintStyle->addRulesFromSheet(mathmlStyleSheet(), printEval()); |
| 159 changedDefaultStyle = true; |
| 160 } |
| 161 |
150 // FIXME: We should assert that this sheet only contains rules for <video> a
nd <audio>. | 162 // FIXME: We should assert that this sheet only contains rules for <video> a
nd <audio>. |
151 if (!m_mediaControlsStyleSheet && (isHTMLVideoElement(*element) || isHTMLAud
ioElement(*element))) { | 163 if (!m_mediaControlsStyleSheet && (isHTMLVideoElement(*element) || isHTMLAud
ioElement(*element))) { |
152 String mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(medi
aControlsUserAgentStyleSheet)) + RenderTheme::theme().extraMediaControlsStyleShe
et(); | 164 String mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(medi
aControlsUserAgentStyleSheet)) + RenderTheme::theme().extraMediaControlsStyleShe
et(); |
153 m_mediaControlsStyleSheet = parseUASheet(mediaRules); | 165 m_mediaControlsStyleSheet = parseUASheet(mediaRules); |
154 m_defaultStyle->addRulesFromSheet(mediaControlsStyleSheet(), screenEval(
)); | 166 m_defaultStyle->addRulesFromSheet(mediaControlsStyleSheet(), screenEval(
)); |
155 m_defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet(), printE
val()); | 167 m_defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet(), printE
val()); |
156 changedDefaultStyle = true; | 168 changedDefaultStyle = true; |
157 } | 169 } |
158 | 170 |
159 // FIXME: This only works because we Force recalc the entire document so the
new sheet | 171 // FIXME: This only works because we Force recalc the entire document so the
new sheet |
(...skipping 15 matching lines...) Expand all Loading... |
175 visitor->trace(m_defaultStyle); | 187 visitor->trace(m_defaultStyle); |
176 visitor->trace(m_defaultViewportStyle); | 188 visitor->trace(m_defaultViewportStyle); |
177 visitor->trace(m_defaultQuirksStyle); | 189 visitor->trace(m_defaultQuirksStyle); |
178 visitor->trace(m_defaultPrintStyle); | 190 visitor->trace(m_defaultPrintStyle); |
179 visitor->trace(m_defaultViewSourceStyle); | 191 visitor->trace(m_defaultViewSourceStyle); |
180 visitor->trace(m_defaultXHTMLMobileProfileStyle); | 192 visitor->trace(m_defaultXHTMLMobileProfileStyle); |
181 visitor->trace(m_defaultStyleSheet); | 193 visitor->trace(m_defaultStyleSheet); |
182 visitor->trace(m_viewportStyleSheet); | 194 visitor->trace(m_viewportStyleSheet); |
183 visitor->trace(m_quirksStyleSheet); | 195 visitor->trace(m_quirksStyleSheet); |
184 visitor->trace(m_svgStyleSheet); | 196 visitor->trace(m_svgStyleSheet); |
| 197 visitor->trace(m_mathmlStyleSheet); |
185 visitor->trace(m_mediaControlsStyleSheet); | 198 visitor->trace(m_mediaControlsStyleSheet); |
186 visitor->trace(m_fullscreenStyleSheet); | 199 visitor->trace(m_fullscreenStyleSheet); |
187 } | 200 } |
188 | 201 |
189 } // namespace WebCore | 202 } // namespace WebCore |
OLD | NEW |