Commit 9153af5e authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Use expected CSSValue type for initial border-image-slice.

The apply code early returns if the type is not a
CSSBorderImageSliceValue. Create an initial value which matches the
expected type.

Bug: 918243
Change-Id: I3228d2410789306d915db892ad54e918631b8864
Reviewed-on: https://chromium-review.googlesource.com/c/1396118Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619951}
parent 1a954303
......@@ -29,9 +29,16 @@ const CSSValue* BorderImageSlice::CSSValueFromComputedStyleInternal(
}
const CSSValue* BorderImageSlice::InitialValue() const {
DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value,
DEFINE_STATIC_LOCAL(Persistent<CSSValue>, hundredPercent,
(CSSPrimitiveValue::Create(
100, CSSPrimitiveValue::UnitType::kPercentage)));
DEFINE_STATIC_LOCAL(
Persistent<CSSQuadValue>, slices,
(CSSQuadValue::Create(hundredPercent, hundredPercent, hundredPercent,
hundredPercent, CSSQuadValue::kSerializeAsQuad)));
DEFINE_STATIC_LOCAL(
Persistent<CSSBorderImageSliceValue>, value,
(CSSBorderImageSliceValue::Create(slices, /* fill */ false)));
return value;
}
......
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#border-image-slice" />
<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#border-image" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
div {
border: 1px solid;
border-image-slice: 1;
}
div {
/* Should reset border-image-slice */
border-image: linear-gradient(black, black);
}
</style>
<div>This text should not have a border, just corner dots</div>
<script>
test(() => {
assert_equals(getComputedStyle(document.querySelector("div")).borderImageSlice, "100%");
}, "Check that the border-image shorthand resets border-image-slice to its initial value.");
</script>
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