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

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: Rebase cl 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 class CSSParserLocalContext;
Bugs Nash 2017/06/16 03:51:51 as above
15
16 bool CSSShorthandPropertyAPIOverflow::parseShorthand(
17 bool important,
18 CSSParserTokenRange& range,
19 const CSSParserContext* context,
20 const CSSParserLocalContext&,
21 HeapVector<CSSProperty, 256>& properties) {
22 DCHECK(context);
23
24 CSSValueID id = range.ConsumeIncludingWhitespace().Id();
25 if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue(CSSPropertyOverflowY,
26 id, context->Mode()))
27 return false;
28 if (!range.AtEnd())
29 return false;
30 CSSValue* overflow_y_value = CSSIdentifierValue::Create(id);
31
32 CSSValue* overflow_x_value = nullptr;
33
34 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y.
35 // If
36 // this value has been set using the shorthand, then for now overflow-x
37 // will default to auto, but once we implement pagination controls, it
38 // should default to hidden. If the overflow-y value is anything but
39 // paged-x or paged-y, then overflow-x and overflow-y should have the
40 // same
41 // value.
42 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY)
43 overflow_x_value = CSSIdentifierValue::Create(CSSValueAuto);
44 else
45 overflow_x_value = overflow_y_value;
46 CSSPropertyParserHelpers::AddProperty(
47 CSSPropertyOverflowX, CSSPropertyOverflow, *overflow_x_value, important,
48 false /* implicit */, properties);
49 CSSPropertyParserHelpers::AddProperty(
50 CSSPropertyOverflowY, CSSPropertyOverflow, *overflow_y_value, important,
51 false /* implicit */, properties);
52 return true;
53 }
54
55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698