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

Unified Diff: Source/core/css/parser/CSSParserTokenRange.cpp

Issue 799003003: CSS Parser: Implement parseRule (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@attoken
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/parser/CSSParserTokenRange.cpp
diff --git a/Source/core/css/parser/CSSParserTokenRange.cpp b/Source/core/css/parser/CSSParserTokenRange.cpp
index 85a069d5d3c5d7737b5a7b0e4f99eff5173f75cd..5b6f168ee2eae55506741b3c05beebf113b50ecc 100644
--- a/Source/core/css/parser/CSSParserTokenRange.cpp
+++ b/Source/core/css/parser/CSSParserTokenRange.cpp
@@ -26,6 +26,24 @@ CSSParserTokenRange CSSParserTokenRange::makeSubRange(const CSSParserToken* firs
return CSSParserTokenRange(first, last);
}
+CSSParserTokenRange CSSParserTokenRange::consumeBlock()
+{
+ ASSERT(peek().blockType() == CSSParserToken::BlockStart);
+ const CSSParserToken* start = &peek() + 1;
+ unsigned nestingLevel = 0;
+ do {
+ const CSSParserToken& token = consume();
+ if (token.blockType() == CSSParserToken::BlockStart)
+ nestingLevel++;
+ else if (token.blockType() == CSSParserToken::BlockEnd)
+ nestingLevel--;
+ } while (nestingLevel && m_first < m_last);
alancutter (OOO until 2018) 2014/12/29 05:10:22 Would it be worse to have consumeComponentValue()
Timothy Loh 2015/01/05 05:56:18 I don't think it's any worse, but we're going to r
+
+ if (nestingLevel)
+ return makeSubRange(start, m_first); // Ended at EOF
+ return makeSubRange(start, m_first - 1);
+}
+
void CSSParserTokenRange::consumeComponentValue()
{
// FIXME: This is going to do multiple passes over large sections of a stylesheet.
« Source/core/css/parser/CSSParserImpl.cpp ('K') | « Source/core/css/parser/CSSParserTokenRange.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698