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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp

Issue 2622273003: Fixed volume slider element event handling (Closed)
Patch Set: mlamouri's comments. Created 3 years, 11 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/html/shadow/MediaControlElementTypes.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/html/shadow/MediaControlElements.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
index b5a95e3f43509d32fd5744917377a56a92e13d7c..fd86d758e0c8d4c1299f4f3df03be11ce9205389 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
@@ -97,7 +97,11 @@ bool isUserInteractionEventForSlider(Event* event, LayoutObject* layoutObject) {
const AtomicString& type = event->type();
return type == EventTypeNames::mouseover ||
- type == EventTypeNames::mouseout || type == EventTypeNames::mousemove;
+ type == EventTypeNames::mouseout ||
+ type == EventTypeNames::mousemove ||
+ type == EventTypeNames::pointerover ||
+ type == EventTypeNames::pointerout ||
+ type == EventTypeNames::pointermove;
}
Element* elementFromCenter(Element& element) {
@@ -753,18 +757,15 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event) {
MediaControlInputElement::defaultEventHandler(event);
- if (event->type() == EventTypeNames::mouseover ||
- event->type() == EventTypeNames::mouseout ||
- event->type() == EventTypeNames::mousemove)
+ if (event->type() != EventTypeNames::input)
return;
double time = value().toDouble();
- if (event->type() == EventTypeNames::input) {
- // FIXME: This will need to take the timeline offset into consideration
- // once that concept is supported, see https://crbug.com/312699
- if (mediaElement().seekable()->contain(time))
- mediaElement().setCurrentTime(time);
- }
+
+ // FIXME: This will need to take the timeline offset into consideration
+ // once that concept is supported, see https://crbug.com/312699
+ if (mediaElement().seekable()->contain(time))
+ mediaElement().setCurrentTime(time);
LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject()));
if (!slider.isNull() && slider.inDragMode())
@@ -813,21 +814,11 @@ MediaControlVolumeSliderElement* MediaControlVolumeSliderElement::create(
}
void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) {
- if (event->isMouseEvent() &&
- toMouseEvent(event)->button() !=
- static_cast<short>(WebPointerProperties::Button::Left))
- return;
-
if (!isConnected() || !document().isActive())
return;
MediaControlInputElement::defaultEventHandler(event);
- if (event->type() == EventTypeNames::mouseover ||
- event->type() == EventTypeNames::mouseout ||
- event->type() == EventTypeNames::mousemove)
- return;
-
if (event->type() == EventTypeNames::mousedown)
Platform::current()->recordAction(
UserMetricsAction("Media.Controls.VolumeChangeBegin"));
@@ -836,9 +827,11 @@ void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) {
Platform::current()->recordAction(
UserMetricsAction("Media.Controls.VolumeChangeEnd"));
- double volume = value().toDouble();
- mediaElement().setVolume(volume);
- mediaElement().setMuted(false);
+ if (event->type() == EventTypeNames::input) {
+ double volume = value().toDouble();
+ mediaElement().setVolume(volume);
+ mediaElement().setMuted(false);
+ }
}
bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() {
« no previous file with comments | « third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698