Commit 7c2ee337 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Mark CSS property {margin,padding}-{block,inline}-{start,end} layout dependent

This patch markes following CSS properties layout dependent:
 - margin-block-start, margin-block-end
 - margin-inline-start, margin-inline-end
 - padding-block-start, padding-block-end
 - padding-inline-start, padding-inline-end
for improving browser interoperatiblity.

This patch is follow up of the CL[1] to fix following tests:
 - css/css-logical/parsing/margin-block-inline-computed.html
 - css/css-logical/parsing/padding-block-inline-computed.html

[1] http://crrev.com/c/1760419 Import WPT tests

Bug: 995612
Change-Id: If754cdcb7085ffa10cf965301f46f7aace33032d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1774421Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691099}
parent 67575409
......@@ -4222,6 +4222,7 @@
},
{
name: "margin-inline-start",
layout_dependent: true,
property_methods: ["ParseSingleValue"],
direction_aware_options: {
resolver: "inline-start",
......@@ -4232,6 +4233,7 @@
},
{
name: "margin-inline-end",
layout_dependent: true,
property_methods: ["ParseSingleValue"],
direction_aware_options: {
resolver: "inline-end",
......@@ -4242,6 +4244,7 @@
},
{
name: "margin-block-start",
layout_dependent: true,
property_methods: ["ParseSingleValue"],
direction_aware_options: {
resolver: "block-start",
......@@ -4252,6 +4255,7 @@
},
{
name: "margin-block-end",
layout_dependent: true,
property_methods: ["ParseSingleValue"],
direction_aware_options: {
resolver: "block-end",
......@@ -4262,6 +4266,7 @@
},
{
name: "padding-inline-start",
layout_dependent: true,
property_methods: ["ParseSingleValue"],
direction_aware_options: {
resolver: "inline-start",
......@@ -4271,6 +4276,7 @@
},
{
name: "padding-inline-end",
layout_dependent: true,
property_methods: ["ParseSingleValue"],
direction_aware_options: {
resolver: "inline-end",
......@@ -4280,6 +4286,7 @@
},
{
name: "padding-block-start",
layout_dependent: true,
property_methods: ["ParseSingleValue"],
direction_aware_options: {
resolver: "block-start",
......@@ -4289,6 +4296,7 @@
},
{
name: "padding-block-end",
layout_dependent: true,
property_methods: ["ParseSingleValue"],
direction_aware_options: {
resolver: "block-end",
......
......@@ -3702,6 +3702,11 @@ const CSSValue* ListStyleType::CSSValueFromComputedStyleInternal(
return CSSIdentifierValue::Create(style.ListStyleType());
}
bool MarginBlockEnd::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
return layout_object && layout_object->IsBox();
}
const CSSValue* MarginBlockEnd::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
......@@ -3711,6 +3716,11 @@ const CSSValue* MarginBlockEnd::ParseSingleValue(
css_property_parser_helpers::UnitlessQuirk::kForbid);
}
bool MarginBlockStart::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
return layout_object && layout_object->IsBox();
}
const CSSValue* MarginBlockStart::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
......@@ -3749,6 +3759,11 @@ const CSSValue* MarginBottom::CSSValueFromComputedStyleInternal(
style);
}
bool MarginInlineEnd::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
return layout_object && layout_object->IsBox();
}
const CSSValue* MarginInlineEnd::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
......@@ -3758,6 +3773,11 @@ const CSSValue* MarginInlineEnd::ParseSingleValue(
css_property_parser_helpers::UnitlessQuirk::kForbid);
}
bool MarginInlineStart::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
return layout_object && layout_object->IsBox();
}
const CSSValue* MarginInlineStart::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
......@@ -4396,6 +4416,11 @@ const CSSValue* OverscrollBehaviorY::CSSValueFromComputedStyleInternal(
return CSSIdentifierValue::Create(style.OverscrollBehaviorY());
}
bool PaddingBlockEnd::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
return layout_object && layout_object->IsBox();
}
const CSSValue* PaddingBlockEnd::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
......@@ -4405,6 +4430,11 @@ const CSSValue* PaddingBlockEnd::ParseSingleValue(
css_property_parser_helpers::UnitlessQuirk::kForbid);
}
bool PaddingBlockStart::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
return layout_object && layout_object->IsBox();
}
const CSSValue* PaddingBlockStart::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
......@@ -4443,6 +4473,11 @@ const CSSValue* PaddingBottom::CSSValueFromComputedStyleInternal(
ToLayoutBox(layout_object)->ComputedCSSPaddingBottom(), style);
}
bool PaddingInlineEnd::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
return layout_object && layout_object->IsBox();
}
const CSSValue* PaddingInlineEnd::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
......@@ -4452,6 +4487,11 @@ const CSSValue* PaddingInlineEnd::ParseSingleValue(
css_property_parser_helpers::UnitlessQuirk::kForbid);
}
bool PaddingInlineStart::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
return layout_object && layout_object->IsBox();
}
const CSSValue* PaddingInlineStart::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
......
This is a testharness.js-based test.
PASS Property margin-block-start value '10px' computes to '10px'
FAIL Property margin-block-end value '10%' computes to '20px' assert_equals: expected "20px" but got "0px"
PASS Property margin-inline-start value '30px' computes to '30px'
PASS Property margin-inline-end value '1em' computes to '40px'
FAIL Property margin-block-start value 'calc(10% + 40px)' computes to '60px' assert_equals: expected "60px" but got "0px"
PASS Property margin-block-end value 'calc(10px + 0.5em)' computes to '30px'
PASS Property margin-inline-start value 'calc(10px + 0.5em)' computes to '30px'
FAIL Property margin-inline-end value 'calc(10% + 40px)' computes to '60px' assert_equals: expected "60px" but got "40px"
PASS Property margin-block value '10px' computes to '10px'
PASS Property margin-block value '10px 20px' computes to '10px 20px'
PASS Property margin-inline value '30px' computes to '30px'
PASS Property margin-inline value '30px 40px' computes to '30px 40px'
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Property padding-block-start value '10px' computes to '10px'
FAIL Property padding-block-end value '10%' computes to '20px' assert_equals: expected "20px" but got "0px"
PASS Property padding-inline-start value '30px' computes to '30px'
PASS Property padding-inline-end value '1em' computes to '40px'
FAIL Property padding-block-start value 'calc(10% + 40px)' computes to '60px' assert_equals: expected "60px" but got "40px"
PASS Property padding-block-end value 'calc(10% - 40px)' computes to '0px'
PASS Property padding-inline-start value 'calc(10% - 40px)' computes to '0px'
FAIL Property padding-inline-end value 'calc(10% + 40px)' computes to '60px' assert_equals: expected "60px" but got "40px"
PASS Property padding-block-start value 'calc(10px - 0.5em)' computes to '0px'
PASS Property padding-block-end value 'calc(10px + 0.5em)' computes to '30px'
PASS Property padding-inline-start value 'calc(10px + 0.5em)' computes to '30px'
PASS Property padding-inline-end value 'calc(10px - 0.5em)' computes to '0px'
PASS Property padding-block value '10px' computes to '10px'
PASS Property padding-block value '10px 20px' computes to '10px 20px'
PASS Property padding-inline value '30px' computes to '30px'
PASS Property padding-inline value '30px 40px' computes to '30px 40px'
Harness: the test ran to completion.
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