Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: third_party/WebKit/Source/core/events/Event.cpp

Issue 2034413002: Cache the result of isScopedInV0 flag in Event object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/events/Event.cpp
diff --git a/third_party/WebKit/Source/core/events/Event.cpp b/third_party/WebKit/Source/core/events/Event.cpp
index 5295064e88da04ed39ef5f4e8fbf103e55b94b71..1c5361af5ce8fb380044a3bea8b94d1643824e3f 100644
--- a/third_party/WebKit/Source/core/events/Event.cpp
+++ b/third_party/WebKit/Source/core/events/Event.cpp
@@ -34,6 +34,23 @@
namespace blink {
+static bool isEventTypeScopedInV0(const AtomicString& eventType)
+{
+ // WebKit never allowed selectstart event to cross the the shadow DOM boundary.
+ // Changing this breaks existing sites.
+ // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details.
+ return eventType == EventTypeNames::abort
+ || eventType == EventTypeNames::change
+ || eventType == EventTypeNames::error
+ || eventType == EventTypeNames::load
+ || eventType == EventTypeNames::reset
+ || eventType == EventTypeNames::resize
+ || eventType == EventTypeNames::scroll
+ || eventType == EventTypeNames::select
+ || eventType == EventTypeNames::selectstart
+ || eventType == EventTypeNames::slotchange;
+}
+
Event::Event()
: Event("", false, false)
{
@@ -55,6 +72,7 @@ Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr
, m_canBubble(canBubbleArg)
, m_cancelable(cancelableArg)
, m_composed(composedMode == ComposedMode::Composed)
+ , m_isEventTypeScopedInV0(isEventTypeScopedInV0(eventType))
, m_propagationStopped(false)
, m_immediatePropagationStopped(false)
, m_defaultPrevented(false)
@@ -81,20 +99,7 @@ Event::~Event()
bool Event::isScopedInV0() const
{
- // WebKit never allowed selectstart event to cross the the shadow DOM boundary.
- // Changing this breaks existing sites.
- // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details.
- return isTrusted()
- && (m_type == EventTypeNames::abort
- || m_type == EventTypeNames::change
- || m_type == EventTypeNames::error
- || m_type == EventTypeNames::load
- || m_type == EventTypeNames::reset
- || m_type == EventTypeNames::resize
- || m_type == EventTypeNames::scroll
- || m_type == EventTypeNames::select
- || m_type == EventTypeNames::selectstart
- || m_type == EventTypeNames::slotchange);
+ return isTrusted() && m_isEventTypeScopedInV0;
}
void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg)
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698