[webkit-changes] [WebKit/WebKit] 7279f1: Introduce AttributeName enumeration

Chris Dumez noreply at github.com
Thu Apr 13 13:47:30 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7279f1496728bc8835c296b8fa406a9dd110b363
      https://github.com/WebKit/WebKit/commit/7279f1496728bc8835c296b8fa406a9dd110b363
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-04-13 (Thu, 13 Apr 2023)

  Changed paths:
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-output.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/QualifiedName.cpp
    M Source/WebCore/dom/QualifiedName.h
    M Source/WebCore/dom/QualifiedNameCache.cpp
    M Source/WebCore/dom/QualifiedNameCache.h
    M Source/WebCore/dom/make_names.pl
    M Source/WebCore/html/BaseDateAndTimeInputType.cpp
    M Source/WebCore/html/HTMLBodyElement.cpp
    M Source/WebCore/html/HTMLElement.cpp
    M Source/WebCore/html/HTMLFormElement.cpp
    M Source/WebCore/html/HTMLInputElement.cpp
    M Source/WebCore/html/HTMLOListElement.cpp
    M Source/WebCore/html/HTMLOptionElement.cpp
    M Source/WebCore/html/HTMLSelectElement.cpp
    M Source/WebCore/html/HTMLTableElement.cpp
    M Source/WebCore/html/HTMLTextAreaElement.cpp
    M Source/WebCore/html/parser/HTMLConstructionSite.cpp

  Log Message:
  -----------
  Introduce AttributeName enumeration
https://bugs.webkit.org/show_bug.cgi?id=255382

Reviewed by Darin Adler.

Introduce AttributeName enumeration for all attribute names. We have a lot of
code that can benefit from this enumeration to do switch statements instead
of consecutive `if` checks. The new code is a bit more efficient.

This is similar to what we already did for element names with the ElementName
enumeration.

I only ported some of the code base to new AttributeName enumeration in this
patch, because the patch was getting too big. I plan to port more in follow
ups.

* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isElementsArrayReflectionAttribute):
(WebCore::Element::attributeChanged):
* Source/WebCore/dom/QualifiedName.cpp:
(WebCore::QualifiedName::QualifiedNameImpl::QualifiedNameImpl):
(WebCore::QualifiedName::QualifiedName):
(WebCore::QualifiedName::init):
(WebCore::nullQName):
* Source/WebCore/dom/QualifiedName.h:
(WebCore::QualifiedName::attributeName const):
* Source/WebCore/dom/QualifiedNameCache.cpp:
(WebCore::updateImplWithNamespaceAndElementName):
(WebCore::QualifiedNameCache::getOrCreate):
* Source/WebCore/dom/QualifiedNameCache.h:
* Source/WebCore/dom/make_names.pl:
(defaultAttrPropertyHash):
(attributeCount):
(collectAllElementsAndAttrsPerNamespace):
(byAttributeNameOrder):
(printAttributeNameHeaderFile):
(printAttributeNameCppFile):
(printNamesCppFile):
(printDefinitions):
(printFactoryCppFile):
(printWrapperFactoryCppFile):
* Source/WebCore/html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::attributeChanged):
* Source/WebCore/html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLBodyElement::collectPresentationalHintsForAttribute):
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::HTMLElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLElement::attributeChanged):
* Source/WebCore/html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::attributeChanged):
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLInputElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLInputElement::attributeChanged):
* Source/WebCore/html/HTMLOListElement.cpp:
(WebCore::HTMLOListElement::attributeChanged):
* Source/WebCore/html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::attributeChanged):
* Source/WebCore/html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::attributeChanged):
* Source/WebCore/html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::attributeChanged):
* Source/WebCore/html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::attributeChanged):
* Source/WebCore/html/parser/HTMLConstructionSite.cpp:
(WebCore::qualifiedNameForTag):
(WebCore::qualifiedNameForHTMLTag):

Canonical link: https://commits.webkit.org/262929@main




More information about the webkit-changes mailing list