diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/custom')
9 files changed, 17 insertions, 67 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element.cc b/chromium/third_party/blink/renderer/core/html/custom/custom_element.cc index 1a031cecfab..eeca328bf00 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element.cc +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element.cc @@ -305,8 +305,7 @@ void CustomElement::EnqueueFormStateRestoreCallback( } } -void CustomElement::TryToUpgrade(Element& element, - bool upgrade_invisible_elements) { +void CustomElement::TryToUpgrade(Element& element) { // Try to upgrade an element // https://html.spec.whatwg.org/C/#concept-try-upgrade @@ -320,7 +319,7 @@ void CustomElement::TryToUpgrade(Element& element, registry->DefinitionFor(CustomElementDescriptor( is_value.IsNull() ? element.localName() : is_value, element.localName()))) - definition->EnqueueUpgradeReaction(element, upgrade_invisible_elements); + definition->EnqueueUpgradeReaction(element); else registry->AddCandidate(element); } diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element.h b/chromium/third_party/blink/renderer/core/html/custom/custom_element.h index 16e077eb151..e30afccf52a 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element.h +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element.h @@ -116,7 +116,7 @@ class CORE_EXPORT CustomElement { const FileOrUSVStringOrFormData& value, const String& mode); - static void TryToUpgrade(Element&, bool upgrade_invisible_elements = false); + static void TryToUpgrade(Element&); static void AddEmbedderCustomElementNameForTesting(const AtomicString& name, ExceptionState&); diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element_definition.cc b/chromium/third_party/blink/renderer/core/html/custom/custom_element_definition.cc index c5e4a121416..3c4b80f4433 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element_definition.cc +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element_definition.cc @@ -275,11 +275,9 @@ bool CustomElementDefinition::HasStyleAttributeChangedCallback() const { return has_style_attribute_changed_callback_; } -void CustomElementDefinition::EnqueueUpgradeReaction( - Element& element, - bool upgrade_invisible_elements) { - CustomElement::Enqueue(element, CustomElementReactionFactory::CreateUpgrade( - *this, upgrade_invisible_elements)); +void CustomElementDefinition::EnqueueUpgradeReaction(Element& element) { + CustomElement::Enqueue(element, + CustomElementReactionFactory::CreateUpgrade(*this)); } void CustomElementDefinition::EnqueueConnectedCallback(Element& element) { diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element_definition.h b/chromium/third_party/blink/renderer/core/html/custom/custom_element_definition.h index a3610a2c26f..4df21e145c3 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element_definition.h +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element_definition.h @@ -98,8 +98,7 @@ class CORE_EXPORT CustomElementDefinition const FileOrUSVStringOrFormData& value, const String& mode) = 0; - void EnqueueUpgradeReaction(Element&, - bool upgrade_invisible_elements = false); + void EnqueueUpgradeReaction(Element&); void EnqueueConnectedCallback(Element&); void EnqueueDisconnectedCallback(Element&); void EnqueueAdoptedCallback(Element&, diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.cc b/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.cc index b0a18bad6e4..859dd263529 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.cc +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.cc @@ -14,28 +14,18 @@ namespace blink { class CustomElementUpgradeReaction final : public CustomElementReaction { public: - CustomElementUpgradeReaction(CustomElementDefinition& definition, - bool upgrade_invisible_elements) - : CustomElementReaction(definition), - upgrade_invisible_elements_(upgrade_invisible_elements) {} + explicit CustomElementUpgradeReaction(CustomElementDefinition& definition) + : CustomElementReaction(definition) {} private: void Invoke(Element& element) override { // Don't call Upgrade() if it's already upgraded. Multiple upgrade reactions // could be enqueued because the state changes in step 10 of upgrades. // https://html.spec.whatwg.org/C/#upgrades - if (element.GetCustomElementState() == CustomElementState::kUndefined) { - // Don't upgrade elements inside an invisible-static tree, unless it was - // triggered by CustomElementRegistry::upgrade. - if (!RuntimeEnabledFeatures::InvisibleDOMEnabled() || - !element.IsInsideInvisibleStaticSubtree() || - upgrade_invisible_elements_) - definition_->Upgrade(element); - } + if (element.GetCustomElementState() == CustomElementState::kUndefined) + definition_->Upgrade(element); } - bool upgrade_invisible_elements_; - DISALLOW_COPY_AND_ASSIGN(CustomElementUpgradeReaction); }; @@ -235,10 +225,8 @@ class CustomElementFormStateRestoreCallbackReaction final // ---------------------------------------------------------------- CustomElementReaction& CustomElementReactionFactory::CreateUpgrade( - CustomElementDefinition& definition, - bool upgrade_invisible_elements) { - return *MakeGarbageCollected<CustomElementUpgradeReaction>( - definition, upgrade_invisible_elements); + CustomElementDefinition& definition) { + return *MakeGarbageCollected<CustomElementUpgradeReaction>(definition); } CustomElementReaction& CustomElementReactionFactory::CreateConnected( diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.h b/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.h index 177bcd7e207..1e74d95cd06 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.h +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.h @@ -22,8 +22,7 @@ class CustomElementReactionFactory { public: static CustomElementReaction& CreateUpgrade( - CustomElementDefinition& definition, - bool upgrade_invisible_elements); + CustomElementDefinition& definition); static CustomElementReaction& CreateConnected( CustomElementDefinition& definition); static CustomElementReaction& CreateDisconnected( diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element_registry.cc b/chromium/third_party/blink/renderer/core/html/custom/custom_element_registry.cc index 59e806f5309..f1579312558 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element_registry.cc +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element_registry.cc @@ -144,7 +144,7 @@ CustomElementDefinition* CustomElementRegistry::DefineInternal( // Step 7. customized built-in elements definition // element interface extends option checks - if (options->hasExtends()) { + if (!options->extends().IsNull()) { // 7.1. If element interface is valid custom element name, throw exception const AtomicString& extends = AtomicString(options->extends()); if (ThrowIfValidName(AtomicString(options->extends()), exception_state)) @@ -355,10 +355,8 @@ void CustomElementRegistry::upgrade(Node* root) { CollectUpgradeCandidateInNode(*root, candidates); // 2. For each candidate of candidates, try to upgrade candidate. - for (auto& candidate : candidates) { - CustomElement::TryToUpgrade(*candidate, - true /* upgrade_invisible_elements */); - } + for (auto& candidate : candidates) + CustomElement::TryToUpgrade(*candidate); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/html/custom/element_internals.cc b/chromium/third_party/blink/renderer/core/html/custom/element_internals.cc index d207f394d88..731e5ebcad3 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/element_internals.cc +++ b/chromium/third_party/blink/renderer/core/html/custom/element_internals.cc @@ -321,30 +321,6 @@ void ElementInternals::SetElementArrayAttribute( } } -HeapVector<Member<Element>> ElementInternals::GetElementArrayAttribute( - const QualifiedName& name, - bool is_null) { - is_null = true; - auto iter = explicitly_set_attr_elements_map_.find(name); - if (iter != explicitly_set_attr_elements_map_.end()) { - is_null = false; - return *(iter->value); - } - return HeapVector<Member<Element>>(); -} - -void ElementInternals::SetElementArrayAttribute( - const QualifiedName& name, - HeapVector<Member<Element>> elements, - bool is_null) { - if (is_null) { - explicitly_set_attr_elements_map_.erase(name); - return; - } - explicitly_set_attr_elements_map_.Set( - name, MakeGarbageCollected<HeapVector<Member<Element>>>(elements)); -} - bool ElementInternals::IsTargetFormAssociated() const { if (Target().IsFormAssociatedCustomElement()) return true; diff --git a/chromium/third_party/blink/renderer/core/html/custom/element_internals.h b/chromium/third_party/blink/renderer/core/html/custom/element_internals.h index dc4133e64e7..18519174b08 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/element_internals.h +++ b/chromium/third_party/blink/renderer/core/html/custom/element_internals.h @@ -67,13 +67,6 @@ class CORE_EXPORT ElementInternals : public ScriptWrappable, void SetElementArrayAttribute( const QualifiedName& name, const base::Optional<HeapVector<Member<Element>>>& elements); - // TODO(crbug.com/1060971): Remove |is_null| version. - HeapVector<Member<Element>> GetElementArrayAttribute( - const QualifiedName& name, - bool is_null); // DEPRECATED - void SetElementArrayAttribute(const QualifiedName&, - HeapVector<Member<Element>>, - bool is_null); // DEPRECATED bool HasAttribute(const QualifiedName& attribute) const; const HashMap<QualifiedName, AtomicString>& GetAttributes() const; |