| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 m_defaultXHTMLMobileProfileStyle = RuleSet::create(); | 145 m_defaultXHTMLMobileProfileStyle = RuleSet::create(); |
| 146 // Loaded stylesheet is leaked on purpose. | 146 // Loaded stylesheet is leaked on purpose. |
| 147 RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(xhtmlmp
Css, sizeof(xhtmlmpCss)); | 147 RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(xhtmlmp
Css, sizeof(xhtmlmpCss)); |
| 148 m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet.release()
.leakRef(), screenEval()); | 148 m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet.release()
.leakRef(), screenEval()); |
| 149 } | 149 } |
| 150 return m_defaultXHTMLMobileProfileStyle.get(); | 150 return m_defaultXHTMLMobileProfileStyle.get(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
bool& changedDefaultStyle) | 153 void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
bool& changedDefaultStyle) |
| 154 { | 154 { |
| 155 // FIXME: We should assert that the sheet only styles SVG elements. | 155 if (element->isSVGElement()) { |
| 156 if (element->isSVGElement() && !m_svgStyleSheet) { | 156 // FIXME: We should assert that the sheet only styles SVG elements. |
| 157 m_svgStyleSheet = parseUASheet(svgCss, sizeof(svgCss)); | 157 if (!m_svgStyleSheet) { |
| 158 m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval()); | 158 m_svgStyleSheet = parseUASheet(svgCss, sizeof(svgCss)); |
| 159 m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval()); | 159 m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval()); |
| 160 changedDefaultStyle = true; | 160 m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval())
; |
| 161 } | 161 changedDefaultStyle = true; |
| 162 | 162 } |
| 163 // FIXME: We should assert that the sheet only styles MathML elements. | 163 } else if (element->namespaceURI() == MathMLNames::mathmlNamespaceURI) { |
| 164 if (element->namespaceURI() == MathMLNames::mathmlNamespaceURI | 164 // FIXME: We should assert that the sheet only styles MathML elements. |
| 165 && !m_mathmlStyleSheet) { | 165 if (!m_mathmlStyleSheet) { |
| 166 m_mathmlStyleSheet = parseUASheet(mathmlCss, sizeof(mathmlCss)); | 166 m_mathmlStyleSheet = parseUASheet(mathmlCss, sizeof(mathmlCss)); |
| 167 m_defaultStyle->addRulesFromSheet(mathmlStyleSheet(), screenEval()); | 167 m_defaultStyle->addRulesFromSheet(mathmlStyleSheet(), screenEval()); |
| 168 m_defaultPrintStyle->addRulesFromSheet(mathmlStyleSheet(), printEval()); | 168 m_defaultPrintStyle->addRulesFromSheet(mathmlStyleSheet(), printEval
()); |
| 169 changedDefaultStyle = true; | 169 changedDefaultStyle = true; |
| 170 } | 170 } |
| 171 | 171 } else if (isHTMLVideoElement(*element) || isHTMLAudioElement(*element)) { |
| 172 // FIXME: We should assert that this sheet only contains rules for <video> a
nd <audio>. | 172 // FIXME: We should assert that this sheet only contains rules for <vide
o> and <audio>. |
| 173 if (!m_mediaControlsStyleSheet && (isHTMLVideoElement(*element) || isHTMLAud
ioElement(*element))) { | 173 if (!m_mediaControlsStyleSheet) { |
| 174 String mediaRules = String(mediaControlsCss, sizeof(mediaControlsCss)) +
RenderTheme::theme().extraMediaControlsStyleSheet(); | 174 String mediaRules = String(mediaControlsCss, sizeof(mediaControlsCss
)) + RenderTheme::theme().extraMediaControlsStyleSheet(); |
| 175 m_mediaControlsStyleSheet = parseUASheet(mediaRules); | 175 m_mediaControlsStyleSheet = parseUASheet(mediaRules); |
| 176 m_defaultStyle->addRulesFromSheet(mediaControlsStyleSheet(), screenEval(
)); | 176 m_defaultStyle->addRulesFromSheet(mediaControlsStyleSheet(), screenE
val()); |
| 177 m_defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet(), printE
val()); | 177 m_defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet(), pr
intEval()); |
| 178 changedDefaultStyle = true; | 178 changedDefaultStyle = true; |
| 179 } |
| 179 } | 180 } |
| 180 | 181 |
| 181 // FIXME: This only works because we Force recalc the entire document so the
new sheet | 182 // FIXME: This only works because we Force recalc the entire document so the
new sheet |
| 182 // is loaded for <html> and the correct styles apply to everyone. | 183 // is loaded for <html> and the correct styles apply to everyone. |
| 183 if (!m_fullscreenStyleSheet && Fullscreen::isFullScreen(element->document())
) { | 184 if (!m_fullscreenStyleSheet && Fullscreen::isFullScreen(element->document())
) { |
| 184 String fullscreenRules = String(fullscreenCss, sizeof(fullscreenCss)) +
RenderTheme::theme().extraFullScreenStyleSheet(); | 185 String fullscreenRules = String(fullscreenCss, sizeof(fullscreenCss)) +
RenderTheme::theme().extraFullScreenStyleSheet(); |
| 185 m_fullscreenStyleSheet = parseUASheet(fullscreenRules); | 186 m_fullscreenStyleSheet = parseUASheet(fullscreenRules); |
| 186 m_defaultStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEval()); | 187 m_defaultStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEval()); |
| 187 m_defaultQuirksStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEv
al()); | 188 m_defaultQuirksStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEv
al()); |
| 188 changedDefaultStyle = true; | 189 changedDefaultStyle = true; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 204 visitor->trace(m_defaultStyleSheet); | 205 visitor->trace(m_defaultStyleSheet); |
| 205 visitor->trace(m_viewportStyleSheet); | 206 visitor->trace(m_viewportStyleSheet); |
| 206 visitor->trace(m_quirksStyleSheet); | 207 visitor->trace(m_quirksStyleSheet); |
| 207 visitor->trace(m_svgStyleSheet); | 208 visitor->trace(m_svgStyleSheet); |
| 208 visitor->trace(m_mathmlStyleSheet); | 209 visitor->trace(m_mathmlStyleSheet); |
| 209 visitor->trace(m_mediaControlsStyleSheet); | 210 visitor->trace(m_mediaControlsStyleSheet); |
| 210 visitor->trace(m_fullscreenStyleSheet); | 211 visitor->trace(m_fullscreenStyleSheet); |
| 211 } | 212 } |
| 212 | 213 |
| 213 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |