RESOLVED FIXED 278042
[text-box] Add support for text-box shorthand
https://bugs.webkit.org/show_bug.cgi?id=278042
Summary [text-box] Add support for text-box shorthand
Attachments
Patch (8.50 KB, patch)
2024-08-13 20:38 PDT, zalan
no flags
Patch (8.50 KB, patch)
2024-08-14 05:12 PDT, zalan
no flags
Patch (11.17 KB, patch)
2024-08-14 15:55 PDT, zalan
no flags
Patch (13.41 KB, patch)
2024-08-14 17:15 PDT, zalan
no flags
[fast-cq]Patch (14.01 KB, patch)
2024-08-15 05:19 PDT, zalan
no flags
zalan
Comment 1 2024-08-13 20:38:34 PDT
zalan
Comment 2 2024-08-14 05:12:57 PDT
Tim Nguyen (:ntim)
Comment 3 2024-08-14 10:30:23 PDT
Comment on attachment 472153 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=472153&action=review > Source/WebCore/css/parser/CSSPropertyParser.cpp:2626 > + if (RefPtr trimValue = consumeIdent<CSSValueNone, CSSValueTrimStart, CSSValueTrimEnd, CSSValueTrimBoth>(m_range)) { You can set `"parser-exported": true` in CSSProperties.json and use the generated `CSSPropertyParsing::consumeTextBoxTrim` to avoid duplication. > Source/WebCore/css/parser/CSSPropertyParser.cpp:2661 > + auto consumeTextBoxEdge = [&] { > + if (RefPtr<CSSValue> textBoxEdge = consumeTextEdge(CSSPropertyTextBoxEdge, m_range)) { > + addProperty(CSSPropertyTextBoxEdge, CSSPropertyTextBox, WTFMove(textBoxEdge), important); > + return true; > + } > + return false; > + }; > + auto hasTextBoxEdge = consumeTextBoxEdge(); > + > + if (hasTextBoxTrim && hasTextBoxEdge) > + return m_range.atEnd(); > + > + if (!hasTextBoxTrim && !hasTextBoxEdge) > + return false; > + > + if (hasTextBoxTrim) { > + if (!consumeTextBoxEdge()) { > + // Omitting the text-box-edge value sets it to auto (the initial value) > + addProperty(CSSPropertyTextBoxEdge, CSSPropertyTextBox, CSSValueList::createSpaceSeparated(CSSPrimitiveValue::create(CSSValueAuto), CSSPrimitiveValue::create(CSSValueAuto)), important); > + } > + return true; > + } > + > + if (!consumeTextBoxTrim()) { > + // Omitting the text-box-trim value sets it to both (not the initial value) > + addProperty(CSSPropertyTextBoxTrim, CSSPropertyTextBox, CSSPrimitiveValue::create(CSSValueTrimBoth), important); > + } > + return true; You could be doing a loop like `CSSPropertyParser::consumeTextWrapShorthand` which would be more elegant than trying to repeat parsing on both sides.
zalan
Comment 4 2024-08-14 15:55:48 PDT
zalan
Comment 5 2024-08-14 17:15:40 PDT
zalan
Comment 6 2024-08-15 05:19:51 PDT
Created attachment 472173 [details] [fast-cq]Patch
EWS
Comment 7 2024-08-15 06:59:14 PDT
Committed 282282@main (c00fddd06efe): <https://commits.webkit.org/282282@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 472173 [details].
Radar WebKit Bug Importer
Comment 8 2024-08-15 07:00:15 PDT
Note You need to log in before you can comment on or make changes to this bug.