[webkit-changes] [WebKit/WebKit] 3e45e6: Minor optimizations to EventDispatcher::dispatchEv...
Chris Dumez
noreply at github.com
Mon Mar 20 19:24:16 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3e45e6390201e5c933ad911fbf856437e05e30d5
https://github.com/WebKit/WebKit/commit/3e45e6390201e5c933ad911fbf856437e05e30d5
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-03-20 (Mon, 20 Mar 2023)
Changed paths:
M Source/WebCore/dom/EventDispatcher.cpp
Log Message:
-----------
Minor optimizations to EventDispatcher::dispatchEvent()
https://bugs.webkit.org/show_bug.cgi?id=254170
Reviewed by Darin Adler.
Minor optimizations to EventDispatcher::dispatchEvent():
- Use a bool instead of a std::optional<bool> for shouldClearTargetsAfterDispatch
since we don't need 3 states.
- Minimize calls to `event.type() == eventNames().clickEvent` since `eventNames()`
is not super cheap.
- Minimize calls to shouldSuppressEventDispatchInDOM() and avoid calling
`event.stopPropagation()` when this function returns true. We can factor the
`if` check so that setting the stop propagation flag on the event is not actually
necessary. Note that we call `resetAfterDispatch()` on the event shortly after,
which resets the stop propagation flag anyway.
* Source/WebCore/dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent):
Canonical link: https://commits.webkit.org/261906@main
More information about the webkit-changes
mailing list