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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLToken.h

Issue 2386893002: Reformat comments in core/html/parser (Closed)
Patch Set: self review Created 4 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) 2013 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2013 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 private: 135 private:
136 Vector<UChar, 32> m_name; 136 Vector<UChar, 32> m_name;
137 Vector<UChar, 32> m_value; 137 Vector<UChar, 32> m_value;
138 Range m_nameRange; 138 Range m_nameRange;
139 Range m_valueRange; 139 Range m_valueRange;
140 }; 140 };
141 141
142 typedef Vector<Attribute, 10> AttributeList; 142 typedef Vector<Attribute, 10> AttributeList;
143 143
144 // By using an inline capacity of 256, we avoid spilling over into an malloced buffer 144 // By using an inline capacity of 256, we avoid spilling over into an malloced
145 // approximately 99% of the time based on a non-scientific browse around a num ber of 145 // buffer approximately 99% of the time based on a non-scientific browse
146 // popular web sites on 23 May 2013. 146 // around a number of popular web sites on 23 May 2013.
147 typedef Vector<UChar, 256> DataVector; 147 typedef Vector<UChar, 256> DataVector;
148 148
149 HTMLToken() { clear(); } 149 HTMLToken() { clear(); }
150 150
151 void clear() { 151 void clear() {
152 m_type = Uninitialized; 152 m_type = Uninitialized;
153 m_range.clear(); 153 m_range.clear();
154 m_range.start = 0; 154 m_range.start = 0;
155 m_baseOffset = 0; 155 m_baseOffset = 0;
156 // Don't call Vector::clear() as that would destroy the 156 // Don't call Vector::clear() as that would destroy the
157 // alloced VectorBuffer. If the innerHTML'd content has 157 // alloced VectorBuffer. If the innerHTML'd content has
158 // two 257 character text nodes in a row, we'll needlessly 158 // two 257 character text nodes in a row, we'll needlessly
159 // thrash malloc. When we finally finish the parse the 159 // thrash malloc. When we finally finish the parse the
160 // HTMLToken will be destroyed and the VectorBuffer released. 160 // HTMLToken will be destroyed and the VectorBuffer released.
161 m_data.shrink(0); 161 m_data.shrink(0);
162 m_orAllData = 0; 162 m_orAllData = 0;
163 } 163 }
164 164
165 bool isUninitialized() { return m_type == Uninitialized; } 165 bool isUninitialized() { return m_type == Uninitialized; }
166 TokenType type() const { return m_type; } 166 TokenType type() const { return m_type; }
167 167
168 void makeEndOfFile() { 168 void makeEndOfFile() {
169 ASSERT(m_type == Uninitialized); 169 ASSERT(m_type == Uninitialized);
170 m_type = EndOfFile; 170 m_type = EndOfFile;
171 } 171 }
172 172
173 /* Range and offset methods exposed for HTMLSourceTracker and HTMLViewSourcePa rser */ 173 // Range and offset methods exposed for HTMLSourceTracker and
174 // HTMLViewSourceParser.
174 int startIndex() const { return m_range.start; } 175 int startIndex() const { return m_range.start; }
175 int endIndex() const { return m_range.end; } 176 int endIndex() const { return m_range.end; }
176 177
177 void setBaseOffset(int offset) { m_baseOffset = offset; } 178 void setBaseOffset(int offset) { m_baseOffset = offset; }
178 179
179 void end(int endOffset) { m_range.end = endOffset - m_baseOffset; } 180 void end(int endOffset) { m_range.end = endOffset - m_baseOffset; }
180 181
181 const DataVector& data() const { 182 const DataVector& data() const {
182 ASSERT(m_type == Character || m_type == Comment || m_type == StartTag || 183 ASSERT(m_type == Character || m_type == Comment || m_type == StartTag ||
183 m_type == EndTag); 184 m_type == EndTag);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 std::unique_ptr<DoctypeData> m_doctypeData; 455 std::unique_ptr<DoctypeData> m_doctypeData;
455 }; 456 };
456 457
457 #ifndef NDEBUG 458 #ifndef NDEBUG
458 const char* toString(HTMLToken::TokenType); 459 const char* toString(HTMLToken::TokenType);
459 #endif 460 #endif
460 461
461 } // namespace blink 462 } // namespace blink
462 463
463 #endif 464 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698