[webkit-changes] [WebKit/WebKit] 3d8458: Use dynamicDowncast<T> even more in the DOM

Chris Dumez noreply at github.com
Mon Nov 13 11:40:49 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3d8458014db3038a39b984ce5763cc66c79af7fc
      https://github.com/WebKit/WebKit/commit/3d8458014db3038a39b984ce5763cc66c79af7fc
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-11-13 (Mon, 13 Nov 2023)

  Changed paths:
    M Source/WebCore/dom/Node.cpp
    M Source/WebCore/dom/Node.h
    M Source/WebCore/dom/NodeTraversal.cpp
    M Source/WebCore/dom/Position.cpp
    M Source/WebCore/dom/Position.h
    M Source/WebCore/dom/PositionIterator.cpp
    M Source/WebCore/dom/Range.cpp
    M Source/WebCore/dom/ScriptElement.cpp
    M Source/WebCore/dom/ScriptExecutionContext.cpp
    M Source/WebCore/dom/SelectorQuery.cpp
    M Source/WebCore/dom/ShadowRoot.h
    M Source/WebCore/dom/SimulatedClick.cpp
    M Source/WebCore/dom/SlotAssignment.cpp
    M Source/WebCore/dom/StyledElement.cpp
    M Source/WebCore/dom/Text.cpp
    M Source/WebCore/dom/TextNodeTraversal.h
    M Source/WebCore/dom/TreeScope.cpp
    M Source/WebCore/dom/TreeScopeOrderedMap.cpp
    M Source/WebCore/dom/mac/ImageControlsMac.cpp

  Log Message:
  -----------
  Use dynamicDowncast<T> even more in the DOM
https://bugs.webkit.org/show_bug.cgi?id=264715

Reviewed by Brent Fulgham.

Use dynamicDowncast<T> even more in the DOM instead of is<T>() + downcast<T>().
It is less error-prone and often results in more concise code. I am also hoping
to have downcast<>() do a type check on release builds in the future. It is
currently too expensive to do so but it may become affordable if we use
dynamicDowncast<T>() instead when possible.

* Source/WebCore/dom/Node.cpp:
(WebCore::Node::dumpStatistics):
(WebCore::Node::childNodes):
(WebCore::Node::insertBefore):
(WebCore::Node::replaceChild):
(WebCore::Node::removeChild):
(WebCore::Node::appendChild):
(WebCore::Node::normalize):
(WebCore::Node::computeEditabilityWithStyle const):
(WebCore::Node::renderRect):
(WebCore::Node::pseudoAwarePreviousSibling const):
(WebCore::Node::pseudoAwareNextSibling const):
(WebCore::Node::pseudoAwareFirstChild const):
(WebCore::Node::pseudoAwareLastChild const):
(WebCore::Node::isClosedShadowHidden const):
(WebCore::Node::parentInComposedTree const):
(WebCore::Node::parentElementInComposedTree const):
(WebCore::Node::parentOrShadowHostElement const):
(WebCore::Node::shadowIncludingRoot const):
(WebCore::Node::rootEditableElement const):
(WebCore::appendAttributeDesc):
(WebCore::Node::showNodePathForThis const):
(WebCore::traverseSubtreeToUpdateTreeScope):
(WebCore::Node::moveNodeToNewDocument):
(WebCore::Node::dispatchDOMActivateEvent):
(WebCore::Node::defaultEventHandler):
(WebCore::Node::willRespondToMouseMoveEvents const):
(WebCore::Node::willRespondToMouseClickEventsWithEditability const):
(WebCore::Node::removedLastRef):
* Source/WebCore/dom/Node.h:
(WebCore::EventTarget::ref):
(WebCore::EventTarget::deref):
* Source/WebCore/dom/NodeTraversal.cpp:
(WebCore::NodeTraversal::previousIncludingPseudo):
(WebCore::NodeTraversal::nextIncludingPseudo):
(WebCore::NodeTraversal::nextIncludingPseudoSkippingChildren):
* Source/WebCore/dom/Position.cpp:
(WebCore::hasInlineRun):
(WebCore::Position::containerOrParentElement const):
(WebCore::Position::anchorElementAncestor const):
(WebCore::Position::upstream const):
(WebCore::Position::downstream const):
(WebCore::Position::hasRenderedNonAnonymousDescendantsWithHeight):
(WebCore::Position::isCandidate const):
(WebCore::Position::isRenderedCharacter const):
(WebCore::Position::rendersInDifferentPosition const):
(WebCore::Position::leadingWhitespacePosition const):
(WebCore::isNonTextLeafChild):
(WebCore::searchAheadForBetterMatch):
(WebCore::Position::inlineBoxAndOffset const):
* Source/WebCore/dom/Position.h:
(WebCore::offsetIsBeforeLastNodeOffset):
* Source/WebCore/dom/PositionIterator.cpp:
(WebCore::PositionIterator::isCandidate const):
* Source/WebCore/dom/Range.cpp:
(WebCore::processContentsBetweenOffsets):
(WebCore::Range::insertNode):
(WebCore::Range::toString const):
(WebCore::Range::createContextualFragment):
* Source/WebCore/dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestModuleScript):
(WebCore::downcastScriptElement):
* Source/WebCore/dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
(WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow):
(WebCore::ScriptExecutionContext::globalObject const):
(WebCore::ScriptExecutionContext::allowsMediaDevices const):
(WebCore::ScriptExecutionContext::serviceWorkerContainer):
(WebCore::ScriptExecutionContext::ensureServiceWorkerContainer):
(WebCore::ScriptExecutionContext::postTaskToResponsibleDocument):
* Source/WebCore/dom/SelectorQuery.cpp:
(WebCore::elementsForLocalName):
* Source/WebCore/dom/ShadowRoot.h:
(WebCore::Node::isUserAgentShadowRoot const):
(WebCore::Node::parentOrShadowHostNode const):
* Source/WebCore/dom/SimulatedClick.cpp:
* Source/WebCore/dom/SlotAssignment.cpp:
(WebCore::nextSlotElementSkippingSubtree):
* Source/WebCore/dom/StyledElement.cpp:
(WebCore::StyledElement::ensureMutableInlineStyle):
(WebCore::StyledElement::setInlineStyleFromString):
* Source/WebCore/dom/Text.cpp:
(WebCore::earliestLogicallyAdjacentTextNode):
(WebCore::latestLogicallyAdjacentTextNode):
(WebCore::isSVGShadowText):
(WebCore::isSVGText):
* Source/WebCore/dom/TextNodeTraversal.h:
(WebCore::TextNodeTraversal::firstTextChildTemplate):
(WebCore::TextNodeTraversal::firstTextWithinTemplate):
(WebCore::TextNodeTraversal::traverseNextTextTemplate):
(WebCore::TextNodeTraversal::nextSibling):
* Source/WebCore/dom/TreeScope.cpp:
(WebCore::TreeScope::elementsFromPoint):
(WebCore::focusedFrameOwnerElement):
* Source/WebCore/dom/TreeScopeOrderedMap.cpp:
(WebCore::TreeScopeOrderedMap::getElementByMapName const):
(WebCore::TreeScopeOrderedMap::getElementByUsemap const):
* Source/WebCore/dom/mac/ImageControlsMac.cpp:
(WebCore::ImageControlsMac::createImageControls):
(WebCore::ImageControlsMac::imageFromImageElementNode):
(WebCore::ImageControlsMac::handleEvent):
(WebCore::ImageControlsMac::destroyImageControls):

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




More information about the webkit-changes mailing list