| 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 eac75ab2c736f1d7cb4132ffec13f6190a2adcc9..ef9037aeb82c3bda6591c1bb181baf02b6e89f37 100644
|
| --- a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
|
| +++ b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
|
| @@ -45,9 +45,11 @@
|
| #include "core/html/HTMLVideoElement.h"
|
| #include "core/html/TimeRanges.h"
|
| #include "core/html/shadow/MediaControls.h"
|
| +#include "core/html/shadow/ShadowElementNames.h"
|
| +#include "core/html/shadow/SliderThumbElement.h"
|
| #include "core/html/track/TextTrackList.h"
|
| #include "core/input/EventHandler.h"
|
| -#include "core/layout/api/LayoutSliderItem.h"
|
| +#include "core/layout/LayoutObject.h"
|
| #include "core/page/Page.h"
|
| #include "platform/EventDispatchForbiddenScope.h"
|
| #include "platform/Histogram.h"
|
| @@ -76,6 +78,13 @@ const QualifiedName& trackIndexAttrName() {
|
| // When specified as trackIndex, disable text tracks.
|
| const int trackIndexOffValue = -1;
|
|
|
| +bool inDragMode(MediaControlInputElement* rangeInput) {
|
| + SliderThumbElement* thumb =
|
| + toSliderThumbElement(rangeInput->userAgentShadowRoot()->getElementById(
|
| + ShadowElementNames::sliderThumb()));
|
| + return thumb && thumb->inDragMode();
|
| +}
|
| +
|
| bool isUserInteractionEvent(Event* event) {
|
| const AtomicString& type = event->type();
|
| return type == EventTypeNames::mousedown || type == EventTypeNames::mouseup ||
|
| @@ -85,15 +94,15 @@ bool isUserInteractionEvent(Event* event) {
|
|
|
| // Sliders (the volume control and timeline) need to capture some additional
|
| // events used when dragging the thumb.
|
| -bool isUserInteractionEventForSlider(Event* event, LayoutObject* layoutObject) {
|
| +bool isUserInteractionEventForSlider(Event* event,
|
| + MediaControlInputElement* rangeInput) {
|
| // It is unclear if this can be converted to isUserInteractionEvent(), since
|
| // mouse* events seem to be eaten during a drag anyway. crbug.com/516416 .
|
| if (isUserInteractionEvent(event))
|
| return true;
|
|
|
| // Some events are only captured during a slider drag.
|
| - LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject));
|
| - if (!slider.isNull() && !slider.inDragMode())
|
| + if (!inDragMode(rangeInput))
|
| return false;
|
|
|
| const AtomicString& type = event->type();
|
| @@ -783,8 +792,7 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event) {
|
| if (mediaElement().seekable()->contain(time))
|
| mediaElement().setCurrentTime(time);
|
|
|
| - LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject()));
|
| - if (!slider.isNull() && slider.inDragMode())
|
| + if (inDragMode(this))
|
| mediaControls().updateCurrentTimeDisplay();
|
| }
|
|
|
| @@ -807,7 +815,7 @@ void MediaControlTimelineElement::setDuration(double duration) {
|
| }
|
|
|
| bool MediaControlTimelineElement::keepEventInNode(Event* event) {
|
| - return isUserInteractionEventForSlider(event, layoutObject());
|
| + return isUserInteractionEventForSlider(event, this);
|
| }
|
|
|
| // ----------------------------
|
| @@ -874,7 +882,7 @@ void MediaControlVolumeSliderElement::setVolume(double volume) {
|
| }
|
|
|
| bool MediaControlVolumeSliderElement::keepEventInNode(Event* event) {
|
| - return isUserInteractionEventForSlider(event, layoutObject());
|
| + return isUserInteractionEventForSlider(event, this);
|
| }
|
|
|
| // ----------------------------
|
|
|