Commit 7f1acbb2 authored by Jia's avatar Jia Committed by Commit Bot

Implement parseShorthand for scroll-padding-inline and scroll-snap-margin-[block|inline].

All these shorthand properties call the same helper function
ConsumeShorthandVia2LonghandAPIs. Hence these properties are grouped in
one cl.

Bug: 668012
Change-Id: I308be0165a6e7962874053e6cbefd831cac6f410
Diff: https://gist.github.com/06821a4b93df191366b1b8a2ac9d01ad/revisions
Reviewed-on: https://chromium-review.googlesource.com/571338
Commit-Queue: Jia Meng <jiameng@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Reviewed-by: default avatarmeade_UTC10 <meade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486707}
parent b4c3bcce
......@@ -604,6 +604,9 @@ css_properties("make_core_generated_css_property_apis") {
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIOverflow.h",
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIOffset.h",
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.h",
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIScrollPaddingInline.h",
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIScrollSnapMarginBlock.h",
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIScrollSnapMarginInline.h",
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPITextDecoration.h",
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.h",
"$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.h",
......
......@@ -547,6 +547,9 @@ blink_core_sources("css") {
"properties/CSSShorthandPropertyAPIOutline.cpp",
"properties/CSSShorthandPropertyAPIOverflow.cpp",
"properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp",
"properties/CSSShorthandPropertyAPIScrollPaddingInline.cpp",
"properties/CSSShorthandPropertyAPIScrollSnapMarginBlock.cpp",
"properties/CSSShorthandPropertyAPIScrollSnapMarginInline.cpp",
"properties/CSSShorthandPropertyAPITextDecoration.cpp",
"properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp",
"properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp",
......
......@@ -3859,6 +3859,8 @@
{
name: "scroll-padding-inline",
longhands: ["scroll-padding-inline-start", "scroll-padding-inline-end"],
api_class: true,
api_methods: ["parseShorthand"],
runtime_flag: "CSSScrollSnapPoints",
},
{
......@@ -3869,11 +3871,15 @@
{
name: "scroll-snap-margin-block",
longhands: ["scroll-snap-margin-block-start", "scroll-snap-margin-block-end"],
api_class: true,
api_methods: ["parseShorthand"],
runtime_flag: "CSSScrollSnapPoints",
},
{
name: "scroll-snap-margin-inline",
longhands: ["scroll-snap-margin-inline-start", "scroll-snap-margin-inline-end"],
api_class: true,
api_methods: ["parseShorthand"],
runtime_flag: "CSSScrollSnapPoints",
},
{
......
......@@ -2448,14 +2448,8 @@ bool CSSPropertyParser::ParseShorthand(CSSPropertyID unresolved_property,
return ConsumePlaceSelfShorthand(important);
case CSSPropertyScrollPadding:
return Consume4Values(scrollPaddingShorthand(), important);
case CSSPropertyScrollPaddingInline:
return Consume2Values(scrollPaddingInlineShorthand(), important);
case CSSPropertyScrollSnapMargin:
return Consume4Values(scrollSnapMarginShorthand(), important);
case CSSPropertyScrollSnapMarginBlock:
return Consume2Values(scrollSnapMarginBlockShorthand(), important);
case CSSPropertyScrollSnapMarginInline:
return Consume2Values(scrollSnapMarginInlineShorthand(), important);
default:
return false;
}
......
// 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/CSSShorthandPropertyAPIScrollPaddingInline.h"
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
namespace blink {
bool CSSShorthandPropertyAPIScrollPaddingInline::parseShorthand(
bool important,
CSSParserTokenRange& range,
const CSSParserContext& context,
bool,
HeapVector<CSSProperty, 256>& properties) {
return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs(
scrollPaddingInlineShorthand(), important, context, range, properties);
}
} // namespace blink
// 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/CSSShorthandPropertyAPIScrollSnapMarginBlock.h"
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
namespace blink {
bool CSSShorthandPropertyAPIScrollSnapMarginBlock::parseShorthand(
bool important,
CSSParserTokenRange& range,
const CSSParserContext& context,
bool,
HeapVector<CSSProperty, 256>& properties) {
return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs(
scrollSnapMarginBlockShorthand(), important, context, range, properties);
}
} // namespace blink
// 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/CSSShorthandPropertyAPIScrollSnapMarginInline.h"
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
namespace blink {
bool CSSShorthandPropertyAPIScrollSnapMarginInline::parseShorthand(
bool important,
CSSParserTokenRange& range,
const CSSParserContext& context,
bool,
HeapVector<CSSProperty, 256>& properties) {
return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs(
scrollSnapMarginInlineShorthand(), important, context, range, properties);
}
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment