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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 1919813002: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 3dc334d768e21a641e0969afb2f8cc8dad524a95..ebd4fb51bae172c0e01ece595665509e86135b59 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1409,6 +1409,46 @@ static RawPtr<CSSValue> consumeMotionRotation(CSSParserTokenRange& range)
return list.release();
}
+// auto | <id> [ current | root | <target-name> ] | inherit
+static RawPtr<CSSValue> consumeNavigation(CSSParserTokenRange& range)
+{
+ CSSValueID id = range.peek().id();
+ if (id == CSSValueAuto)
fs 2016/05/18 15:55:05 range.peek().id() == ...
+ return consumeIdent(range);
+
+ String selectorText = "";
fs 2016/05/18 15:55:05 Don't need to initialize this, it'll be overwritte
+ CSSParserTokenType type = range.peek().type();
+ if (type == HashToken) {
fs 2016/05/18 15:55:04 Should only accept HashToken here or?
+ selectorText.append(range.consumeIncludingWhitespace().value());
+ } else if (type == StringToken) {
+ selectorText.append(range.consumeIncludingWhitespace().value());
+ } else {
+ return nullptr;
+ }
+
+ type = range.peek().type();
+ RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RawPtr<CSSValue> idSel = CSSStringValue::create(selectorText);
fs 2016/05/18 15:55:05 idSelector
+ list->append(idSel.release());
+
+ RawPtr<CSSValue> target;
+ if (type == IdentToken) {
+ target = consumeIdent<CSSValueRoot, CSSValueCurrent>(range);
+ } else if (type == StringToken) {
+ String targetText = range.consumeIncludingWhitespace().value();
+ if (targetText.startsWith("_"))
fs 2016/05/18 15:55:05 The way I'm reading the spec, this should not be a
+ return nullptr;
+ target = CSSStringValue::create(targetText);
+ } else if (type == EOFToken) {
fs 2016/05/18 15:55:04 Maybe check range.atEnd() instead.
+ target = cssValuePool().createIdentifierValue(CSSValueCurrent);
+ } else {
+ return nullptr;
+ }
+ list->append(target);
+
+ return list.release();
+}
+
static RawPtr<CSSValue> consumeTextEmphasisStyle(CSSParserTokenRange& range)
{
CSSValueID id = range.peek().id();
@@ -3447,6 +3487,11 @@ RawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedPro
return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeAll);
case CSSPropertyMotionRotation:
return consumeMotionRotation(m_range);
+ case CSSPropertyNavDown:
+ case CSSPropertyNavLeft:
+ case CSSPropertyNavRight:
+ case CSSPropertyNavUp:
+ return consumeNavigation(m_range);
case CSSPropertyWebkitTextEmphasisStyle:
return consumeTextEmphasisStyle(m_range);
case CSSPropertyOutlineColor:

Powered by Google App Engine
This is Rietveld 408576698