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

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

Issue 2622273003: Fixed volume slider element event handling (Closed)
Patch Set: Added a TODO 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 dbf7802053de4e74a2d62a16a1ecee66c8cfe946..4a1615e58d5c56605964ae5d06fcd2e1c900224f 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 ||
chcunningham 2017/01/12 21:48:46 What is this method's purpose? I see its used to d
mustaq 2017/01/17 19:32:42 I too found it weird: EventTarget::keepEventInNode
chcunningham 2017/01/20 00:01:38 Thinking more, it may be that we want to keep thes
+ type == EventTypeNames::mousemove ||
+ type == EventTypeNames::pointerover ||
+ type == EventTypeNames::pointerout ||
+ type == EventTypeNames::pointermove;
}
Element* elementFromCenter(Element& element) {
@@ -755,7 +759,10 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event) {
if (event->type() == EventTypeNames::mouseover ||
event->type() == EventTypeNames::mouseout ||
- event->type() == EventTypeNames::mousemove)
+ event->type() == EventTypeNames::mousemove ||
+ event->type() == EventTypeNames::pointerover ||
chcunningham 2017/01/12 21:48:46 If we can move l781 - 783 into the if (type == inp
mustaq 2017/01/17 19:32:42 Done with the change you suggested. I wanted to do
+ event->type() == EventTypeNames::pointerout ||
+ event->type() == EventTypeNames::pointermove)
return;
double time = value().toDouble();
@@ -766,6 +773,11 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event) {
mediaElement().setCurrentTime(time);
}
+ // TODO(mustaq): On a single click, this block is executed 5 or 6 times
chcunningham 2017/01/12 21:48:46 Why not go ahead and move this into the if ( type
mustaq 2017/01/17 19:32:42 Done. Again, I wasn't sure about correct the set o
chcunningham 2017/01/20 00:01:38 Yeah, I'm also not sure. But this seems right to m
+ // depending on whether the slider position has been changed or not, once for
+ // each of these events: pointerdown, mousedown, (input?), pointerup, mouseup,
+ // DOMActive and click. Perhaps we only care about the "input" event (as in
+ // MediaControlVolumeSliderElement::defaultEventHandler)?
LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject()));
if (!slider.isNull() && slider.inDragMode())
mediaControls().updateCurrentTimeDisplay();
@@ -813,21 +825,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 +838,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