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..53d98f9c49815ad33445a5492344fe222d47543a |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp |
| @@ -0,0 +1,27 @@ |
| +// Copyright 2016 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/CSSValueList.h" |
| +#include "core/css/parser/CSSParserTokenRange.h" |
| +#include "core/css/parser/CSSPropertyParser.h" |
| +#include "core/css/parser/CSSPropertyParserHelpers.h" |
|
alancutter (OOO until 2018)
2017/01/05 04:15:06
We normally have a new line before the namespace s
|
| +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 |