Bug 248638
Summary: | Initial value for -webkit-line-clamp can't be expressed with its grammar | ||
---|---|---|---|
Product: | WebKit | Reporter: | Oriol Brufau <obrufau> |
Component: | CSS | Assignee: | Tim Nguyen (:ntim) <ntim> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ntim, sam, 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=248659 |
Oriol Brufau
-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
<rdar://problem/103158259>
Tim Nguyen (:ntim)
*** Bug 277616 has been marked as a duplicate of this bug. ***
Tim Nguyen (:ntim)
Pull request: https://github.com/WebKit/WebKit/pull/31709
EWS
Committed 281826@main (25af638fc712): <https://commits.webkit.org/281826@main>
Reviewed commits have been landed. Closing PR #31709 and removing active labels.