Bug 1839223 - Remove nsMappedAttributes. r=smaug

Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
This commit is contained in:
Emilio Cobos Álvarez
2023-06-22 14:31:16 +00:00
parent 0900bbbcc7
commit a28183ac0e
95 changed files with 1131 additions and 2187 deletions

View File

@@ -13,7 +13,7 @@
#include "mozilla/dom/HTMLTextAreaElementBinding.h"
#include "mozilla/dom/MutationEventBinding.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/MappedDeclarations.h"
#include "mozilla/MappedDeclarationsBuilder.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresState.h"
#include "mozilla/TextControlState.h"
@@ -32,8 +32,6 @@
#include "nsITextControlFrame.h"
#include "nsLayoutUtils.h"
#include "nsLinebreakConverter.h"
#include "nsMappedAttributes.h"
#include "nsPIDOMWindow.h"
#include "nsPresContext.h"
#include "nsReadableUtils.h"
#include "nsStyleConsts.h"
@@ -378,20 +376,18 @@ bool HTMLTextAreaElement::ParseAttribute(int32_t aNamespaceID,
}
void HTMLTextAreaElement::MapAttributesIntoRule(
const nsMappedAttributes* aAttributes, MappedDeclarations& aDecls) {
MappedDeclarationsBuilder& aBuilder) {
// wrap=off
if (!aDecls.PropertyIsSet(eCSSProperty_white_space)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::wrap);
if (!aBuilder.PropertyIsSet(eCSSProperty_white_space)) {
const nsAttrValue* value = aBuilder.GetAttr(nsGkAtoms::wrap);
if (value && value->Type() == nsAttrValue::eString &&
value->Equals(nsGkAtoms::OFF, eIgnoreCase)) {
aDecls.SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Pre);
aBuilder.SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Pre);
}
}
nsGenericHTMLFormControlElementWithState::MapDivAlignAttributeInto(
aAttributes, aDecls);
nsGenericHTMLFormControlElementWithState::MapCommonAttributesInto(aAttributes,
aDecls);
nsGenericHTMLFormControlElementWithState::MapDivAlignAttributeInto(aBuilder);
nsGenericHTMLFormControlElementWithState::MapCommonAttributesInto(aBuilder);
}
nsChangeHint HTMLTextAreaElement::GetAttributeChangeHint(