OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "SVGNames.h" | 32 #include "SVGNames.h" |
33 #include "core/dom/FullscreenElementStack.h" | 33 #include "core/dom/FullscreenElementStack.h" |
34 #include "core/dom/Touch.h" | 34 #include "core/dom/Touch.h" |
35 #include "core/dom/TouchList.h" | 35 #include "core/dom/TouchList.h" |
36 #include "core/dom/shadow/InsertionPoint.h" | 36 #include "core/dom/shadow/InsertionPoint.h" |
37 #include "core/dom/shadow/ShadowRoot.h" | 37 #include "core/dom/shadow/ShadowRoot.h" |
38 #include "core/events/FocusEvent.h" | 38 #include "core/events/FocusEvent.h" |
39 #include "core/events/MouseEvent.h" | 39 #include "core/events/MouseEvent.h" |
40 #include "core/events/TouchEvent.h" | 40 #include "core/events/TouchEvent.h" |
41 #include "core/events/TouchEventContext.h" | 41 #include "core/events/TouchEventContext.h" |
42 #include "core/html/HTMLMediaElement.h" | |
43 #include "core/svg/SVGElementInstance.h" | 42 #include "core/svg/SVGElementInstance.h" |
44 #include "core/svg/SVGUseElement.h" | 43 #include "core/svg/SVGUseElement.h" |
45 | 44 |
46 namespace WebCore { | 45 namespace WebCore { |
47 | 46 |
48 Node* EventPath::parent(Node* node) | 47 Node* EventPath::parent(Node* node) |
49 { | 48 { |
50 EventPath eventPath(node); | 49 EventPath eventPath(node); |
51 return eventPath.size() > 1 ? eventPath[1].node() : 0; | 50 return eventPath.size() > 1 ? eventPath[1].node() : 0; |
52 } | 51 } |
(...skipping 22 matching lines...) Expand all Loading... |
75 return referenceNode; | 74 return referenceNode; |
76 } | 75 } |
77 | 76 |
78 static inline bool inTheSameScope(ShadowRoot* shadowRoot, EventTarget* target) | 77 static inline bool inTheSameScope(ShadowRoot* shadowRoot, EventTarget* target) |
79 { | 78 { |
80 return target->toNode() && target->toNode()->treeScope().rootNode() == shado
wRoot; | 79 return target->toNode() && target->toNode()->treeScope().rootNode() == shado
wRoot; |
81 } | 80 } |
82 | 81 |
83 static inline EventDispatchBehavior determineDispatchBehavior(Event* event, Shad
owRoot* shadowRoot, EventTarget* target) | 82 static inline EventDispatchBehavior determineDispatchBehavior(Event* event, Shad
owRoot* shadowRoot, EventTarget* target) |
84 { | 83 { |
85 // Video-only full screen is a mode where we use the shadow DOM as an implem
entation | |
86 // detail that should not be detectable by the web content. | |
87 if (Element* element = FullscreenElementStack::currentFullScreenElementFrom(
target->toNode()->document())) { | |
88 // FIXME: We assume that if the full screen element is a media element t
hat it's | |
89 // the video-only full screen. Both here and elsewhere. But that is prob
ably wrong. | |
90 if (isHTMLMediaElement(*element) && shadowRoot && shadowRoot->host() ==
element) | |
91 return StayInsideShadowDOM; | |
92 } | |
93 | |
94 // WebKit never allowed selectstart event to cross the the shadow DOM bounda
ry. | 84 // WebKit never allowed selectstart event to cross the the shadow DOM bounda
ry. |
95 // Changing this breaks existing sites. | 85 // Changing this breaks existing sites. |
96 // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details. | 86 // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details. |
97 const AtomicString eventType = event->type(); | 87 const AtomicString eventType = event->type(); |
98 if (inTheSameScope(shadowRoot, target) | 88 if (inTheSameScope(shadowRoot, target) |
99 && (eventType == EventTypeNames::abort | 89 && (eventType == EventTypeNames::abort |
100 || eventType == EventTypeNames::change | 90 || eventType == EventTypeNames::change |
101 || eventType == EventTypeNames::error | 91 || eventType == EventTypeNames::error |
102 || eventType == EventTypeNames::load | 92 || eventType == EventTypeNames::load |
103 || eventType == EventTypeNames::reset | 93 || eventType == EventTypeNames::reset |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 365 |
376 #ifndef NDEBUG | 366 #ifndef NDEBUG |
377 void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList) | 367 void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList) |
378 { | 368 { |
379 for (size_t i = 0; i < touchList.length(); ++i) | 369 for (size_t i = 0; i < touchList.length(); ++i) |
380 ASSERT(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOld
erSiblingShadowRootOrAncestorTreeScopeOf(treeScope)); | 370 ASSERT(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOld
erSiblingShadowRootOrAncestorTreeScopeOf(treeScope)); |
381 } | 371 } |
382 #endif | 372 #endif |
383 | 373 |
384 } // namespace | 374 } // namespace |
OLD | NEW |