Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp |
| diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ebf6ff10b96b52f671ac49349f3136da791f3fdc |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp |
| @@ -0,0 +1,55 @@ |
| +// 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/CSSShorthandPropertyAPIOverflow.h" |
| + |
| +#include "core/css/CSSIdentifierValue.h" |
| +#include "core/css/parser/CSSParserContext.h" |
| +#include "core/css/parser/CSSParserFastPaths.h" |
| +#include "core/css/parser/CSSPropertyParserHelpers.h" |
| + |
| +namespace blink { |
| + |
| +class CSSParserLocalContext; |
|
Bugs Nash
2017/06/16 03:51:51
as above
|
| + |
| +bool CSSShorthandPropertyAPIOverflow::parseShorthand( |
| + bool important, |
| + CSSParserTokenRange& range, |
| + const CSSParserContext* context, |
| + const CSSParserLocalContext&, |
| + HeapVector<CSSProperty, 256>& properties) { |
| + DCHECK(context); |
| + |
| + CSSValueID id = range.ConsumeIncludingWhitespace().Id(); |
| + if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue(CSSPropertyOverflowY, |
| + id, context->Mode())) |
| + return false; |
| + if (!range.AtEnd()) |
| + return false; |
| + CSSValue* overflow_y_value = CSSIdentifierValue::Create(id); |
| + |
| + CSSValue* overflow_x_value = nullptr; |
| + |
| + // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. |
| + // If |
| + // this value has been set using the shorthand, then for now overflow-x |
| + // will default to auto, but once we implement pagination controls, it |
| + // should default to hidden. If the overflow-y value is anything but |
| + // paged-x or paged-y, then overflow-x and overflow-y should have the |
| + // same |
| + // value. |
| + if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) |
| + overflow_x_value = CSSIdentifierValue::Create(CSSValueAuto); |
| + else |
| + overflow_x_value = overflow_y_value; |
| + CSSPropertyParserHelpers::AddProperty( |
| + CSSPropertyOverflowX, CSSPropertyOverflow, *overflow_x_value, important, |
| + false /* implicit */, properties); |
| + CSSPropertyParserHelpers::AddProperty( |
| + CSSPropertyOverflowY, CSSPropertyOverflow, *overflow_y_value, important, |
| + false /* implicit */, properties); |
| + return true; |
| +} |
| + |
| +} // namespace blink |