WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
248638
Initial value for -webkit-line-clamp can't be expressed with its grammar
https://bugs.webkit.org/show_bug.cgi?id=248638
Summary
Initial value for -webkit-line-clamp can't be expressed with its grammar
Oriol Brufau
Reported
2022-12-01 16:35:35 PST
-webkit-line-clamp is defined with
https://searchfox.org/wubkat/rev/2cf89aa97e32bfcb31d92b41d7b17875e9a5dafd/Source/WebCore/css/CSSProperties.json#7185
"parser-grammar": ["<percentage [0,inf]>", "<integer [1,inf]>"] With this mappings:
https://searchfox.org/wubkat/rev/2cf89aa97e32bfcb31d92b41d7b17875e9a5dafd/Source/WebCore/css/CSSPrimitiveValueMappings.h#130-134
if (primitiveType() == CSSUnitType::CSS_INTEGER) return LineClampValue(value<int>(), LineClamp::LineCount); if (primitiveType() == CSSUnitType::CSS_PERCENTAGE) return LineClampValue(value<int>(), LineClamp::Percentage); However, the initial value is
https://searchfox.org/wubkat/rev/2cf89aa97e32bfcb31d92b41d7b17875e9a5dafd/Source/WebCore/rendering/style/RenderStyle.h#1857
static LineClampValue initialLineClamp() { return LineClampValue(); } Defined as
https://searchfox.org/wubkat/rev/2cf89aa97e32bfcb31d92b41d7b17875e9a5dafd/Source/WebCore/rendering/style/LineClampValue.h#33-35
LineClampValue() : m_type(LineClamp::LineCount) , m_value(-1) So this value can't be represented with a non-negative integer/percentage. Note that LineClampValue uses isNone() to refer to that
https://searchfox.org/wubkat/rev/2cf89aa97e32bfcb31d92b41d7b17875e9a5dafd/Source/WebCore/rendering/style/LineClampValue.h#49
bool isNone() const { return m_value == -1; } And in getComputedStyle() is serializes as "none":
https://searchfox.org/wubkat/rev/2cf89aa97e32bfcb31d92b41d7b17875e9a5dafd/Source/WebCore/css/ComputedStyleExtractor.cpp#3348-3349
if (style.lineClamp().isNone()) return cssValuePool.createIdentifierValue(CSSValueNone); So I guess -webkit-line-clamp:none should be valid? Now it's broken: document.body.style.webkitLineClamp = "initial"; getComputedStyle(document.body).webkitLineClamp; // "none" CSS.supports("-webkit-line-clamp", "none"); // false
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2022-12-08 16:36:16 PST
<
rdar://problem/103158259
>
Tim Nguyen (:ntim)
Comment 2
2024-08-04 16:49:46 PDT
***
Bug 277616
has been marked as a duplicate of this bug. ***
Tim Nguyen (:ntim)
Comment 3
2024-08-04 17:12:22 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/31709
EWS
Comment 4
2024-08-05 05:34:30 PDT
Committed
281826@main
(25af638fc712): <
https://commits.webkit.org/281826@main
> Reviewed commits have been landed. Closing PR #31709 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug