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

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

Issue 2618553003: CSS Properties & Values API: Support <resolution> values (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
index 5e9b730d9e27584da2dcf0e9f6d4547c31b0075a..a537649d107d676895550b7b60416f49652fbe3f 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -313,6 +313,21 @@ CSSPrimitiveValue* consumeTime(CSSParserTokenRange& range,
return nullptr;
}
+CSSPrimitiveValue* consumeResolution(CSSParserTokenRange& range) {
+ const CSSParserToken& token = range.peek();
+ // Unlike the other types, calc() does not work with <resolution>.
+ if (token.type() != DimensionToken)
+ return nullptr;
+ CSSPrimitiveValue::UnitType unit = token.unitType();
+ if (unit == CSSPrimitiveValue::UnitType::DotsPerPixel ||
+ unit == CSSPrimitiveValue::UnitType::DotsPerInch ||
+ unit == CSSPrimitiveValue::UnitType::DotsPerCentimeter) {
+ return CSSPrimitiveValue::create(
+ range.consumeIncludingWhitespace().numericValue(), unit);
+ }
+ return nullptr;
+}
+
CSSIdentifierValue* consumeIdent(CSSParserTokenRange& range) {
if (range.peek().type() != IdentToken)
return nullptr;
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698