[webkit-changes] [WebKit/WebKit] cd960b: Make Node's OptionSet<TypeFlag> more robust

Ryosuke Niwa noreply at github.com
Tue Jan 2 16:28:56 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cd960b2c7a549558d0b3923bb5508779e29c8d8c
      https://github.com/WebKit/WebKit/commit/cd960b2c7a549558d0b3923bb5508779e29c8d8c
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
    M Source/WebCore/Modules/model-element/HTMLModelElement.cpp
    M Source/WebCore/Modules/model-element/HTMLModelElement.h
    M Source/WebCore/dom/Attr.cpp
    M Source/WebCore/dom/CDATASection.cpp
    M Source/WebCore/dom/CharacterData.h
    M Source/WebCore/dom/ContainerNode.h
    M Source/WebCore/dom/DocumentFragment.cpp
    M Source/WebCore/dom/DocumentFragment.h
    M Source/WebCore/dom/DocumentType.cpp
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Node.h
    M Source/WebCore/dom/PseudoElement.cpp
    M Source/WebCore/dom/ShadowRoot.cpp
    M Source/WebCore/dom/Text.cpp
    M Source/WebCore/dom/Text.h
    M Source/WebCore/html/HTMLDivElement.cpp
    M Source/WebCore/html/HTMLDivElement.h
    M Source/WebCore/html/HTMLElement.h
    M Source/WebCore/html/HTMLFormControlElement.cpp
    M Source/WebCore/html/HTMLFormControlElement.h
    M Source/WebCore/html/HTMLFrameElementBase.cpp
    M Source/WebCore/html/HTMLFrameElementBase.h
    M Source/WebCore/html/HTMLFrameOwnerElement.h
    M Source/WebCore/html/HTMLFrameSetElement.cpp
    M Source/WebCore/html/HTMLFrameSetElement.h
    M Source/WebCore/html/HTMLImageElement.cpp
    M Source/WebCore/html/HTMLImageElement.h
    M Source/WebCore/html/HTMLLIElement.cpp
    M Source/WebCore/html/HTMLLIElement.h
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/html/HTMLMediaElement.h
    M Source/WebCore/html/HTMLOptionElement.cpp
    M Source/WebCore/html/HTMLOptionElement.h
    M Source/WebCore/html/HTMLPlugInElement.cpp
    M Source/WebCore/html/HTMLPlugInElement.h
    M Source/WebCore/html/HTMLProgressElement.cpp
    M Source/WebCore/html/HTMLProgressElement.h
    M Source/WebCore/html/HTMLUnknownElement.h
    M Source/WebCore/html/shadow/DateTimeFieldElement.cpp
    M Source/WebCore/html/shadow/DateTimeFieldElement.h
    M Source/WebCore/html/shadow/SliderThumbElement.cpp
    M Source/WebCore/html/shadow/SliderThumbElement.h
    M Source/WebCore/html/shadow/SpinButtonElement.cpp
    M Source/WebCore/html/shadow/SpinButtonElement.h
    M Source/WebCore/html/shadow/SwitchThumbElement.cpp
    M Source/WebCore/html/shadow/SwitchThumbElement.h
    M Source/WebCore/html/shadow/SwitchTrackElement.cpp
    M Source/WebCore/html/shadow/SwitchTrackElement.h
    M Source/WebCore/html/shadow/TextControlInnerElements.cpp
    M Source/WebCore/html/shadow/TextControlInnerElements.h
    M Source/WebCore/html/track/TextTrackCue.cpp
    M Source/WebCore/html/track/TextTrackCue.h
    M Source/WebCore/html/track/WebVTTElement.cpp
    M Source/WebCore/mathml/MathMLElement.cpp
    M Source/WebCore/mathml/MathMLElement.h
    M Source/WebCore/mathml/MathMLMathElement.cpp
    M Source/WebCore/mathml/MathMLMathElement.h
    M Source/WebCore/mathml/MathMLPresentationElement.h
    M Source/WebCore/mathml/MathMLRowElement.h
    M Source/WebCore/mathml/MathMLTokenElement.cpp
    M Source/WebCore/mathml/MathMLTokenElement.h
    M Source/WebCore/mathml/MathMLUnknownElement.h
    M Source/WebCore/svg/SVGElement.cpp
    M Source/WebCore/svg/SVGElement.h
    M Source/WebCore/svg/SVGUnknownElement.h

  Log Message:
  -----------
  Make Node's OptionSet<TypeFlag> more robust
https://bugs.webkit.org/show_bug.cgi?id=266836

Reviewed by Wenson Hsieh.

Prior to this PR, each most derived class which specifies OptionSet<TypeFlag> was responsible for
specifying the union of all super classes' TypeFlag. This is rather fragile since each derived class
which specifies OptionSet<TypeFlag> needs to be updated when any new value of TypeFlag gets introduced
or an existing TypeFlag gets removed.

This PR changes it so that each Node's subclass adds TypeFlag which is responsible for representing
the subclass. In other words, each class specifies the difference between the class and its superclass.
The PR removes all Create* declarations and adds more debug assertions in various constructors.

* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::HTMLModelElement):
* Source/WebCore/Modules/model-element/HTMLModelElement.h:
* Source/WebCore/dom/Attr.cpp:
(WebCore::Attr::Attr):
* Source/WebCore/dom/CDATASection.cpp:
(WebCore::CDATASection::CDATASection):
* Source/WebCore/dom/CharacterData.h:
(WebCore::CharacterData::CharacterData):
* Source/WebCore/dom/ContainerNode.h:
(WebCore::ContainerNode::ContainerNode):
* Source/WebCore/dom/DocumentFragment.cpp:
(WebCore::DocumentFragment::DocumentFragment):
(WebCore::DocumentFragment::createForInnerOuterHTML):
* Source/WebCore/dom/DocumentFragment.h:
(WebCore::DocumentFragment::DocumentFragment):
* Source/WebCore/dom/DocumentType.cpp:
(WebCore::DocumentType::DocumentType):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::create):
(WebCore::Element::Element):
* Source/WebCore/dom/Node.h:
* Source/WebCore/dom/PseudoElement.cpp:
(WebCore::PseudoElement::PseudoElement):
* Source/WebCore/dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::ShadowRoot):
* Source/WebCore/dom/Text.cpp:
(WebCore::Text::create):
(WebCore::Text::createEditingText):
* Source/WebCore/dom/Text.h:
(WebCore::Text::Text):
* Source/WebCore/html/HTMLDivElement.cpp:
(WebCore::HTMLDivElement::HTMLDivElement):
* Source/WebCore/html/HTMLDivElement.h:
(WebCore::HTMLDivElement::HTMLDivElement):
* Source/WebCore/html/HTMLElement.h:
(WebCore::HTMLElement::HTMLElement):
* Source/WebCore/html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::HTMLFormControlElement):
* Source/WebCore/html/HTMLFormControlElement.h:
* Source/WebCore/html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::HTMLFrameElementBase):
* Source/WebCore/html/HTMLFrameElementBase.h:
* Source/WebCore/html/HTMLFrameOwnerElement.h:
(WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement):
* Source/WebCore/html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::HTMLFrameSetElement):
* Source/WebCore/html/HTMLFrameSetElement.h:
* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::HTMLImageElement):
* Source/WebCore/html/HTMLImageElement.h:
* Source/WebCore/html/HTMLLIElement.cpp:
(WebCore::HTMLLIElement::HTMLLIElement):
* Source/WebCore/html/HTMLLIElement.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::HTMLOptionElement):
* Source/WebCore/html/HTMLOptionElement.h:
* Source/WebCore/html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::HTMLPlugInElement):
* Source/WebCore/html/HTMLPlugInElement.h:
* Source/WebCore/html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::HTMLProgressElement):
* Source/WebCore/html/HTMLProgressElement.h:
* Source/WebCore/html/HTMLUnknownElement.h:
* Source/WebCore/html/shadow/DateTimeFieldElement.cpp:
(WebCore::DateTimeFieldElement::DateTimeFieldElement):
* Source/WebCore/html/shadow/DateTimeFieldElement.h:
* Source/WebCore/html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::SliderThumbElement):
(WebCore::SliderContainerElement::SliderContainerElement):
* Source/WebCore/html/shadow/SliderThumbElement.h:
* Source/WebCore/html/shadow/SpinButtonElement.cpp:
(WebCore::SpinButtonElement::SpinButtonElement):
* Source/WebCore/html/shadow/SpinButtonElement.h:
* Source/WebCore/html/shadow/SwitchThumbElement.cpp:
(WebCore::SwitchThumbElement::SwitchThumbElement):
* Source/WebCore/html/shadow/SwitchThumbElement.h:
* Source/WebCore/html/shadow/SwitchTrackElement.cpp:
(WebCore::SwitchTrackElement::SwitchTrackElement):
* Source/WebCore/html/shadow/SwitchTrackElement.h:
* Source/WebCore/html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerContainer::TextControlInnerContainer):
(WebCore::TextControlInnerElement::TextControlInnerElement):
(WebCore::TextControlInnerTextElement::TextControlInnerTextElement):
(WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
(WebCore::SearchFieldResultsButtonElement::SearchFieldResultsButtonElement):
(WebCore::SearchFieldCancelButtonElement::SearchFieldCancelButtonElement):
* Source/WebCore/html/shadow/TextControlInnerElements.h:
* Source/WebCore/html/track/TextTrackCue.cpp:
(WebCore::TextTrackCueBox::TextTrackCueBox):
* Source/WebCore/html/track/TextTrackCue.h:
* Source/WebCore/html/track/WebVTTElement.cpp:
(WebCore::WebVTTElement::WebVTTElement):
* Source/WebCore/mathml/MathMLElement.cpp:
(WebCore::MathMLElement::MathMLElement):
* Source/WebCore/mathml/MathMLElement.h:
(WebCore::MathMLElement::MathMLElement):
* Source/WebCore/mathml/MathMLMathElement.cpp:
(WebCore::MathMLMathElement::MathMLMathElement):
* Source/WebCore/mathml/MathMLMathElement.h:
* Source/WebCore/mathml/MathMLPresentationElement.h:
(WebCore::MathMLPresentationElement::MathMLPresentationElement):
* Source/WebCore/mathml/MathMLRowElement.h:
(WebCore::MathMLRowElement::MathMLRowElement):
* Source/WebCore/mathml/MathMLTokenElement.cpp:
(WebCore::MathMLTokenElement::MathMLTokenElement):
* Source/WebCore/mathml/MathMLTokenElement.h:
* Source/WebCore/mathml/MathMLUnknownElement.h:
* Source/WebCore/svg/SVGElement.cpp:
(WebCore::SVGElement::SVGElement):
* Source/WebCore/svg/SVGElement.h:
(WebCore::SVGElement::SVGElement):
* Source/WebCore/svg/SVGUnknownElement.h:

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




More information about the webkit-changes mailing list