Commit 1655037e authored by Oriol Brufau's avatar Oriol Brufau Committed by Commit Bot

[css-logical] Implement flow-relative offset properties

They are implemented behind the CSSLogical runtime flag.

Intent to Implement:
https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/48OwfwZrbvI/A1XZFGkzAwAJ

Spec: https://drafts.csswg.org/css-logical/#inset-properties

BUG=850004

TEST=external/wpt/css/css-logical/logical-box-inset.html

The test still has some failures because sideways writing modes have
not been implemented yet (http://crbug.com/680331).

Change-Id: I296bf83bb7200f1215b7f088284d34c6c69259c9
Reviewed-on: https://chromium-review.googlesource.com/1138620Reviewed-by: default avatarAnders Ruud <andruud@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarManuel Rego <rego@igalia.com>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#576024}
parent 3fd347d1
......@@ -186,6 +186,13 @@ hyphens
imageOrientation
imageRendering
inlineSize
inset
insetBlock
insetBlockEnd
insetBlockStart
insetInline
insetInlineEnd
insetInlineStart
isolation
item
justifyContent
......
......@@ -201,6 +201,10 @@ All changes to this list should go through Blink's feature review process: http:
image-orientation
image-rendering
inline-size
inset-block-end
inset-block-start
inset-inline-end
inset-inline-start
isolation
justify-content
justify-items
......@@ -591,6 +595,17 @@ All changes to this list should go through Blink's feature review process: http:
grid-template-areas
grid-template-columns
grid-template-rows
inset
bottom
left
right
top
inset-block
inset-block-end
inset-block-start
inset-inline
inset-inline-end
inset-inline-start
list-style
list-style-image
list-style-position
......
......@@ -4,7 +4,7 @@
module blink.mojom;
const int32 kMaximumCSSSampleId = 629;
const int32 kMaximumCSSSampleId = 636;
// This CSSSampleId represents page load for CSS histograms. It is recorded once
// per page visit for each CSS histogram being logged on the blink side and the
......
......@@ -523,6 +523,10 @@ blink_core_sources("css") {
"properties/longhands/image_orientation_custom.cc",
"properties/longhands/image_rendering_custom.cc",
"properties/longhands/inline_size_custom.cc",
"properties/longhands/inset_block_end_custom.cc",
"properties/longhands/inset_block_start_custom.cc",
"properties/longhands/inset_inline_end_custom.cc",
"properties/longhands/inset_inline_start_custom.cc",
"properties/longhands/isolation_custom.cc",
"properties/longhands/justify_content_custom.cc",
"properties/longhands/justify_items_custom.cc",
......@@ -788,6 +792,9 @@ blink_core_sources("css") {
"properties/shorthands/grid_row_custom.cc",
"properties/shorthands/grid_row_gap_custom.cc",
"properties/shorthands/grid_template_custom.cc",
"properties/shorthands/inset_block_custom.cc",
"properties/shorthands/inset_custom.cc",
"properties/shorthands/inset_inline_custom.cc",
"properties/shorthands/list_style_custom.cc",
"properties/shorthands/margin_block_custom.cc",
"properties/shorthands/margin_custom.cc",
......
......@@ -4279,6 +4279,42 @@
shorthand_for_physical_side: "borderColorShorthand",
},
},
{
name: "inset-inline-start",
property_methods: ["ParseSingleValue"],
runtime_flag: "CSSLogical",
direction_aware_options: {
logical_side: "start",
shorthand_for_physical_side: "insetShorthand",
}
},
{
name: "inset-inline-end",
property_methods: ["ParseSingleValue"],
runtime_flag: "CSSLogical",
direction_aware_options: {
logical_side: "end",
shorthand_for_physical_side: "insetShorthand",
}
},
{
name: "inset-block-start",
property_methods: ["ParseSingleValue"],
runtime_flag: "CSSLogical",
direction_aware_options: {
logical_side: "before",
shorthand_for_physical_side: "insetShorthand",
}
},
{
name: "inset-block-end",
property_methods: ["ParseSingleValue"],
runtime_flag: "CSSLogical",
direction_aware_options: {
logical_side: "after",
shorthand_for_physical_side: "insetShorthand",
}
},
// Non-standard direction aware properties
......@@ -4765,6 +4801,24 @@
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
layout_dependent: true,
},
{
name: "inset-block",
longhands: ["inset-block-start", "inset-block-end"],
property_methods: ["ParseShorthand"],
runtime_flag: "CSSLogical",
},
{
name: "inset-inline",
longhands: ["inset-inline-start", "inset-inline-end"],
property_methods: ["ParseShorthand"],
runtime_flag: "CSSLogical",
},
{
name: "inset",
longhands: ["top", "right", "bottom", "left"],
property_methods: ["ParseShorthand"],
runtime_flag: "CSSLogical",
},
{
name: "list-style",
longhands: ["list-style-type", "list-style-position", "list-style-image"],
......
......@@ -1470,6 +1470,13 @@ const std::string Converter::kPropertyLookupTable[] = {
"border-inline-color",
"border-block",
"border-inline",
"inset-block-start",
"inset-block-end",
"inset-block",
"inset-inline-start",
"inset-inline-end",
"inset-inline",
"inset",
"INVALID_PROPERTY",
};
......
// Copyright 2018 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 "third_party/blink/renderer/core/css/properties/longhands/inset_block_end.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_context.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h"
#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
namespace blink {
namespace CSSLonghand {
const CSSValue* InsetBlockEnd::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) const {
return CSSParsingUtils::ConsumeMarginOrOffset(
range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid);
}
} // namespace CSSLonghand
} // namespace blink
// Copyright 2018 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 "third_party/blink/renderer/core/css/properties/longhands/inset_block_start.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_context.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h"
#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
namespace blink {
namespace CSSLonghand {
const CSSValue* InsetBlockStart::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) const {
return CSSParsingUtils::ConsumeMarginOrOffset(
range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid);
}
} // namespace CSSLonghand
} // namespace blink
// Copyright 2018 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 "third_party/blink/renderer/core/css/properties/longhands/inset_inline_end.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_context.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h"
#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
namespace blink {
namespace CSSLonghand {
const CSSValue* InsetInlineEnd::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) const {
return CSSParsingUtils::ConsumeMarginOrOffset(
range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid);
}
} // namespace CSSLonghand
} // namespace blink
// Copyright 2018 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 "third_party/blink/renderer/core/css/properties/longhands/inset_inline_start.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_context.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h"
#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
namespace blink {
namespace CSSLonghand {
const CSSValue* InsetInlineStart::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) const {
return CSSParsingUtils::ConsumeMarginOrOffset(
range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid);
}
} // namespace CSSLonghand
} // namespace blink
// Copyright 2018 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 "third_party/blink/renderer/core/css/properties/shorthands/inset_block.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
namespace blink {
namespace CSSShorthand {
bool InsetBlock::ParseShorthand(
bool important,
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&,
HeapVector<CSSPropertyValue, 256>& properties) const {
return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands(
insetBlockShorthand(), important, context, range, properties);
}
} // namespace CSSShorthand
} // namespace blink
// Copyright 2018 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 "third_party/blink/renderer/core/css/properties/shorthands/inset.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
namespace blink {
namespace CSSShorthand {
bool Inset::ParseShorthand(
bool important,
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&,
HeapVector<CSSPropertyValue, 256>& properties) const {
return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands(
insetShorthand(), important, context, range, properties);
}
} // namespace CSSShorthand
} // namespace blink
// Copyright 2018 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 "third_party/blink/renderer/core/css/properties/shorthands/inset_inline.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
namespace blink {
namespace CSSShorthand {
bool InsetInline::ParseShorthand(
bool important,
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&,
HeapVector<CSSPropertyValue, 256>& properties) const {
return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands(
insetInlineShorthand(), important, context, range, properties);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -1210,6 +1210,20 @@ int UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram(
return 628;
case CSSPropertyBorderInline:
return 629;
case CSSPropertyInsetBlockStart:
return 630;
case CSSPropertyInsetBlockEnd:
return 631;
case CSSPropertyInsetBlock:
return 632;
case CSSPropertyInsetInlineStart:
return 633;
case CSSPropertyInsetInlineEnd:
return 634;
case CSSPropertyInsetInline:
return 635;
case CSSPropertyInset:
return 636;
// 1. Add new features above this line (don't change the assigned numbers of
// the existing items).
// 2. Update kMaximumCSSSampleId (defined in
......
......@@ -30418,6 +30418,13 @@ Called by update_use_counter_css.py.-->
<int value="627" label="border-inline-width"/>
<int value="628" label="border-block"/>
<int value="629" label="border-inline"/>
<int value="630" label="inset-block-start"/>
<int value="631" label="inset-block-end"/>
<int value="632" label="inset-block"/>
<int value="633" label="inset-inline-start"/>
<int value="634" label="inset-inline-end"/>
<int value="635" label="inset-inline"/>
<int value="636" label="inset"/>
</enum>
<enum name="MappedEditingCommands">
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