We don't need to a class hierarchy to represent different kinds of EventContext. Merge all the subclasses of EventContext onto itself to avoid heap allocation in EventPath.
Created attachment 420804 [details] WIP
Created attachment 420901 [details] WIP2
Created attachment 421066 [details] WIP2 + cleanup
<rdar://problem/74586915>
Created attachment 421500 [details] Patch
Comment on attachment 421500 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=421500&action=review > Source/WebCore/dom/EventContext.h:62 > + bool isMouseOrFocusEventContext() const { return m_type == Type::MouseOrFocus; } > + bool isTouchEventContext() const { return m_type == Type::Touch; } > + bool isWindowContext() const { return m_type == Type::Window; } Not this patch, but it's weird how the context is sometimes about the type of event, and sometimes about the object it's fired on? > Source/WebCore/dom/EventContext.h:104 > + , m_type(type) Can't this be m_type { type } ?
(In reply to Simon Fraser (smfr) from comment #6) > Comment on attachment 421500 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=421500&action=review > > > Source/WebCore/dom/EventContext.h:62 > > + bool isMouseOrFocusEventContext() const { return m_type == Type::MouseOrFocus; } > > + bool isTouchEventContext() const { return m_type == Type::Touch; } > > + bool isWindowContext() const { return m_type == Type::Window; } > > Not this patch, but it's weird how the context is sometimes about the type > of event, and sometimes about the object it's fired on? Yup, we should do that. I was initially going to do that in this patch but I decided against it to keep this patch simple & mechanical. > > Source/WebCore/dom/EventContext.h:104 > > + , m_type(type) > > Can't this be m_type { type } ? Oops, fixed. Not sure what happened there. Thanks for the reviews!
Committed r273477 (234556@main): <https://commits.webkit.org/234556@main>