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

Side by Side Diff: third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp

Issue 2938983002: Implement parseShorthand API for shorthand properties, "overflow", "font" and "font-variant" (Closed)
Patch Set: Replace ImplicitProperty by IsImplicitProperty Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/css/properties/CSSShorthandPropertyAPIOverflow.h"
6
7 #include "core/css/CSSIdentifierValue.h"
8 #include "core/css/parser/CSSParserContext.h"
9 #include "core/css/parser/CSSParserFastPaths.h"
10 #include "core/css/parser/CSSPropertyParserHelpers.h"
11
12 namespace blink {
13
14 bool CSSShorthandPropertyAPIOverflow::parseShorthand(
15 bool important,
16 CSSParserTokenRange& range,
17 const CSSParserContext& context,
18 const CSSParserLocalContext&,
19 HeapVector<CSSProperty, 256>& properties) {
20 CSSValueID id = range.ConsumeIncludingWhitespace().Id();
21 if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue(CSSPropertyOverflowY,
22 id, context.Mode()))
23 return false;
24 if (!range.AtEnd())
25 return false;
26 CSSValue* overflow_y_value = CSSIdentifierValue::Create(id);
27
28 CSSValue* overflow_x_value = nullptr;
29
30 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y.
31 // If
32 // this value has been set using the shorthand, then for now overflow-x
33 // will default to auto, but once we implement pagination controls, it
34 // should default to hidden. If the overflow-y value is anything but
35 // paged-x or paged-y, then overflow-x and overflow-y should have the
36 // same
37 // value.
38 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY)
39 overflow_x_value = CSSIdentifierValue::Create(CSSValueAuto);
40 else
41 overflow_x_value = overflow_y_value;
42 CSSPropertyParserHelpers::AddProperty(
43 CSSPropertyOverflowX, CSSPropertyOverflow, *overflow_x_value, important,
44 CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties);
45 CSSPropertyParserHelpers::AddProperty(
46 CSSPropertyOverflowY, CSSPropertyOverflow, *overflow_y_value, important,
47 CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties);
48 return true;
49 }
50
51 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698