EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot, EventTarget* target) { #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO) // Video-only full screen is a mode where we use the shadow DOM as an implementation // detail that should not be detectable by the web content. if (Element* element = m_node->document()->webkitCurrentFullScreenElement()) { // FIXME: We assume that if the full screen element is a media element that it's // the video-only full screen. Both here and elsewhere. But that is probably wrong. if (element->isMediaElement() && shadowRoot && shadowRoot->host() == element) return StayInsideShadowDOM; } #else UNUSED_PARAM(shadowRoot); #endif // 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. const AtomicString eventType = event->type(); if (inTheSameScope(shadowRoot, target) && (eventType == eventNames().abortEvent || eventType == eventNames().changeEvent || eventType == eventNames().errorEvent || eventType == eventNames().loadEvent || eventType == eventNames().resetEvent || eventType == eventNames().resizeEvent || eventType == eventNames().scrollEvent || eventType == eventNames().selectEvent || eventType == eventNames().selectstartEvent)) return StayInsideShadowDOM; return RetargetEvent; }
static inline EventDispatchBehavior determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot, EventTarget* target) { // Video-only full screen is a mode where we use the shadow DOM as an implementation // detail that should not be detectable by the web content. if (Element* element = FullscreenElementStack::currentFullScreenElementFrom(&target->toNode()->document())) { // FIXME: We assume that if the full screen element is a media element that it's // the video-only full screen. Both here and elsewhere. But that is probably wrong. if (element->isMediaElement() && shadowRoot && shadowRoot->host() == element) return StayInsideShadowDOM; } // 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. const AtomicString eventType = event->type(); if (inTheSameScope(shadowRoot, target) && (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)) return StayInsideShadowDOM; return RetargetEvent; }
static inline EventDispatchBehavior determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot, EventTarget* target) { // 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. const AtomicString eventType = event->type(); if (inTheSameScope(shadowRoot, target) && (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)) return StayInsideShadowDOM; return RetargetEvent; }