#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/html/html_element.h"
#include "base/containers/enum_set.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/forms/form_control_type.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_stringlegacynulltoemptystring_trustedscript.h"
#include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
#include "third_party/blink/renderer/core/css/css_color.h"
#include "third_party/blink/renderer/core/css/css_identifier_value.h"
#include "third_party/blink/renderer/core/css/css_image_value.h"
#include "third_party/blink/renderer/core/css/css_numeric_literal_value.h"
#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/css/css_property_value_set.h"
#include "third_party/blink/renderer/core/css/css_ratio_value.h"
#include "third_party/blink/renderer/core/css/css_value_list.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/css_value_keywords.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/document_fragment.h"
#include "third_party/blink/renderer/core/dom/element_rare_data_vector.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/dom/events/event_listener.h"
#include "third_party/blink/renderer/core/dom/events/scoped_event_queue.h"
#include "third_party/blink/renderer/core/dom/events/simulated_click_options.h"
#include "third_party/blink/renderer/core/dom/flat_tree_traversal.h"
#include "third_party/blink/renderer/core/dom/focus_params.h"
#include "third_party/blink/renderer/core/dom/id_target_observer.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/node_lists_node_data.h"
#include "third_party/blink/renderer/core/dom/node_traversal.h"
#include "third_party/blink/renderer/core/dom/popover_data.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/dom/slot_assignment.h"
#include "third_party/blink/renderer/core/dom/slot_assignment_engine.h"
#include "third_party/blink/renderer/core/dom/slot_assignment_recalc_forbidden_scope.h"
#include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/serializers/markup_accumulator.h"
#include "third_party/blink/renderer/core/editing/serializers/serialization.h"
#include "third_party/blink/renderer/core/editing/spellcheck/spell_checker.h"
#include "third_party/blink/renderer/core/event_type_names.h"
#include "third_party/blink/renderer/core/events/keyboard_event.h"
#include "third_party/blink/renderer/core/events/pointer_event.h"
#include "third_party/blink/renderer/core/events/toggle_event.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/fullscreen/fullscreen.h"
#include "third_party/blink/renderer/core/html/anchor_element_observer.h"
#include "third_party/blink/renderer/core/html/custom/custom_element.h"
#include "third_party/blink/renderer/core/html/custom/custom_element_registry.h"
#include "third_party/blink/renderer/core/html/custom/element_internals.h"
#include "third_party/blink/renderer/core/html/forms/html_button_element.h"
#include "third_party/blink/renderer/core/html/forms/html_data_list_element.h"
#include "third_party/blink/renderer/core/html/forms/html_form_control_element.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/html_label_element.h"
#include "third_party/blink/renderer/core/html/forms/html_listbox_element.h"
#include "third_party/blink/renderer/core/html/forms/labels_node_list.h"
#include "third_party/blink/renderer/core/html/forms/text_control_element.h"
#include "third_party/blink/renderer/core/html/html_bdi_element.h"
#include "third_party/blink/renderer/core/html/html_body_element.h"
#include "third_party/blink/renderer/core/html/html_br_element.h"
#include "third_party/blink/renderer/core/html/html_dialog_element.h"
#include "third_party/blink/renderer/core/html/html_dimension.h"
#include "third_party/blink/renderer/core/html/html_document.h"
#include "third_party/blink/renderer/core/html/html_frame_owner_element.h"
#include "third_party/blink/renderer/core/html/html_slot_element.h"
#include "third_party/blink/renderer/core/html/html_template_element.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/keywords.h"
#include "third_party/blink/renderer/core/layout/adjust_for_absolute_zoom.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/layout/layout_box_model_object.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/mathml/mathml_element.h"
#include "third_party/blink/renderer/core/mathml_names.h"
#include "third_party/blink/renderer/core/page/spatial_navigation.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/svg/svg_svg_element.h"
#include "third_party/blink/renderer/core/timing/soft_navigation_heuristics.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_script.h"
#include "third_party/blink/renderer/core/xml_names.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
namespace blink {
AttributeChangedFunction;
FormControlType;
struct AttributeTriggers { … };
namespace {
bool IsEditableOrEditingHost(const Node& node) { … }
const WebFeature kNoWebFeature = …;
class PopoverCloseWatcherEventListener : public NativeEventListener { … };
class NameInHeapSnapshotBuilder : public MarkupAccumulator { … };
}
String HTMLElement::nodeName() const { … }
const char* HTMLElement::NameInHeapSnapshot() const { … }
bool HTMLElement::ShouldSerializeEndTag() const { … }
static inline CSSValueID UnicodeBidiAttributeForDirAuto(HTMLElement* element) { … }
unsigned HTMLElement::ParseBorderWidthAttribute(
const AtomicString& value) const { … }
void HTMLElement::ApplyBorderAttributeToStyle(
const AtomicString& value,
MutableCSSPropertyValueSet* style) { … }
bool HTMLElement::IsPresentationAttribute(const QualifiedName& name) const { … }
bool HTMLElement::IsValidDirAttribute(const AtomicString& value) { … }
void HTMLElement::CollectStyleForPresentationAttribute(
const QualifiedName& name,
const AtomicString& value,
MutableCSSPropertyValueSet* style) { … }
AttributeTriggers* HTMLElement::TriggersForAttributeName(
const QualifiedName& attr_name) { … }
const AtomicString& HTMLElement::EventNameForAttributeName(
const QualifiedName& attr_name) { … }
void HTMLElement::AttributeChanged(const AttributeModificationParams& params) { … }
void HTMLElement::ParseAttribute(const AttributeModificationParams& params) { … }
DocumentFragment* HTMLElement::TextToFragment(const String& text,
ExceptionState& exception_state) { … }
V8UnionStringLegacyNullToEmptyStringOrTrustedScript*
HTMLElement::innerTextForBinding() { … }
void HTMLElement::setInnerTextForBinding(
const V8UnionStringLegacyNullToEmptyStringOrTrustedScript*
string_or_trusted_script,
ExceptionState& exception_state) { … }
void HTMLElement::setInnerText(const String& text) { … }
void HTMLElement::setOuterText(const String& text,
ExceptionState& exception_state) { … }
void HTMLElement::ApplyAspectRatioToStyle(const AtomicString& width,
const AtomicString& height,
MutableCSSPropertyValueSet* style) { … }
void HTMLElement::ApplyIntegerAspectRatioToStyle(
const AtomicString& width,
const AtomicString& height,
MutableCSSPropertyValueSet* style) { … }
void HTMLElement::ApplyAspectRatioToStyle(double width,
double height,
MutableCSSPropertyValueSet* style) { … }
void HTMLElement::ApplyAlignmentAttributeToStyle(
const AtomicString& alignment,
MutableCSSPropertyValueSet* style) { … }
bool HTMLElement::HasCustomFocusLogic() const { … }
ContentEditableType HTMLElement::contentEditableNormalized() const { … }
String HTMLElement::contentEditable() const { … }
void HTMLElement::setContentEditable(const String& enabled,
ExceptionState& exception_state) { … }
V8UnionBooleanOrStringOrUnrestrictedDouble* HTMLElement::hidden() const { … }
void HTMLElement::setHidden(
const V8UnionBooleanOrStringOrUnrestrictedDouble* value) { … }
namespace {
PopoverValueType GetPopoverTypeFromAttributeValue(const AtomicString& value) { … }
}
void HTMLElement::UpdatePopoverAttribute(const AtomicString& value) { … }
bool HTMLElement::HasPopoverAttribute() const { … }
AtomicString HTMLElement::popover() const { … }
void HTMLElement::setPopover(const AtomicString& value) { … }
PopoverValueType HTMLElement::PopoverType() const { … }
bool HTMLElement::popoverOpen() const { … }
bool HTMLElement::IsPopoverReady(PopoverTriggerAction action,
ExceptionState* exception_state,
bool include_event_handler_text,
Document* expected_document) const { … }
namespace {
void MarkPopoverInvokersDirty(const HTMLElement& popover) { … }
}
bool HTMLElement::togglePopover(ExceptionState& exception_state) { … }
bool HTMLElement::togglePopover(bool force, ExceptionState& exception_state) { … }
void HTMLElement::showPopover(ExceptionState& exception_state) { … }
void HTMLElement::ShowPopoverInternal(Element* invoker,
ExceptionState* exception_state) { … }
void HTMLElement::CloseEntirePopoverStack(
HTMLDocument::PopoverStack& stack,
HidePopoverFocusBehavior focus_behavior,
HidePopoverTransitionBehavior transition_behavior) { … }
void HTMLElement::HideAllPopoversUntil(
const HTMLElement* endpoint,
Document& document,
HidePopoverFocusBehavior focus_behavior,
HidePopoverTransitionBehavior transition_behavior) { … }
void HTMLElement::hidePopover(ExceptionState& exception_state) { … }
void HTMLElement::HidePopoverInternal(
HidePopoverFocusBehavior focus_behavior,
HidePopoverTransitionBehavior transition_behavior,
ExceptionState* exception_state) { … }
void HTMLElement::SetPopoverFocusOnShow() { … }
namespace {
enum class PopoverAncestorOptions { … };
PopoverAncestorOptionsSet;
template <typename UnaryPredicate>
const HTMLElement* NearestMatchingAncestor(
const Node* original_node,
const PopoverAncestorOptionsSet ancestor_options,
const UnaryPredicate get_candidate_popover) { … }
const HTMLElement* NearestOpenPopover(
const Node* node,
const PopoverAncestorOptionsSet ancestor_options =
PopoverAncestorOptionsSet()) { … }
const HTMLElement* NearestTargetPopoverForInvoker(
const Node* node,
const PopoverAncestorOptionsSet ancestor_options =
PopoverAncestorOptionsSet()) { … }
}
const HTMLElement* HTMLElement::FindTopmostPopoverAncestor(
Element& new_popover_or_top_layer_element,
HTMLDocument::PopoverStack& stack_to_check,
Element* new_popovers_invoker,
TopLayerElementType top_layer_element_type) { … }
const HTMLElement* HTMLElement::TopLayerElementPopoverAncestor(
Element& top_layer_element,
TopLayerElementType top_layer_element_type) { … }
namespace {
const HTMLElement* FindTopmostRelatedPopover(
const Node& node,
const PopoverAncestorOptionsSet& ancestor_options =
PopoverAncestorOptionsSet()) { … }
}
void HTMLElement::HandlePopoverLightDismiss(const Event& event,
const Node& target_node) { … }
void HTMLElement::InvokePopover(Element& invoker) { … }
bool HTMLElement::IsNodePopoverDescendant(const Node& node) const { … }
void HTMLElement::MaybeQueuePopoverHideEvent() { … }
void HTMLElement::HoveredElementChanged(Element* old_element,
Element* new_element) { … }
void HTMLElement::SetInternalImplicitAnchor(HTMLElement* element) { … }
HTMLElement* HTMLElement::internalImplicitAnchor() const { … }
bool HTMLElement::DispatchFocusEvent(
Element* old_focused_element,
mojom::blink::FocusType type,
InputDeviceCapabilities* source_capabilities) { … }
bool HTMLElement::IsValidCommand(HTMLElement& invoker,
CommandEventType command) { … }
bool HTMLElement::HandleCommandInternal(HTMLElement& invoker,
CommandEventType command) { … }
const AtomicString& HTMLElement::autocapitalize() const { … }
void HTMLElement::setAutocapitalize(const AtomicString& value) { … }
bool HTMLElement::isContentEditableForBinding() const { … }
bool HTMLElement::draggable() const { … }
void HTMLElement::setDraggable(bool value) { … }
bool HTMLElement::spellcheck() const { … }
void HTMLElement::setSpellcheck(bool enable) { … }
void HTMLElement::click() { … }
void HTMLElement::AccessKeyAction(SimulatedClickCreationScope creation_scope) { … }
String HTMLElement::title() const { … }
TranslateAttributeMode HTMLElement::GetTranslateAttributeMode() const { … }
bool HTMLElement::translate() const { … }
void HTMLElement::setTranslate(bool enable) { … }
static inline const AtomicString& ToValidDirValue(const AtomicString& value) { … }
const AtomicString& HTMLElement::dir() { … }
void HTMLElement::setDir(const AtomicString& value) { … }
HTMLFormElement* HTMLElement::formOwner() const { … }
HTMLFormElement* HTMLElement::FindFormAncestor() const { … }
bool HTMLElement::ElementAffectsDirectionality(const Node* node) { … }
bool HTMLElement::HasDirectionAuto() const { … }
const TextControlElement*
HTMLElement::ElementIfAutoDirectionalityFormAssociatedOrNull(
const Element* element) { … }
bool HTMLElement::CalculateAndAdjustAutoDirectionality() { … }
void HTMLElement::UpdateDirectionalityAfterInputTypeChange(
const AtomicString& old_value,
const AtomicString& new_value) { … }
void HTMLElement::AdjustDirectionAutoAfterRecalcAssignedNodes() { … }
Node::InsertionNotificationRequest HTMLElement::InsertedInto(
ContainerNode& insertion_point) { … }
void HTMLElement::RemovedFrom(ContainerNode& insertion_point) { … }
void HTMLElement::DidMoveToNewDocument(Document& old_document) { … }
void HTMLElement::AddHTMLLengthToStyle(MutableCSSPropertyValueSet* style,
CSSPropertyID property_id,
const String& value,
AllowPercentage allow_percentage,
AllowZero allow_zero) { … }
static Color ParseColorStringWithCrazyLegacyRules(const String& color_string) { … }
bool HTMLElement::ParseColorWithLegacyRules(const String& attribute_value,
Color& parsed_color) { … }
void HTMLElement::AddHTMLColorToStyle(MutableCSSPropertyValueSet* style,
CSSPropertyID property_id,
const String& attribute_value) { … }
void HTMLElement::AddHTMLBackgroundImageToStyle(
MutableCSSPropertyValueSet* style,
const String& url_value,
const AtomicString& initiator_name) { … }
LabelsNodeList* HTMLElement::labels() { … }
bool HTMLElement::IsInteractiveContent() const { … }
void HTMLElement::DefaultEventHandler(Event& event) { … }
bool HTMLElement::HandleKeyboardActivation(Event& event) { … }
bool HTMLElement::MatchesReadOnlyPseudoClass() const { … }
bool HTMLElement::MatchesReadWritePseudoClass() const { … }
void HTMLElement::HandleKeypressEvent(KeyboardEvent& event) { … }
int HTMLElement::AdjustedOffsetForZoom(LayoutUnit offset) { … }
int HTMLElement::OffsetTopOrLeft(bool top) { … }
int HTMLElement::offsetLeftForBinding() { … }
int HTMLElement::offsetTopForBinding() { … }
int HTMLElement::offsetWidthForBinding() { … }
DISABLE_CFI_PERF
int HTMLElement::offsetHeightForBinding() { … }
Element* HTMLElement::unclosedOffsetParent() { … }
void HTMLElement::OnDirAttrChanged(const AttributeModificationParams& params) { … }
void HTMLElement::OnPopoverChanged(const AttributeModificationParams& params) { … }
void HTMLElement::OnFormAttrChanged(const AttributeModificationParams& params) { … }
void HTMLElement::OnLangAttrChanged(const AttributeModificationParams& params) { … }
void HTMLElement::OnNonceAttrChanged(
const AttributeModificationParams& params) { … }
ElementInternals* HTMLElement::attachInternals(
ExceptionState& exception_state) { … }
bool HTMLElement::IsFormAssociatedCustomElement() const { … }
FocusableState HTMLElement::SupportsFocus(
UpdateBehavior update_behavior) const { … }
bool HTMLElement::IsDisabledFormControl() const { … }
bool HTMLElement::MatchesEnabledPseudoClass() const { … }
bool HTMLElement::MatchesValidityPseudoClasses() const { … }
bool HTMLElement::willValidate() const { … }
bool HTMLElement::IsValidElement() { … }
bool HTMLElement::IsLabelable() const { … }
bool HTMLElement::HasActiveLabel() const { … }
void HTMLElement::FinishParsingChildren() { … }
AtomicString HTMLElement::writingSuggestions() const { … }
void HTMLElement::setWritingSuggestions(const AtomicString& value) { … }
}
#ifndef NDEBUG
void dumpInnerHTML(blink::HTMLElement*);
void dumpInnerHTML(blink::HTMLElement* element) { … }
#endif