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

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

Issue 2755493004: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in core/css/ (Closed)
Patch Set: All windows error are Resolved now. Created 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSParserTokenRange.h" 5 #include "core/css/parser/CSSParserTokenRange.h"
6 6
7 #include "wtf/StaticConstructors.h" 7 #include "wtf/StaticConstructors.h"
8 #include "wtf/text/StringBuilder.h" 8 #include "wtf/text/StringBuilder.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 DEFINE_GLOBAL(CSSParserToken, staticEOFToken); 12 DEFINE_GLOBAL(CSSParserToken, staticEOFToken);
13 13
14 void CSSParserTokenRange::initStaticEOFToken() { 14 void CSSParserTokenRange::initStaticEOFToken() {
15 new ((void*)&staticEOFToken) CSSParserToken(EOFToken); 15 new ((void*)&staticEOFToken) CSSParserToken(EOFToken);
16 } 16 }
17 17
18 CSSParserTokenRange CSSParserTokenRange::makeSubRange( 18 CSSParserTokenRange CSSParserTokenRange::makeSubRange(
19 const CSSParserToken* first, 19 const CSSParserToken* first,
20 const CSSParserToken* last) const { 20 const CSSParserToken* last) const {
21 if (first == &staticEOFToken) 21 if (first == &staticEOFToken)
22 first = m_last; 22 first = m_last;
23 if (last == &staticEOFToken) 23 if (last == &staticEOFToken)
24 last = m_last; 24 last = m_last;
25 ASSERT(first <= last); 25 DCHECK_LE(first, last);
26 return CSSParserTokenRange(first, last); 26 return CSSParserTokenRange(first, last);
27 } 27 }
28 28
29 CSSParserTokenRange CSSParserTokenRange::consumeBlock() { 29 CSSParserTokenRange CSSParserTokenRange::consumeBlock() {
30 ASSERT(peek().getBlockType() == CSSParserToken::BlockStart); 30 DCHECK_EQ(peek().getBlockType(), CSSParserToken::BlockStart);
31 const CSSParserToken* start = &peek() + 1; 31 const CSSParserToken* start = &peek() + 1;
32 unsigned nestingLevel = 0; 32 unsigned nestingLevel = 0;
33 do { 33 do {
34 const CSSParserToken& token = consume(); 34 const CSSParserToken& token = consume();
35 if (token.getBlockType() == CSSParserToken::BlockStart) 35 if (token.getBlockType() == CSSParserToken::BlockStart)
36 nestingLevel++; 36 nestingLevel++;
37 else if (token.getBlockType() == CSSParserToken::BlockEnd) 37 else if (token.getBlockType() == CSSParserToken::BlockEnd)
38 nestingLevel--; 38 nestingLevel--;
39 } while (nestingLevel && m_first < m_last); 39 } while (nestingLevel && m_first < m_last);
40 40
(...skipping 20 matching lines...) Expand all
61 // We're supposed to insert comments between certain pairs of token types 61 // We're supposed to insert comments between certain pairs of token types
62 // as per spec, but since this is currently only used for @supports CSSOM 62 // as per spec, but since this is currently only used for @supports CSSOM
63 // we just get these cases wrong and avoid the additional complexity. 63 // we just get these cases wrong and avoid the additional complexity.
64 StringBuilder builder; 64 StringBuilder builder;
65 for (const CSSParserToken* it = m_first; it < m_last; ++it) 65 for (const CSSParserToken* it = m_first; it < m_last; ++it)
66 it->serialize(builder); 66 it->serialize(builder);
67 return builder.toString(); 67 return builder.toString();
68 } 68 }
69 69
70 } // namespace blink 70 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698