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

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

Issue 1482683002: Trial: build trunk with Oilpan everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: have RemoteDOMWindow keep a weak ref back to its RemoteFrame Created 5 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
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 28 matching lines...) Expand all
39 #include "core/layout/LayoutTheme.h" 39 #include "core/layout/LayoutTheme.h"
40 #include "platform/PlatformResourceLoader.h" 40 #include "platform/PlatformResourceLoader.h"
41 #include "wtf/LeakAnnotations.h" 41 #include "wtf/LeakAnnotations.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 using namespace HTMLNames; 45 using namespace HTMLNames;
46 46
47 CSSDefaultStyleSheets& CSSDefaultStyleSheets::instance() 47 CSSDefaultStyleSheets& CSSDefaultStyleSheets::instance()
48 { 48 {
49 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<CSSDefaultStyleSheets>, cssDefaul tStyleSheets, (adoptPtrWillBeNoop(new CSSDefaultStyleSheets()))); 49 WTF_ANNOTATE_SCOPED_MEMORY_LEAK;
50 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<CSSDefaultStyleSheets>, cssDefaul tStyleSheets, (adoptPtrWillBeNoop(new CSSDefaultStyleSheets)));
haraken 2015/11/30 01:48:47 What happens if we insert WTF_ANNOTATE_SCOPED_MEMO
sof 2015/11/30 21:53:39 I think it will mostly be non-harmful, with or wit
50 return *cssDefaultStyleSheets; 51 return *cssDefaultStyleSheets;
51 } 52 }
52 53
53 static const MediaQueryEvaluator& screenEval() 54 static const MediaQueryEvaluator& screenEval()
54 { 55 {
55 DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticScreenEval, ("screen")) ; 56 DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticScreenEval, ("screen")) ;
56 return staticScreenEval; 57 return staticScreenEval;
57 } 58 }
58 59
59 static const MediaQueryEvaluator& printEval() 60 static const MediaQueryEvaluator& printEval()
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 100
100 // Quirks-mode rules. 101 // Quirks-mode rules.
101 String quirksRules = loadResourceAsASCIIString("quirks.css") + LayoutTheme:: theme().extraQuirksStyleSheet(); 102 String quirksRules = loadResourceAsASCIIString("quirks.css") + LayoutTheme:: theme().extraQuirksStyleSheet();
102 m_quirksStyleSheet = parseUASheet(quirksRules); 103 m_quirksStyleSheet = parseUASheet(quirksRules);
103 m_defaultQuirksStyle->addRulesFromSheet(quirksStyleSheet(), screenEval()); 104 m_defaultQuirksStyle->addRulesFromSheet(quirksStyleSheet(), screenEval());
104 } 105 }
105 106
106 RuleSet* CSSDefaultStyleSheets::defaultViewSourceStyle() 107 RuleSet* CSSDefaultStyleSheets::defaultViewSourceStyle()
107 { 108 {
108 if (!m_defaultViewSourceStyle) { 109 if (!m_defaultViewSourceStyle) {
110 WTF_ANNOTATE_SCOPED_MEMORY_LEAK;
109 m_defaultViewSourceStyle = RuleSet::create(); 111 m_defaultViewSourceStyle = RuleSet::create();
110 // Loaded stylesheet is leaked on purpose. 112 // Loaded stylesheet is leaked on purpose.
111 RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadRes ourceAsASCIIString("view-source.css")); 113 RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadRes ourceAsASCIIString("view-source.css"));
112 m_defaultViewSourceStyle->addRulesFromSheet(stylesheet.release().leakRef (), screenEval()); 114 m_defaultViewSourceStyle->addRulesFromSheet(stylesheet.release().leakRef (), screenEval());
113 } 115 }
114 return m_defaultViewSourceStyle.get(); 116 return m_defaultViewSourceStyle.get();
115 } 117 }
116 118
117 RuleSet* CSSDefaultStyleSheets::defaultXHTMLMobileProfileStyle() 119 RuleSet* CSSDefaultStyleSheets::defaultXHTMLMobileProfileStyle()
118 { 120 {
119 if (!m_defaultXHTMLMobileProfileStyle) { 121 if (!m_defaultXHTMLMobileProfileStyle) {
122 WTF_ANNOTATE_SCOPED_MEMORY_LEAK;
120 m_defaultXHTMLMobileProfileStyle = RuleSet::create(); 123 m_defaultXHTMLMobileProfileStyle = RuleSet::create();
121 // Loaded stylesheet is leaked on purpose. 124 // Loaded stylesheet is leaked on purpose.
122 RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadRes ourceAsASCIIString("xhtmlmp.css")); 125 RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadRes ourceAsASCIIString("xhtmlmp.css"));
123 m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet.release() .leakRef(), screenEval()); 126 m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet.release() .leakRef(), screenEval());
124 } 127 }
125 return m_defaultXHTMLMobileProfileStyle.get(); 128 return m_defaultXHTMLMobileProfileStyle.get();
126 } 129 }
127 130
128 RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle() 131 RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle()
129 { 132 {
130 if (!m_defaultMobileViewportStyle) { 133 if (!m_defaultMobileViewportStyle) {
134 WTF_ANNOTATE_SCOPED_MEMORY_LEAK;
131 m_defaultMobileViewportStyle = RuleSet::create(); 135 m_defaultMobileViewportStyle = RuleSet::create();
132 m_mobileViewportStyleSheet = parseUASheet(loadResourceAsASCIIString("vie wportAndroid.css")); 136 m_mobileViewportStyleSheet = parseUASheet(loadResourceAsASCIIString("vie wportAndroid.css"));
133 m_defaultMobileViewportStyle->addRulesFromSheet(m_mobileViewportStyleShe et.get(), screenEval()); 137 m_defaultMobileViewportStyle->addRulesFromSheet(m_mobileViewportStyleShe et.get(), screenEval());
134 } 138 }
135 return m_defaultMobileViewportStyle.get(); 139 return m_defaultMobileViewportStyle.get();
136 } 140 }
137 141
138 void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(const Element& el ement, bool& changedDefaultStyle) 142 void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(const Element& el ement, bool& changedDefaultStyle)
139 { 143 {
140 // FIXME: We should assert that the sheet only styles SVG elements. 144 // FIXME: We should assert that the sheet only styles SVG elements.
141 if (element.isSVGElement() && !m_svgStyleSheet) { 145 if (element.isSVGElement() && !m_svgStyleSheet) {
146 WTF_ANNOTATE_SCOPED_MEMORY_LEAK;
142 m_svgStyleSheet = parseUASheet(loadResourceAsASCIIString("svg.css")); 147 m_svgStyleSheet = parseUASheet(loadResourceAsASCIIString("svg.css"));
143 m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval()); 148 m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval());
144 m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval()); 149 m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval());
145 changedDefaultStyle = true; 150 changedDefaultStyle = true;
146 } 151 }
147 152
148 // FIXME: We should assert that the sheet only styles MathML elements. 153 // FIXME: We should assert that the sheet only styles MathML elements.
149 if (element.namespaceURI() == MathMLNames::mathmlNamespaceURI 154 if (element.namespaceURI() == MathMLNames::mathmlNamespaceURI
150 && !m_mathmlStyleSheet) { 155 && !m_mathmlStyleSheet) {
151 m_mathmlStyleSheet = parseUASheet(loadResourceAsASCIIString("mathml.css" )); 156 m_mathmlStyleSheet = parseUASheet(loadResourceAsASCIIString("mathml.css" ));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 visitor->trace(m_defaultStyleSheet); 196 visitor->trace(m_defaultStyleSheet);
192 visitor->trace(m_mobileViewportStyleSheet); 197 visitor->trace(m_mobileViewportStyleSheet);
193 visitor->trace(m_quirksStyleSheet); 198 visitor->trace(m_quirksStyleSheet);
194 visitor->trace(m_svgStyleSheet); 199 visitor->trace(m_svgStyleSheet);
195 visitor->trace(m_mathmlStyleSheet); 200 visitor->trace(m_mathmlStyleSheet);
196 visitor->trace(m_mediaControlsStyleSheet); 201 visitor->trace(m_mediaControlsStyleSheet);
197 visitor->trace(m_fullscreenStyleSheet); 202 visitor->trace(m_fullscreenStyleSheet);
198 } 203 }
199 204
200 } // namespace blink 205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698