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

Side by Side Diff: Source/core/inspector/InspectorStyleSheet.h

Issue 666883002: DevTools: [CSS] cache lineEndings in InspectorStyleSheet (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: get rid of pointer magic Created 6 years, 2 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 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class CSSStyleSheet; 47 class CSSStyleSheet;
48 class Document; 48 class Document;
49 class Element; 49 class Element;
50 class ExceptionState; 50 class ExceptionState;
51 class InspectorPageAgent; 51 class InspectorPageAgent;
52 class InspectorResourceAgent; 52 class InspectorResourceAgent;
53 class InspectorStyleSheetBase; 53 class InspectorStyleSheetBase;
54 54
55 typedef WillBeHeapVector<RefPtrWillBeMember<CSSRule> > CSSRuleVector; 55 typedef WillBeHeapVector<RefPtrWillBeMember<CSSRule> > CSSRuleVector;
56 typedef String ErrorString; 56 typedef String ErrorString;
57 typedef Vector<unsigned> LineEndings;
57 58
58 class InspectorCSSId { 59 class InspectorCSSId {
59 public: 60 public:
60 InspectorCSSId() 61 InspectorCSSId()
61 : m_ordinal(0) 62 : m_ordinal(0)
62 { 63 {
63 } 64 }
64 65
65 InspectorCSSId(const String& styleSheetId, unsigned ordinal) 66 InspectorCSSId(const String& styleSheetId, unsigned ordinal)
66 : m_styleSheetId(styleSheetId) 67 : m_styleSheetId(styleSheetId)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const = 0; 162 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const = 0;
162 163
163 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati on*); 164 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati on*);
164 bool findPropertyByRange(const SourceRange&, InspectorCSSId*, unsigned* prop ertyIndex, bool* overwrite); 165 bool findPropertyByRange(const SourceRange&, InspectorCSSId*, unsigned* prop ertyIndex, bool* overwrite);
165 bool lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber, unsigned* offset); 166 bool lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber, unsigned* offset);
166 167
167 protected: 168 protected:
168 InspectorStyleSheetBase(const String& id, Listener*); 169 InspectorStyleSheetBase(const String& id, Listener*);
169 170
170 Listener* listener() const { return m_listener; } 171 Listener* listener() const { return m_listener; }
171 void fireStyleSheetChanged(); 172 void onStyleSheetTextChanged();
172 PassOwnPtr<Vector<unsigned> > lineEndings(); 173 const LineEndings* lineEndings();
173 174
174 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins pectorCSSId&) = 0; 175 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins pectorCSSId&) = 0;
175 virtual unsigned ruleCount() = 0; 176 virtual unsigned ruleCount() = 0;
176 177
177 // Also accessed by friend class InspectorStyle. 178 // Also accessed by friend class InspectorStyle.
178 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned) const = 0; 179 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned) const = 0;
179 virtual bool ensureParsedDataReady() = 0; 180 virtual bool ensureParsedDataReady() = 0;
180 181
181 private: 182 private:
182 friend class InspectorStyle; 183 friend class InspectorStyle;
183 184
184 String m_id; 185 String m_id;
185 Listener* m_listener; 186 Listener* m_listener;
187 OwnPtr<LineEndings> m_lineEndings;
186 }; 188 };
187 189
188 class InspectorStyleSheet : public InspectorStyleSheetBase { 190 class InspectorStyleSheet : public InspectorStyleSheetBase {
189 public: 191 public:
190 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorPageAgent *, InspectorResourceAgent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleShe et> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String& docu mentURL, Listener*); 192 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorPageAgent *, InspectorResourceAgent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleShe et> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String& docu mentURL, Listener*);
191 193
192 virtual ~InspectorStyleSheet(); 194 virtual ~InspectorStyleSheet();
193 virtual void trace(Visitor*) override; 195 virtual void trace(Visitor*) override;
194 196
195 String finalURL() const; 197 String finalURL() const;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 mutable String m_styleText; 302 mutable String m_styleText;
301 mutable bool m_isStyleTextValid; 303 mutable bool m_isStyleTextValid;
302 }; 304 };
303 305
304 306
305 } // namespace blink 307 } // namespace blink
306 308
307 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); 309 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty);
308 310
309 #endif // !defined(InspectorStyleSheet_h) 311 #endif // !defined(InspectorStyleSheet_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698