| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/media_controls/elements/MediaControlOverlayEnclosureElement.h" |
| 6 |
| 7 #include "core/events/Event.h" |
| 8 #include "modules/media_controls/MediaControlsImpl.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement( |
| 13 MediaControlsImpl& media_controls) |
| 14 : MediaControlDivElement(media_controls, kMediaControlsPanel) { |
| 15 SetShadowPseudoId(AtomicString("-webkit-media-controls-overlay-enclosure")); |
| 16 } |
| 17 |
| 18 EventDispatchHandlingState* |
| 19 MediaControlOverlayEnclosureElement::PreDispatchEventHandler(Event* event) { |
| 20 // When the media element is clicked or touched we want to make the overlay |
| 21 // cast button visible (if the other requirements are right) even if |
| 22 // JavaScript is doing its own handling of the event. Doing it in |
| 23 // preDispatchEventHandler prevents any interference from JavaScript. |
| 24 // Note that we can't simply test for click, since JS handling of touch events |
| 25 // can prevent their translation to click events. |
| 26 if (event && (event->type() == EventTypeNames::click || |
| 27 event->type() == EventTypeNames::touchstart)) { |
| 28 static_cast<MediaControlsImpl&>(GetMediaControls()) |
| 29 .ShowOverlayCastButtonIfNeeded(); |
| 30 } |
| 31 return MediaControlDivElement::PreDispatchEventHandler(event); |
| 32 } |
| 33 |
| 34 } // namespace blink |
| OLD | NEW |