Bug 1312588 - Part 2: Support fit-content() in style. r=emilio

Support fit-content for preferred size, min size, and max size. This
patch only implement the style system. For layout part, we will do that
in the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D107161
This commit is contained in:
Boris Chiou 2021-06-08 05:05:50 +00:00
parent d2c8ac21ef
commit b65c4b45ec
31 changed files with 164 additions and 86 deletions

View File

@ -1866,6 +1866,7 @@ exports.CSS_PROPERTIES = {
"-moz-fit-content",
"auto",
"content",
"fit-content",
"inherit",
"initial",
"max-content",
@ -1885,6 +1886,7 @@ exports.CSS_PROPERTIES = {
"-moz-fit-content",
"auto",
"content",
"fit-content",
"inherit",
"initial",
"max-content",
@ -3719,6 +3721,7 @@ exports.CSS_PROPERTIES = {
"-moz-available",
"-moz-fit-content",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",
@ -5977,6 +5980,7 @@ exports.CSS_PROPERTIES = {
"-moz-fit-content",
"auto",
"content",
"fit-content",
"inherit",
"initial",
"max-content",
@ -5996,6 +6000,7 @@ exports.CSS_PROPERTIES = {
"-moz-fit-content",
"auto",
"content",
"fit-content",
"inherit",
"initial",
"max-content",
@ -6915,6 +6920,7 @@ exports.CSS_PROPERTIES = {
"-moz-available",
"-moz-fit-content",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",
@ -7000,6 +7006,7 @@ exports.CSS_PROPERTIES = {
"-moz-available",
"-moz-fit-content",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",
@ -8081,6 +8088,7 @@ exports.CSS_PROPERTIES = {
"-moz-fit-content",
"-moz-max-content",
"-moz-min-content",
"fit-content",
"inherit",
"initial",
"max-content",
@ -8101,6 +8109,7 @@ exports.CSS_PROPERTIES = {
"-moz-fit-content",
"-moz-max-content",
"-moz-min-content",
"fit-content",
"inherit",
"initial",
"max-content",
@ -8121,6 +8130,7 @@ exports.CSS_PROPERTIES = {
"-moz-fit-content",
"-moz-max-content",
"-moz-min-content",
"fit-content",
"inherit",
"initial",
"max-content",
@ -8141,6 +8151,7 @@ exports.CSS_PROPERTIES = {
"-moz-fit-content",
"-moz-max-content",
"-moz-min-content",
"fit-content",
"inherit",
"initial",
"max-content",
@ -8160,6 +8171,7 @@ exports.CSS_PROPERTIES = {
"-moz-available",
"-moz-fit-content",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",
@ -8178,6 +8190,7 @@ exports.CSS_PROPERTIES = {
"-moz-available",
"-moz-fit-content",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",
@ -8196,6 +8209,7 @@ exports.CSS_PROPERTIES = {
"-moz-available",
"-moz-fit-content",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",
@ -8214,6 +8228,7 @@ exports.CSS_PROPERTIES = {
"-moz-available",
"-moz-fit-content",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",
@ -10724,6 +10739,7 @@ exports.CSS_PROPERTIES = {
"-moz-available",
"-moz-fit-content",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",

View File

@ -4527,7 +4527,15 @@ static bool GetIntrinsicCoord(nsIFrame::ExtremumLength aStyle,
aProperty == PROP_MIN_WIDTH,
"unexpected property");
if (aStyle == nsIFrame::ExtremumLength::MozAvailable) return false;
if (aStyle == nsIFrame::ExtremumLength::MozAvailable) {
return false;
}
if (aStyle == nsIFrame::ExtremumLength::FitContentFunction) {
// fit-content() should be handled by the caller.
return false;
}
if (aStyle == nsIFrame::ExtremumLength::MozFitContent) {
if (aProperty == PROP_WIDTH) return false; // handle like 'width: auto'
if (aProperty == PROP_MAX_WIDTH)

View File

@ -2332,7 +2332,7 @@ template <typename SizeOrMaxSize>
static inline bool IsIntrinsicKeyword(const SizeOrMaxSize& aSize) {
// All keywords other than auto/none/-moz-available depend on intrinsic sizes.
return aSize.IsMaxContent() || aSize.IsMinContent() ||
aSize.IsMozFitContent();
aSize.IsMozFitContent() || aSize.IsFitContentFunction();
}
bool nsIFrame::CanBeDynamicReflowRoot() const {
@ -6568,6 +6568,8 @@ nsIFrame::ISizeComputationResult nsIFrame::ComputeISizeValue(
return {result, intrinsicSizeFromAspectRatio
? AspectRatioUsage::ToComputeISize
: AspectRatioUsage::None};
case ExtremumLength::FitContentFunction:
// TODO: Finish this in the following patches.
case ExtremumLength::MozFitContent: {
nscoord pref = NS_UNCONSTRAINEDSIZE;
nscoord min = 0;

View File

@ -3078,7 +3078,7 @@ class nsIFrame : public nsQueryFrame {
bool HasIntrinsicKeywordForBSize() const {
const auto& bSize = StylePosition()->BSize(GetWritingMode());
return bSize.IsMozFitContent() || bSize.IsMinContent() ||
bSize.IsMaxContent();
bSize.IsMaxContent() || bSize.IsFitContentFunction();
}
/**
* Helper method to create a view for a frame. Only used by a few sub-classes
@ -4776,6 +4776,7 @@ class nsIFrame : public nsQueryFrame {
MaxContent,
MozAvailable,
MozFitContent,
FitContentFunction,
};
template <typename SizeOrMaxSize>
@ -4789,6 +4790,8 @@ class nsIFrame : public nsQueryFrame {
return mozilla::Some(ExtremumLength::MozAvailable);
case SizeOrMaxSize::Tag::MozFitContent:
return mozilla::Some(ExtremumLength::MozFitContent);
case SizeOrMaxSize::Tag::FitContentFunction:
return mozilla::Some(ExtremumLength::FitContentFunction);
default:
return mozilla::Nothing();
}

View File

@ -130,6 +130,7 @@ static bool DependsOnIntrinsicSize(const SizeOrMaxSize& aMinOrMaxSize) {
case nsIFrame::ExtremumLength::MinContent:
case nsIFrame::ExtremumLength::MaxContent:
case nsIFrame::ExtremumLength::MozFitContent:
case nsIFrame::ExtremumLength::FitContentFunction:
return true;
case nsIFrame::ExtremumLength::MozAvailable:
return false;

View File

@ -1487,16 +1487,9 @@ already_AddRefed<nsROCSSPrimitiveValue> nsComputedDOMStyle::GetGridTrackSize(
if (aTrackSize.IsFitContent()) {
// A fit-content() function.
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
nsAutoString argumentStr, fitContentStr;
fitContentStr.AppendLiteral("fit-content(");
MOZ_ASSERT(aTrackSize.AsFitContent().IsBreadth(),
"unexpected unit for fit-content() argument value");
SetValueToLengthPercentage(val, aTrackSize.AsFitContent().AsBreadth(),
true);
val->GetCssText(argumentStr, IgnoreErrors());
fitContentStr.Append(argumentStr);
fitContentStr.Append(char16_t(')'));
val->SetString(fitContentStr);
SetValueFromFitContentFunction(val, aTrackSize.AsFitContent().AsBreadth());
return val.forget();
}
@ -2245,15 +2238,33 @@ static void SetValueToExtremumLength(nsROCSSPrimitiveValue* aValue,
return aValue->SetString("-moz-available");
case nsIFrame::ExtremumLength::MozFitContent:
return aValue->SetString("-moz-fit-content");
case nsIFrame::ExtremumLength::FitContentFunction:
MOZ_ASSERT_UNREACHABLE("fit-content() should be handled separately");
}
MOZ_ASSERT_UNREACHABLE("Unknown extremum length?");
}
void nsComputedDOMStyle::SetValueFromFitContentFunction(
nsROCSSPrimitiveValue* aValue, const LengthPercentage& aLength) {
nsAutoString argumentStr;
SetValueToLengthPercentage(aValue, aLength, true);
aValue->GetCssText(argumentStr, IgnoreErrors());
nsAutoString fitContentStr;
fitContentStr.AppendLiteral("fit-content(");
fitContentStr.Append(argumentStr);
fitContentStr.Append(char16_t(')'));
aValue->SetString(fitContentStr);
}
void nsComputedDOMStyle::SetValueToSize(nsROCSSPrimitiveValue* aValue,
const StyleSize& aSize) {
if (aSize.IsAuto()) {
return aValue->SetString("auto");
}
if (aSize.IsFitContentFunction()) {
return SetValueFromFitContentFunction(aValue, aSize.AsFitContentFunction());
}
if (auto length = nsIFrame::ToExtremumLength(aSize)) {
return SetValueToExtremumLength(aValue, *length);
}
@ -2266,6 +2277,9 @@ void nsComputedDOMStyle::SetValueToMaxSize(nsROCSSPrimitiveValue* aValue,
if (aSize.IsNone()) {
return aValue->SetString("none");
}
if (aSize.IsFitContentFunction()) {
return SetValueFromFitContentFunction(aValue, aSize.AsFitContentFunction());
}
if (auto length = nsIFrame::ToExtremumLength(aSize)) {
return SetValueToExtremumLength(aValue, *length);
}

View File

@ -282,6 +282,9 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration,
void SetValueToURLValue(const mozilla::StyleComputedUrl* aURL,
nsROCSSPrimitiveValue* aValue);
void SetValueFromFitContentFunction(nsROCSSPrimitiveValue* aValue,
const mozilla::LengthPercentage&);
void SetValueToSize(nsROCSSPrimitiveValue* aValue, const mozilla::StyleSize&);
void SetValueToLengthPercentageOrAuto(nsROCSSPrimitiveValue* aValue,

View File

@ -17,6 +17,7 @@ prefs =
layout.css.overflow-logical.enabled=true
layout.css.step-position-jump.enabled=true
layout.css.backdrop-filter.enabled=true
layout.css.fit-content-function.enabled=true
support-files =
animation_utils.js
ccd-quirks.html

View File

@ -6055,6 +6055,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["none"],
quirks_values: { "5": "5px" },
@ -6498,6 +6501,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["auto"],
quirks_values: { "5": "5px" },
@ -6529,6 +6535,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["auto"],
quirks_values: { "5": "5px" },
@ -6555,6 +6564,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["none"],
quirks_values: { "5": "5px" },
@ -6584,6 +6596,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["none"],
quirks_values: { "5": "5px" },
@ -8427,6 +8442,9 @@ var gCSSProperties = {
"min(5px,2em)",
"max(5px)",
"max(5px,2em)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: [
"none",
@ -10083,6 +10101,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["none"],
},
@ -10436,6 +10457,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["none"],
},
@ -10579,6 +10603,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["auto", "5"],
},
@ -10608,6 +10635,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["auto", "5"],
},
@ -10635,6 +10665,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["none", "5"],
},
@ -10665,6 +10698,9 @@ var gCSSProperties = {
"calc(3*25px)",
"calc(25px*3)",
"calc(3*25px + 50%)",
"fit-content(100px)",
"fit-content(10%)",
"fit-content(calc(3*25px + 50%))",
],
invalid_values: ["none", "5"],
},

View File

@ -79,9 +79,13 @@ var gSwapInitialWhenHaveFrame = {
// When there's a frame, these keywords works out to the same as the initial
// value, i.e. `auto`, given the prerequisites of only 'display: block'.
"height": [ "-moz-max-content", "-moz-min-content", "-moz-fit-content",
"-moz-available", "max-content", "min-content" ],
"-moz-available", "max-content", "min-content",
"fit-content(100px)", "fit-content(10%)",
"fit-content(calc(3*25px + 50%))" ],
"block-size": [ "-moz-max-content", "-moz-min-content", "-moz-fit-content",
"-moz-available", "max-content", "min-content" ],
"-moz-available", "max-content", "min-content",
"fit-content(100px)", "fit-content(10%)",
"fit-content(calc(3*25px + 50%))" ],
};
function swap_when_frame(property, value) {

View File

@ -151,6 +151,8 @@ static CellISizeInfo GetISizeInfo(gfxContext* aRenderingContext,
break;
case StyleSize::Tag::MozAvailable:
case StyleSize::Tag::MozFitContent:
case StyleSize::Tag::FitContentFunction:
// TODO: Bug 1708310: Make sure fit-content() work properly in table.
case StyleSize::Tag::Auto:
case StyleSize::Tag::LengthPercentage:
break;
@ -161,7 +163,8 @@ static CellISizeInfo GetISizeInfo(gfxContext* aRenderingContext,
if (nsIFrame::ToExtremumLength(maxISize)) {
if (!aIsCell || maxISize.IsMozAvailable()) {
maxISize = StyleMaxSize::None();
} else if (maxISize.IsMozFitContent()) {
} else if (maxISize.IsMozFitContent() || maxISize.IsFitContentFunction()) {
// TODO: Bug 1708310: Make sure fit-content() work properly in table.
// for 'max-inline-size', '-moz-fit-content' is like 'max-content'
maxISize = StyleMaxSize::MaxContent();
}
@ -187,7 +190,8 @@ static CellISizeInfo GetISizeInfo(gfxContext* aRenderingContext,
if (nsIFrame::ToExtremumLength(maxISize)) {
if (!aIsCell || minISize.IsMozAvailable()) {
minISize = StyleSize::LengthPercentage(LengthPercentage::Zero());
} else if (minISize.IsMozFitContent()) {
} else if (minISize.IsMozFitContent() || minISize.IsFitContentFunction()) {
// TODO: Bug 1708310: Make sure fit-content() work properly in table.
// for 'min-inline-size', '-moz-fit-content' is like 'min-content'
minISize = StyleSize::MinContent();
}

View File

@ -188,7 +188,8 @@ impl Size {
GenericSize::MinContent |
GenericSize::MaxContent |
GenericSize::MozFitContent |
GenericSize::MozAvailable => false
GenericSize::MozAvailable |
GenericSize::FitContentFunction(_) => false
}
}
}

View File

@ -158,6 +158,9 @@ pub enum GenericSize<LengthPercent> {
MozFitContent,
#[animation(error)]
MozAvailable,
#[animation(error)]
#[css(function = "fit-content")]
FitContentFunction(LengthPercent),
}
pub use self::GenericSize as Size;
@ -208,6 +211,9 @@ pub enum GenericMaxSize<LengthPercent> {
MozFitContent,
#[animation(error)]
MozAvailable,
#[animation(error)]
#[css(function = "fit-content")]
FitContentFunction(LengthPercent),
}
pub use self::GenericMaxSize as MaxSize;

View File

@ -1238,6 +1238,30 @@ macro_rules! parse_size_non_length {
}};
}
#[cfg(feature = "gecko")]
fn is_fit_content_function_enabled() -> bool {
static_prefs::pref!("layout.css.fit-content-function.enabled")
}
#[cfg(feature = "servo")]
fn is_fit_content_function_enabled() -> bool {
false
}
macro_rules! parse_fit_content_function {
($size:ident, $input:expr, $context:expr, $allow_quirks:expr) => {
if is_fit_content_function_enabled() {
if let Ok(length) = $input.try_parse(|input| {
input.expect_function_matching("fit-content")?;
input.parse_nested_block(|i| {
NonNegativeLengthPercentage::parse_quirky($context, i, $allow_quirks)
})
}) {
return Ok($size::FitContentFunction(length));
}
}
};
}
impl Size {
/// Parses, with quirks.
pub fn parse_quirky<'i, 't>(
@ -1246,6 +1270,7 @@ impl Size {
allow_quirks: AllowQuirks,
) -> Result<Self, ParseError<'i>> {
parse_size_non_length!(Size, input, "auto" => Auto);
parse_fit_content_function!(Size, input, context, allow_quirks);
let length = NonNegativeLengthPercentage::parse_quirky(context, input, allow_quirks)?;
Ok(GenericSize::LengthPercentage(length))
@ -1278,6 +1303,7 @@ impl MaxSize {
allow_quirks: AllowQuirks,
) -> Result<Self, ParseError<'i>> {
parse_size_non_length!(MaxSize, input, "none" => None);
parse_fit_content_function!(MaxSize, input, context, allow_quirks);
let length = NonNegativeLengthPercentage::parse_quirky(context, input, allow_quirks)?;
Ok(GenericMaxSize::LengthPercentage(length))

View File

@ -0,0 +1 @@
prefs: [layout.css.fit-content-function.enabled:true]

View File

@ -1,10 +0,0 @@
[height-valid.html]
[e.style['height'\] = "fit-content(10%)" should set the property value]
expected: FAIL
[e.style['height'\] = "fit-content(0.5em)" should set the property value]
expected: FAIL
[e.style['height'\] = "fit-content(10% - 0.5em)" should set the property value]
expected: FAIL

View File

@ -1,10 +0,0 @@
[max-height-valid.html]
[e.style['max-height'\] = "fit-content(0.5em)" should set the property value]
expected: FAIL
[e.style['max-height'\] = "fit-content(10% - 0.5em)" should set the property value]
expected: FAIL
[e.style['max-height'\] = "fit-content(10%)" should set the property value]
expected: FAIL

View File

@ -1,10 +0,0 @@
[max-width-valid.html]
[e.style['max-width'\] = "fit-content(0.5em)" should set the property value]
expected: FAIL
[e.style['max-width'\] = "fit-content(10%)" should set the property value]
expected: FAIL
[e.style['max-width'\] = "fit-content(10% - 0.5em)" should set the property value]
expected: FAIL

View File

@ -1,10 +0,0 @@
[min-height-valid.html]
[e.style['min-height'\] = "fit-content(10%)" should set the property value]
expected: FAIL
[e.style['min-height'\] = "fit-content(0.5em)" should set the property value]
expected: FAIL
[e.style['min-height'\] = "fit-content(10% - 0.5em)" should set the property value]
expected: FAIL

View File

@ -1,10 +0,0 @@
[min-width-valid.html]
[e.style['min-width'\] = "fit-content(10% - 0.5em)" should set the property value]
expected: FAIL
[e.style['min-width'\] = "fit-content(10%)" should set the property value]
expected: FAIL
[e.style['min-width'\] = "fit-content(0.5em)" should set the property value]
expected: FAIL

View File

@ -1,10 +0,0 @@
[width-valid.html]
[e.style['width'\] = "fit-content(10% - 0.5em)" should set the property value]
expected: FAIL
[e.style['width'\] = "fit-content(0.5em)" should set the property value]
expected: FAIL
[e.style['width'\] = "fit-content(10%)" should set the property value]
expected: FAIL

View File

@ -22,7 +22,7 @@ test_valid_value("height", "calc(10% - 0.5em)");
test_valid_value("height", "fit-content(10%)");
test_valid_value("height", "fit-content(0.5em)");
test_valid_value("height", "fit-content(10% - 0.5em)");
test_valid_value("height", "fit-content(calc(10% - 0.5em))");
</script>
</body>
</html>

View File

@ -28,7 +28,10 @@ test_computed_value('max-height', 'calc(10% + 40px)');
test_computed_value('max-height', 'calc(10px - 0.5em)', '0px');
test_computed_value('max-height', 'calc(10px + 0.5em)', '30px');
// fit-content not yet tested
test_computed_value("max-height", "fit-content(10px)");
test_computed_value("max-height", "fit-content(20%)");
test_computed_value("max-height", "fit-content(calc(10% + 40px))");
test_computed_value("max-height", "fit-content(calc(10px + 0.5em))", "fit-content(30px)");
</script>
</body>
</html>

View File

@ -22,7 +22,7 @@ test_valid_value("max-height", "calc(10% - 0.5em)");
test_valid_value("max-height", "fit-content(10%)");
test_valid_value("max-height", "fit-content(0.5em)");
test_valid_value("max-height", "fit-content(10% - 0.5em)");
test_valid_value("max-height", "fit-content(calc(10% - 0.5em))");
</script>
</body>
</html>

View File

@ -28,7 +28,10 @@ test_computed_value('max-width', 'calc(10% + 40px)');
test_computed_value('max-width', 'calc(10px - 0.5em)', '0px');
test_computed_value('max-width', 'calc(10px + 0.5em)', '30px');
// fit-content not yet tested
test_computed_value("max-width", "fit-content(10px)");
test_computed_value("max-width", "fit-content(20%)");
test_computed_value("max-width", "fit-content(calc(10% + 40px))");
test_computed_value("max-width", "fit-content(calc(10px + 0.5em))", "fit-content(30px)");
</script>
</body>
</html>

View File

@ -22,7 +22,7 @@ test_valid_value("max-width", "calc(10% - 0.5em)");
test_valid_value("max-width", "fit-content(10%)");
test_valid_value("max-width", "fit-content(0.5em)");
test_valid_value("max-width", "fit-content(10% - 0.5em)");
test_valid_value("max-width", "fit-content(calc(10% - 0.5em))");
</script>
</body>
</html>

View File

@ -27,7 +27,10 @@ test_computed_value('min-height', 'calc(10% + 40px)');
test_computed_value('min-height', 'calc(10px - 0.5em)', '0px');
test_computed_value('min-height', 'calc(10px + 0.5em)', '30px');
// fit-content not yet tested
test_computed_value("min-height", "fit-content(10px)");
test_computed_value("min-height", "fit-content(20%)");
test_computed_value("min-height", "fit-content(calc(10% + 40px))");
test_computed_value("min-height", "fit-content(calc(10px + 0.5em))", "fit-content(30px)");
</script>
</body>
</html>

View File

@ -22,7 +22,7 @@ test_valid_value("min-height", "calc(10% - 0.5em)");
test_valid_value("min-height", "fit-content(10%)");
test_valid_value("min-height", "fit-content(0.5em)");
test_valid_value("min-height", "fit-content(10% - 0.5em)");
test_valid_value("min-height", "fit-content(calc(10% - 0.5em))");
</script>
</body>
</html>

View File

@ -27,7 +27,10 @@ test_computed_value('min-width', 'calc(10% + 40px)');
test_computed_value('min-width', 'calc(10px - 0.5em)', '0px');
test_computed_value('min-width', 'calc(10px + 0.5em)', '30px');
// fit-content not yet tested
test_computed_value("min-width", "fit-content(10px)");
test_computed_value("min-width", "fit-content(20%)");
test_computed_value("min-width", "fit-content(calc(10% + 40px))");
test_computed_value("min-width", "fit-content(calc(10px + 0.5em))", "fit-content(30px)");
</script>
</body>
</html>

View File

@ -22,7 +22,7 @@ test_valid_value("min-width", "calc(10% - 0.5em)");
test_valid_value("min-width", "fit-content(10%)");
test_valid_value("min-width", "fit-content(0.5em)");
test_valid_value("min-width", "fit-content(10% - 0.5em)");
test_valid_value("min-width", "fit-content(calc(10% - 0.5em))");
</script>
</body>
</html>

View File

@ -22,7 +22,7 @@ test_valid_value("width", "calc(10% - 0.5em)");
test_valid_value("width", "fit-content(10%)");
test_valid_value("width", "fit-content(0.5em)");
test_valid_value("width", "fit-content(10% - 0.5em)");
test_valid_value("width", "fit-content(calc(10% - 0.5em))");
</script>
</body>
</html>