Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp |
| diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..122bd6fdd77746be54d35ccd529920e80990bccf |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp |
| @@ -0,0 +1,25 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "core/css/properties/CSSPropertyAPIWebkitLineClamp.h" |
| + |
| +#include "core/css/parser/CSSPropertyParserHelpers.h" |
|
sashab
2017/01/06 05:28:42
+ CSSPrimitiveValue
|
| + |
| +namespace blink { |
| + |
| +const CSSValue* CSSPropertyAPIWebkitLineClamp::parseSingleValue( |
| + CSSParserTokenRange& range, |
| + const CSSParserContext& context) { |
| + if (range.peek().type() != PercentageToken && |
| + range.peek().type() != NumberToken) |
| + return nullptr; |
| + CSSPrimitiveValue* clampValue = |
| + CSSPropertyParserHelpers::consumePercent(range, ValueRangeNonNegative); |
| + if (clampValue) |
| + return clampValue; |
| + // When specifying number of lines, don't allow 0 as a valid value. |
| + return CSSPropertyParserHelpers::consumePositiveInteger(range); |
| +} |
| + |
| +} // namespace blink |