Bug 248346

Summary: -webkit-mask-box-image-slice:initial is not the initial value
Product: WebKit Reporter: Oriol Brufau <obrufau>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: darin, hyatt, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=249079
Bug Depends on:    
Bug Blocks: 248325    
Attachments:
Description Flags
testcase
none
screenshot none

Description Oriol Brufau 2022-11-25 09:04:19 PST
Created attachment 463732 [details]
testcase

If no -webkit-mask-box-image-slice is provided, then https://searchfox.org/wubkat/rev/70230d10f272f17151f1e77d496553716b449cea/Source/WebCore/rendering/style/NinePieceImage.h uses

    data.imageSlices = LengthBox(0);

However, if you specify -webkit-mask-box-image-slice:initial, then https://searchfox.org/wubkat/rev/70230d10f272f17151f1e77d496553716b449cea/Source/WebCore/style/StyleBuilderCustom.h#536

    image.setImageSlices(LengthBox());

These are different:
 - LengthBox() has lengths of LengthType::Auto and in NinePieceImage::computeSlices they will behave like Length(100, LengthType::Percent).
 - LengthBox(0) has Length(0, LengthType::Fixed).

Using LengthBox() seems clearly wrong, I think there are 2 possibilities:
 - Switch both places to using LengthBox(0).
   This will match the current behavior when no -webkit-mask-box-image-slice is provided.
   This will obey https://www.w3.org/TR/2014/WD-css-masking-1-20140213/#the-mask-box-slice and https://drafts.fxtf.org/css-masking-1/#the-mask-border-slice
 - Switch both places to using LengthBox(Length(100, LengthType::Percent), Length(100, LengthType::Percent), Length(100, LengthType::Percent), Length(100, LengthType::Percent))
   This will match the current behavior when using -webkit-mask-box-image-slice:initial
   This will make it consistent with border-image-slice
Comment 1 Oriol Brufau 2022-11-25 09:08:15 PST
Created attachment 463733 [details]
screenshot
Comment 2 Oriol Brufau 2022-11-25 09:22:25 PST
CC Dave Hyatt since this seems to come from bug 67657.
Comment 3 Radar WebKit Bug Importer 2022-12-02 09:05:17 PST
<rdar://problem/102907368>
Comment 4 Darin Adler 2023-03-17 14:10:03 PDT
I was "forced" to fix this to resolve bug 254063.

*** This bug has been marked as a duplicate of bug 254063 ***