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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSStyleSheet.h

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 30 matching lines...) Expand all
41 class StyleSheetContents; 41 class StyleSheetContents;
42 42
43 enum StyleSheetUpdateType { 43 enum StyleSheetUpdateType {
44 PartialRuleUpdate, 44 PartialRuleUpdate,
45 EntireStyleSheetUpdate 45 EntireStyleSheetUpdate
46 }; 46 };
47 47
48 class CORE_EXPORT CSSStyleSheet final : public StyleSheet { 48 class CORE_EXPORT CSSStyleSheet final : public StyleSheet {
49 DEFINE_WRAPPERTYPEINFO(); 49 DEFINE_WRAPPERTYPEINFO();
50 public: 50 public:
51 static PassRefPtrWillBeRawPtr<CSSStyleSheet> create(PassRefPtrWillBeRawPtr<S tyleSheetContents>, CSSImportRule* ownerRule = 0); 51 static RawPtr<CSSStyleSheet> create(RawPtr<StyleSheetContents>, CSSImportRul e* ownerRule = 0);
52 static PassRefPtrWillBeRawPtr<CSSStyleSheet> create(PassRefPtrWillBeRawPtr<S tyleSheetContents>, Node* ownerNode); 52 static RawPtr<CSSStyleSheet> create(RawPtr<StyleSheetContents>, Node* ownerN ode);
53 static PassRefPtrWillBeRawPtr<CSSStyleSheet> createInline(Node*, const KURL& , const TextPosition& startPosition = TextPosition::minimumPosition(), const Str ing& encoding = String()); 53 static RawPtr<CSSStyleSheet> createInline(Node*, const KURL&, const TextPosi tion& startPosition = TextPosition::minimumPosition(), const String& encoding = String());
54 static PassRefPtrWillBeRawPtr<CSSStyleSheet> createInline(PassRefPtrWillBeRa wPtr<StyleSheetContents>, Node* ownerNode, const TextPosition& startPosition = T extPosition::minimumPosition()); 54 static RawPtr<CSSStyleSheet> createInline(RawPtr<StyleSheetContents>, Node* ownerNode, const TextPosition& startPosition = TextPosition::minimumPosition());
55 55
56 ~CSSStyleSheet() override; 56 ~CSSStyleSheet() override;
57 57
58 CSSStyleSheet* parentStyleSheet() const override; 58 CSSStyleSheet* parentStyleSheet() const override;
59 Node* ownerNode() const override { return m_ownerNode; } 59 Node* ownerNode() const override { return m_ownerNode; }
60 MediaList* media() const override; 60 MediaList* media() const override;
61 String href() const override; 61 String href() const override;
62 String title() const override { return m_title; } 62 String title() const override { return m_title; }
63 bool disabled() const override { return m_isDisabled; } 63 bool disabled() const override { return m_isDisabled; }
64 void setDisabled(bool) override; 64 void setDisabled(bool) override;
65 65
66 PassRefPtrWillBeRawPtr<CSSRuleList> cssRules(); 66 RawPtr<CSSRuleList> cssRules();
67 unsigned insertRule(const String& rule, unsigned index, ExceptionState&); 67 unsigned insertRule(const String& rule, unsigned index, ExceptionState&);
68 unsigned insertRule(const String& rule, ExceptionState&); // Deprecated. 68 unsigned insertRule(const String& rule, ExceptionState&); // Deprecated.
69 void deleteRule(unsigned index, ExceptionState&); 69 void deleteRule(unsigned index, ExceptionState&);
70 70
71 // IE Extensions 71 // IE Extensions
72 PassRefPtrWillBeRawPtr<CSSRuleList> rules(); 72 RawPtr<CSSRuleList> rules();
73 int addRule(const String& selector, const String& style, int index, Exceptio nState&); 73 int addRule(const String& selector, const String& style, int index, Exceptio nState&);
74 int addRule(const String& selector, const String& style, ExceptionState&); 74 int addRule(const String& selector, const String& style, ExceptionState&);
75 void removeRule(unsigned index, ExceptionState& exceptionState) { deleteRule (index, exceptionState); } 75 void removeRule(unsigned index, ExceptionState& exceptionState) { deleteRule (index, exceptionState); }
76 76
77 // For CSSRuleList. 77 // For CSSRuleList.
78 unsigned length() const; 78 unsigned length() const;
79 CSSRule* item(unsigned index); 79 CSSRule* item(unsigned index);
80 80
81 void clearOwnerNode() override; 81 void clearOwnerNode() override;
82 82
83 CSSRule* ownerRule() const override { return m_ownerRule; } 83 CSSRule* ownerRule() const override { return m_ownerRule; }
84 KURL baseURL() const override; 84 KURL baseURL() const override;
85 bool isLoading() const override; 85 bool isLoading() const override;
86 86
87 void clearOwnerRule() { m_ownerRule = nullptr; } 87 void clearOwnerRule() { m_ownerRule = nullptr; }
88 Document* ownerDocument() const; 88 Document* ownerDocument() const;
89 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } 89 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
90 void setMediaQueries(PassRefPtrWillBeRawPtr<MediaQuerySet>); 90 void setMediaQueries(RawPtr<MediaQuerySet>);
91 void setTitle(const String& title) { m_title = title; } 91 void setTitle(const String& title) { m_title = title; }
92 // Set by LinkStyle iff CORS-enabled fetch of stylesheet succeeded from this origin. 92 // Set by LinkStyle iff CORS-enabled fetch of stylesheet succeeded from this origin.
93 void setAllowRuleAccessFromOrigin(PassRefPtr<SecurityOrigin> allowedOrigin); 93 void setAllowRuleAccessFromOrigin(PassRefPtr<SecurityOrigin> allowedOrigin);
94 94
95 class RuleMutationScope { 95 class RuleMutationScope {
96 WTF_MAKE_NONCOPYABLE(RuleMutationScope); 96 WTF_MAKE_NONCOPYABLE(RuleMutationScope);
97 STACK_ALLOCATED(); 97 STACK_ALLOCATED();
98 public: 98 public:
99 explicit RuleMutationScope(CSSStyleSheet*); 99 explicit RuleMutationScope(CSSStyleSheet*);
100 explicit RuleMutationScope(CSSRule*); 100 explicit RuleMutationScope(CSSRule*);
101 ~RuleMutationScope(); 101 ~RuleMutationScope();
102 102
103 private: 103 private:
104 RawPtrWillBeMember<CSSStyleSheet> m_styleSheet; 104 Member<CSSStyleSheet> m_styleSheet;
105 }; 105 };
106 106
107 void willMutateRules(); 107 void willMutateRules();
108 void didMutateRules(); 108 void didMutateRules();
109 void didMutate(StyleSheetUpdateType = PartialRuleUpdate); 109 void didMutate(StyleSheetUpdateType = PartialRuleUpdate);
110 110
111 StyleSheetContents* contents() const { return m_contents.get(); } 111 StyleSheetContents* contents() const { return m_contents.get(); }
112 112
113 bool isInline() const { return m_isInlineStylesheet; } 113 bool isInline() const { return m_isInlineStylesheet; }
114 TextPosition startPositionInSource() const { return m_startPosition; } 114 TextPosition startPositionInSource() const { return m_startPosition; }
115 115
116 bool sheetLoaded(); 116 bool sheetLoaded();
117 bool loadCompleted() const { return m_loadCompleted; } 117 bool loadCompleted() const { return m_loadCompleted; }
118 void startLoadingDynamicSheet(); 118 void startLoadingDynamicSheet();
119 void setText(const String&); 119 void setText(const String&);
120 120
121 DECLARE_VIRTUAL_TRACE(); 121 DECLARE_VIRTUAL_TRACE();
122 122
123 private: 123 private:
124 CSSStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>, CSSImportRule* own erRule); 124 CSSStyleSheet(RawPtr<StyleSheetContents>, CSSImportRule* ownerRule);
125 CSSStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>, Node* ownerNode, b ool isInlineStylesheet, const TextPosition& startPosition); 125 CSSStyleSheet(RawPtr<StyleSheetContents>, Node* ownerNode, bool isInlineStyl esheet, const TextPosition& startPosition);
126 126
127 bool isCSSStyleSheet() const override { return true; } 127 bool isCSSStyleSheet() const override { return true; }
128 String type() const override { return "text/css"; } 128 String type() const override { return "text/css"; }
129 129
130 void reattachChildRuleCSSOMWrappers(); 130 void reattachChildRuleCSSOMWrappers();
131 131
132 bool canAccessRules() const; 132 bool canAccessRules() const;
133 133
134 void setLoadCompleted(bool); 134 void setLoadCompleted(bool);
135 135
136 RefPtrWillBeMember<StyleSheetContents> m_contents; 136 Member<StyleSheetContents> m_contents;
137 bool m_isInlineStylesheet; 137 bool m_isInlineStylesheet;
138 bool m_isDisabled; 138 bool m_isDisabled;
139 String m_title; 139 String m_title;
140 RefPtrWillBeMember<MediaQuerySet> m_mediaQueries; 140 Member<MediaQuerySet> m_mediaQueries;
141 141
142 RefPtr<SecurityOrigin> m_allowRuleAccessFromOrigin; 142 RefPtr<SecurityOrigin> m_allowRuleAccessFromOrigin;
143 143
144 RawPtrWillBeMember<Node> m_ownerNode; 144 Member<Node> m_ownerNode;
145 RawPtrWillBeMember<CSSRule> m_ownerRule; 145 Member<CSSRule> m_ownerRule;
146 146
147 TextPosition m_startPosition; 147 TextPosition m_startPosition;
148 bool m_loadCompleted; 148 bool m_loadCompleted;
149 mutable RefPtrWillBeMember<MediaList> m_mediaCSSOMWrapper; 149 mutable Member<MediaList> m_mediaCSSOMWrapper;
150 mutable WillBeHeapVector<RefPtrWillBeMember<CSSRule>> m_childRuleCSSOMWrappe rs; 150 mutable HeapVector<Member<CSSRule>> m_childRuleCSSOMWrappers;
151 mutable OwnPtrWillBeMember<CSSRuleList> m_ruleListCSSOMWrapper; 151 mutable Member<CSSRuleList> m_ruleListCSSOMWrapper;
152 }; 152 };
153 153
154 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSStyleSheet* sheet) 154 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSStyleSheet* sheet)
155 : m_styleSheet(sheet) 155 : m_styleSheet(sheet)
156 { 156 {
157 if (m_styleSheet) 157 if (m_styleSheet)
158 m_styleSheet->willMutateRules(); 158 m_styleSheet->willMutateRules();
159 } 159 }
160 160
161 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule) 161 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule)
162 : m_styleSheet(rule ? rule->parentStyleSheet() : 0) 162 : m_styleSheet(rule ? rule->parentStyleSheet() : 0)
163 { 163 {
164 if (m_styleSheet) 164 if (m_styleSheet)
165 m_styleSheet->willMutateRules(); 165 m_styleSheet->willMutateRules();
166 } 166 }
167 167
168 inline CSSStyleSheet::RuleMutationScope::~RuleMutationScope() 168 inline CSSStyleSheet::RuleMutationScope::~RuleMutationScope()
169 { 169 {
170 if (m_styleSheet) 170 if (m_styleSheet)
171 m_styleSheet->didMutateRules(); 171 m_styleSheet->didMutateRules();
172 } 172 }
173 173
174 DEFINE_TYPE_CASTS(CSSStyleSheet, StyleSheet, sheet, sheet->isCSSStyleSheet(), sh eet.isCSSStyleSheet()); 174 DEFINE_TYPE_CASTS(CSSStyleSheet, StyleSheet, sheet, sheet->isCSSStyleSheet(), sh eet.isCSSStyleSheet());
175 175
176 } // namespace blink 176 } // namespace blink
177 177
178 #endif 178 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleRule.cpp ('k') | third_party/WebKit/Source/core/css/CSSStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698