| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/layout/LayoutTheme.h" | 38 #include "core/layout/LayoutTheme.h" |
| 39 #include "platform/PlatformResourceLoader.h" | 39 #include "platform/PlatformResourceLoader.h" |
| 40 #include "wtf/LeakAnnotations.h" | 40 #include "wtf/LeakAnnotations.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 45 | 45 |
| 46 CSSDefaultStyleSheets& CSSDefaultStyleSheets::instance() | 46 CSSDefaultStyleSheets& CSSDefaultStyleSheets::instance() |
| 47 { | 47 { |
| 48 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<CSSDefaultStyleSheets>, cssDefaul
tStyleSheets, (adoptPtrWillBeNoop(new CSSDefaultStyleSheets()))); | 48 DEFINE_STATIC_LOCAL(Persistent<CSSDefaultStyleSheets>, cssDefaultStyleSheets
, ((new CSSDefaultStyleSheets()))); |
| 49 return *cssDefaultStyleSheets; | 49 return *cssDefaultStyleSheets; |
| 50 } | 50 } |
| 51 | 51 |
| 52 static const MediaQueryEvaluator& screenEval() | 52 static const MediaQueryEvaluator& screenEval() |
| 53 { | 53 { |
| 54 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<MediaQueryEvaluator>, staticScree
nEval, (adoptPtrWillBeNoop (new MediaQueryEvaluator("screen")))); | 54 DEFINE_STATIC_LOCAL(Persistent<MediaQueryEvaluator>, staticScreenEval, ((new
MediaQueryEvaluator("screen")))); |
| 55 return *staticScreenEval; | 55 return *staticScreenEval; |
| 56 } | 56 } |
| 57 | 57 |
| 58 static const MediaQueryEvaluator& printEval() | 58 static const MediaQueryEvaluator& printEval() |
| 59 { | 59 { |
| 60 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<MediaQueryEvaluator>, staticPrint
Eval, (adoptPtrWillBeNoop (new MediaQueryEvaluator("print")))); | 60 DEFINE_STATIC_LOCAL(Persistent<MediaQueryEvaluator>, staticPrintEval, ((new
MediaQueryEvaluator("print")))); |
| 61 return *staticPrintEval; | 61 return *staticPrintEval; |
| 62 } | 62 } |
| 63 | 63 |
| 64 static PassRefPtrWillBeRawPtr<StyleSheetContents> parseUASheet(const String& str
) | 64 static RawPtr<StyleSheetContents> parseUASheet(const String& str) |
| 65 { | 65 { |
| 66 RefPtrWillBeRawPtr<StyleSheetContents> sheet = StyleSheetContents::create(CS
SParserContext(UASheetMode, 0)); | 66 RawPtr<StyleSheetContents> sheet = StyleSheetContents::create(CSSParserConte
xt(UASheetMode, 0)); |
| 67 sheet->parseString(str); | 67 sheet->parseString(str); |
| 68 // User Agent stylesheets are parsed once for the lifetime of the renderer | 68 // User Agent stylesheets are parsed once for the lifetime of the renderer |
| 69 // process and are intentionally leaked. | 69 // process and are intentionally leaked. |
| 70 LEAK_SANITIZER_IGNORE_OBJECT(sheet.get()); | 70 LEAK_SANITIZER_IGNORE_OBJECT(sheet.get()); |
| 71 return sheet.release(); | 71 return sheet.release(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 CSSDefaultStyleSheets::CSSDefaultStyleSheets() | 74 CSSDefaultStyleSheets::CSSDefaultStyleSheets() |
| 75 : m_defaultStyle(nullptr) | 75 : m_defaultStyle(nullptr) |
| 76 , m_defaultMobileViewportStyle(nullptr) | 76 , m_defaultMobileViewportStyle(nullptr) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 100 String quirksRules = loadResourceAsASCIIString("quirks.css") + LayoutTheme::
theme().extraQuirksStyleSheet(); | 100 String quirksRules = loadResourceAsASCIIString("quirks.css") + LayoutTheme::
theme().extraQuirksStyleSheet(); |
| 101 m_quirksStyleSheet = parseUASheet(quirksRules); | 101 m_quirksStyleSheet = parseUASheet(quirksRules); |
| 102 m_defaultQuirksStyle->addRulesFromSheet(quirksStyleSheet(), screenEval()); | 102 m_defaultQuirksStyle->addRulesFromSheet(quirksStyleSheet(), screenEval()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 RuleSet* CSSDefaultStyleSheets::defaultViewSourceStyle() | 105 RuleSet* CSSDefaultStyleSheets::defaultViewSourceStyle() |
| 106 { | 106 { |
| 107 if (!m_defaultViewSourceStyle) { | 107 if (!m_defaultViewSourceStyle) { |
| 108 m_defaultViewSourceStyle = RuleSet::create(); | 108 m_defaultViewSourceStyle = RuleSet::create(); |
| 109 // Loaded stylesheet is leaked on purpose. | 109 // Loaded stylesheet is leaked on purpose. |
| 110 RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadRes
ourceAsASCIIString("view-source.css")); | 110 RawPtr<StyleSheetContents> stylesheet = parseUASheet(loadResourceAsASCII
String("view-source.css")); |
| 111 m_defaultViewSourceStyle->addRulesFromSheet(stylesheet.release().leakRef
(), screenEval()); | 111 m_defaultViewSourceStyle->addRulesFromSheet(stylesheet.release().leakRef
(), screenEval()); |
| 112 } | 112 } |
| 113 return m_defaultViewSourceStyle.get(); | 113 return m_defaultViewSourceStyle.get(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 RuleSet* CSSDefaultStyleSheets::defaultXHTMLMobileProfileStyle() | 116 RuleSet* CSSDefaultStyleSheets::defaultXHTMLMobileProfileStyle() |
| 117 { | 117 { |
| 118 if (!m_defaultXHTMLMobileProfileStyle) { | 118 if (!m_defaultXHTMLMobileProfileStyle) { |
| 119 m_defaultXHTMLMobileProfileStyle = RuleSet::create(); | 119 m_defaultXHTMLMobileProfileStyle = RuleSet::create(); |
| 120 // Loaded stylesheet is leaked on purpose. | 120 // Loaded stylesheet is leaked on purpose. |
| 121 RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadRes
ourceAsASCIIString("xhtmlmp.css")); | 121 RawPtr<StyleSheetContents> stylesheet = parseUASheet(loadResourceAsASCII
String("xhtmlmp.css")); |
| 122 m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet.release()
.leakRef(), screenEval()); | 122 m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet.release()
.leakRef(), screenEval()); |
| 123 } | 123 } |
| 124 return m_defaultXHTMLMobileProfileStyle.get(); | 124 return m_defaultXHTMLMobileProfileStyle.get(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle() | 127 RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle() |
| 128 { | 128 { |
| 129 if (!m_defaultMobileViewportStyle) { | 129 if (!m_defaultMobileViewportStyle) { |
| 130 m_defaultMobileViewportStyle = RuleSet::create(); | 130 m_defaultMobileViewportStyle = RuleSet::create(); |
| 131 m_mobileViewportStyleSheet = parseUASheet(loadResourceAsASCIIString("vie
wportAndroid.css")); | 131 m_mobileViewportStyleSheet = parseUASheet(loadResourceAsASCIIString("vie
wportAndroid.css")); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 visitor->trace(m_defaultStyleSheet); | 190 visitor->trace(m_defaultStyleSheet); |
| 191 visitor->trace(m_mobileViewportStyleSheet); | 191 visitor->trace(m_mobileViewportStyleSheet); |
| 192 visitor->trace(m_quirksStyleSheet); | 192 visitor->trace(m_quirksStyleSheet); |
| 193 visitor->trace(m_svgStyleSheet); | 193 visitor->trace(m_svgStyleSheet); |
| 194 visitor->trace(m_mathmlStyleSheet); | 194 visitor->trace(m_mathmlStyleSheet); |
| 195 visitor->trace(m_mediaControlsStyleSheet); | 195 visitor->trace(m_mediaControlsStyleSheet); |
| 196 visitor->trace(m_fullscreenStyleSheet); | 196 visitor->trace(m_fullscreenStyleSheet); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |