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

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

Issue 2282303002: [test] lazily parse css style rules
Patch Set: use string pool Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StyleRule.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2006, 2008, 2012, 2013 Apple Inc. All rights reserved. 4 * Copyright (C) 2002, 2006, 2008, 2012, 2013 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #ifndef StyleRule_h 22 #ifndef StyleRule_h
23 #define StyleRule_h 23 #define StyleRule_h
24 24
25 #include "core/CoreExport.h" 25 #include "core/CoreExport.h"
26 #include "core/css/CSSSelectorList.h" 26 #include "core/css/CSSSelectorList.h"
27 #include "core/css/MediaList.h" 27 #include "core/css/MediaList.h"
28 #include "core/css/StylePropertySet.h" 28 #include "core/css/StylePropertySet.h"
29 #include "core/css/parser/CSSParserTokenRange.h"
29 #include "platform/heap/Handle.h" 30 #include "platform/heap/Handle.h"
30 #include "wtf/RefPtr.h" 31 #include "wtf/RefPtr.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 class CSSRule; 35 class CSSRule;
35 class CSSStyleSheet; 36 class CSSStyleSheet;
36 37
37 class CORE_EXPORT StyleRuleBase : public GarbageCollectedFinalized<StyleRuleBase > { 38 class CORE_EXPORT StyleRuleBase : public GarbageCollectedFinalized<StyleRuleBase > {
38 public: 39 public:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 unsigned m_type : 5; 91 unsigned m_type : 5;
91 }; 92 };
92 93
93 class CORE_EXPORT StyleRule : public StyleRuleBase { 94 class CORE_EXPORT StyleRule : public StyleRuleBase {
94 public: 95 public:
95 // Adopts the selector list 96 // Adopts the selector list
96 static StyleRule* create(CSSSelectorList selectorList, StylePropertySet* pro perties) 97 static StyleRule* create(CSSSelectorList selectorList, StylePropertySet* pro perties)
97 { 98 {
98 return new StyleRule(std::move(selectorList), properties); 99 return new StyleRule(std::move(selectorList), properties);
99 } 100 }
101 static StyleRule* createLazy(CSSSelectorList selectorList, CSSParserTokenRan ge tokens, const CSSParserContext* context)
102 {
103 return new StyleRule(std::move(selectorList), tokens, context);
104 }
100 105
101 ~StyleRule(); 106 ~StyleRule();
102 107
103 const CSSSelectorList& selectorList() const { return m_selectorList; } 108 const CSSSelectorList& selectorList() const { return m_selectorList; }
104 const StylePropertySet& properties() const { return *m_properties; } 109 const StylePropertySet& properties() const;
105 MutableStylePropertySet& mutableProperties(); 110 MutableStylePropertySet& mutableProperties();
106 111
107 void wrapperAdoptSelectorList(CSSSelectorList selectors) { m_selectorList = std::move(selectors); } 112 void wrapperAdoptSelectorList(CSSSelectorList selectors) { m_selectorList = std::move(selectors); }
108 113
109 StyleRule* copy() const { return new StyleRule(*this); } 114 StyleRule* copy() const { return new StyleRule(*this); }
110 115
111 static unsigned averageSizeInBytes(); 116 static unsigned averageSizeInBytes();
112 117
113 DECLARE_TRACE_AFTER_DISPATCH(); 118 DECLARE_TRACE_AFTER_DISPATCH();
114 119
115 private: 120 private:
116 StyleRule(CSSSelectorList, StylePropertySet*); 121 StyleRule(CSSSelectorList, StylePropertySet*);
122 StyleRule(CSSSelectorList, CSSParserTokenRange block, const CSSParserContext *);
117 StyleRule(const StyleRule&); 123 StyleRule(const StyleRule&);
118 124
119 Member<StylePropertySet> m_properties; // Cannot be null.
120 CSSSelectorList m_selectorList; 125 CSSSelectorList m_selectorList;
126
127 mutable Member<StylePropertySet> m_properties;
128 mutable Vector<CSSParserToken> m_lazyTokens;
129 const CSSParserContext* m_context;
121 }; 130 };
122 131
123 class StyleRuleFontFace : public StyleRuleBase { 132 class StyleRuleFontFace : public StyleRuleBase {
124 public: 133 public:
125 static StyleRuleFontFace* create(StylePropertySet* properties) 134 static StyleRuleFontFace* create(StylePropertySet* properties)
126 { 135 {
127 return new StyleRuleFontFace(properties); 136 return new StyleRuleFontFace(properties);
128 } 137 }
129 138
130 ~StyleRuleFontFace(); 139 ~StyleRuleFontFace();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); 279 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace);
271 DEFINE_STYLE_RULE_TYPE_CASTS(Page); 280 DEFINE_STYLE_RULE_TYPE_CASTS(Page);
272 DEFINE_STYLE_RULE_TYPE_CASTS(Media); 281 DEFINE_STYLE_RULE_TYPE_CASTS(Media);
273 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); 282 DEFINE_STYLE_RULE_TYPE_CASTS(Supports);
274 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); 283 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport);
275 DEFINE_STYLE_RULE_TYPE_CASTS(Charset); 284 DEFINE_STYLE_RULE_TYPE_CASTS(Charset);
276 285
277 } // namespace blink 286 } // namespace blink
278 287
279 #endif // StyleRule_h 288 #endif // StyleRule_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StyleRule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698