| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CSSParserObserverWrapper_h | 5 #ifndef CSSParserObserverWrapper_h |
| 6 #define CSSParserObserverWrapper_h | 6 #define CSSParserObserverWrapper_h |
| 7 | 7 |
| 8 #include "core/css/parser/CSSParserObserver.h" | 8 #include "core/css/parser/CSSParserObserver.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 unsigned endOffset(const CSSParserTokenRange&); // Includes trailing comments | 25 unsigned endOffset(const CSSParserTokenRange&); // Includes trailing comments |
| 26 | 26 |
| 27 void skipCommentsBefore(const CSSParserTokenRange&, bool leaveDirectlyBefore); | 27 void skipCommentsBefore(const CSSParserTokenRange&, bool leaveDirectlyBefore); |
| 28 void yieldCommentsBefore(const CSSParserTokenRange&); | 28 void yieldCommentsBefore(const CSSParserTokenRange&); |
| 29 | 29 |
| 30 CSSParserObserver& observer() { return m_observer; } | 30 CSSParserObserver& observer() { return m_observer; } |
| 31 void addComment(unsigned startOffset, | 31 void addComment(unsigned startOffset, |
| 32 unsigned endOffset, | 32 unsigned endOffset, |
| 33 unsigned tokensBefore) { | 33 unsigned tokensBefore) { |
| 34 CommentPosition position = {startOffset, endOffset, tokensBefore}; | 34 CommentPosition position = {startOffset, endOffset, tokensBefore}; |
| 35 m_commentOffsets.append(position); | 35 m_commentOffsets.push_back(position); |
| 36 } | 36 } |
| 37 void addToken(unsigned startOffset) { m_tokenOffsets.append(startOffset); } | 37 void addToken(unsigned startOffset) { m_tokenOffsets.push_back(startOffset); } |
| 38 void finalizeConstruction(CSSParserToken* firstParserToken) { | 38 void finalizeConstruction(CSSParserToken* firstParserToken) { |
| 39 m_firstParserToken = firstParserToken; | 39 m_firstParserToken = firstParserToken; |
| 40 m_commentIterator = m_commentOffsets.begin(); | 40 m_commentIterator = m_commentOffsets.begin(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 CSSParserObserver& m_observer; | 44 CSSParserObserver& m_observer; |
| 45 Vector<unsigned> m_tokenOffsets; | 45 Vector<unsigned> m_tokenOffsets; |
| 46 CSSParserToken* m_firstParserToken; | 46 CSSParserToken* m_firstParserToken; |
| 47 | 47 |
| 48 struct CommentPosition { | 48 struct CommentPosition { |
| 49 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 49 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 50 unsigned startOffset; | 50 unsigned startOffset; |
| 51 unsigned endOffset; | 51 unsigned endOffset; |
| 52 unsigned tokensBefore; | 52 unsigned tokensBefore; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 Vector<CommentPosition> m_commentOffsets; | 55 Vector<CommentPosition> m_commentOffsets; |
| 56 Vector<CommentPosition>::iterator m_commentIterator; | 56 Vector<CommentPosition>::iterator m_commentIterator; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| 60 | 60 |
| 61 #endif // CSSParserObserverWrapper_h | 61 #endif // CSSParserObserverWrapper_h |
| OLD | NEW |