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

Unified Diff: third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayEnclosureElement.cpp

Issue 2811703002: Move a few media controls elements into modules/media_controls/elements/. (Closed)
Patch Set: Created 3 years, 8 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
Index: third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayEnclosureElement.cpp
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayEnclosureElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayEnclosureElement.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7811db25c17bc2007935f9538720e1054000ae01
--- /dev/null
+++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayEnclosureElement.cpp
@@ -0,0 +1,34 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "modules/media_controls/elements/MediaControlOverlayEnclosureElement.h"
+
+#include "core/events/Event.h"
+#include "modules/media_controls/MediaControlsImpl.h"
+
+namespace blink {
+
+MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement(
+ MediaControlsImpl& media_controls)
+ : MediaControlDivElement(media_controls, kMediaControlsPanel) {
+ SetShadowPseudoId(AtomicString("-webkit-media-controls-overlay-enclosure"));
+}
+
+EventDispatchHandlingState*
+MediaControlOverlayEnclosureElement::PreDispatchEventHandler(Event* event) {
+ // When the media element is clicked or touched we want to make the overlay
+ // cast button visible (if the other requirements are right) even if
+ // JavaScript is doing its own handling of the event. Doing it in
+ // preDispatchEventHandler prevents any interference from JavaScript.
+ // Note that we can't simply test for click, since JS handling of touch events
+ // can prevent their translation to click events.
+ if (event && (event->type() == EventTypeNames::click ||
+ event->type() == EventTypeNames::touchstart)) {
+ static_cast<MediaControlsImpl&>(GetMediaControls())
+ .ShowOverlayCastButtonIfNeeded();
+ }
+ return MediaControlDivElement::PreDispatchEventHandler(event);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698