Bug 1852478 - Convert CSS white-space into a shorthand that expands to white-space-collapse and text-wrap-mode longhands. r=firefox-style-system-reviewers,emilio

Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
This commit is contained in:
Jonathan Kew
2024-01-25 22:20:05 +00:00
parent a1ea168c77
commit 87225af2ba
18 changed files with 267 additions and 162 deletions

View File

@@ -365,12 +365,14 @@ bool HTMLTextAreaElement::ParseAttribute(int32_t aNamespaceID,
void HTMLTextAreaElement::MapAttributesIntoRule(
MappedDeclarationsBuilder& aBuilder) {
// wrap=off
if (!aBuilder.PropertyIsSet(eCSSProperty_white_space)) {
const nsAttrValue* value = aBuilder.GetAttr(nsGkAtoms::wrap);
if (value && value->Type() == nsAttrValue::eString &&
value->Equals(nsGkAtoms::OFF, eIgnoreCase)) {
aBuilder.SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Pre);
}
const nsAttrValue* value = aBuilder.GetAttr(nsGkAtoms::wrap);
if (value && value->Type() == nsAttrValue::eString &&
value->Equals(nsGkAtoms::OFF, eIgnoreCase)) {
// Equivalent to expanding `white-space; pre`
aBuilder.SetKeywordValue(eCSSProperty_white_space_collapse,
StyleWhiteSpaceCollapse::Preserve);
aBuilder.SetKeywordValue(eCSSProperty_text_wrap_mode,
StyleTextWrapMode::Nowrap);
}
nsGenericHTMLFormControlElementWithState::MapDivAlignAttributeInto(aBuilder);