Index: Source/core/html/shadow/MediaControlElements.cpp |
diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp |
index b41f26e2844b8ad877b61b38f54f8181ec27d6bd..f4b8526ec3f71b6b26998050ca350298ac5e852d 100644 |
--- a/Source/core/html/shadow/MediaControlElements.cpp |
+++ b/Source/core/html/shadow/MediaControlElements.cpp |
@@ -65,18 +65,20 @@ static bool isUserInteractionEvent(Event* event) |
} |
// Sliders (the volume control and timeline) need to capture some additional events used when dragging the thumb. |
-static bool isUserInteractionEventForSlider(Event* event) |
+static bool isUserInteractionEventForSlider(Event* event, LayoutObject* layoutObject) |
{ |
+ if (isUserInteractionEvent(event)) |
+ return true; |
+ |
+ // Some events are only captured during a slider drag. |
+ LayoutSlider* slider = toLayoutSlider(layoutObject); |
+ if (slider && !slider->inDragMode()) |
+ return false; |
+ |
const AtomicString& type = event->type(); |
- return type == EventTypeNames::mousedown |
- || type == EventTypeNames::mouseup |
- || type == EventTypeNames::click |
- || type == EventTypeNames::dblclick |
- || type == EventTypeNames::mouseover |
+ return type == EventTypeNames::mouseover |
|| type == EventTypeNames::mouseout |
- || type == EventTypeNames::mousemove |
- || event->isKeyboardEvent() |
- || event->isTouchEvent(); |
+ || type == EventTypeNames::mousemove; |
} |
@@ -126,7 +128,7 @@ void MediaControlPanelElement::stopTimer() |
void MediaControlPanelElement::transitionTimerFired(Timer<MediaControlPanelElement>*) |
{ |
if (!m_opaque) |
- hide(); |
+ setIsWanted(false); |
stopTimer(); |
} |
@@ -146,7 +148,7 @@ void MediaControlPanelElement::makeOpaque() |
m_opaque = true; |
if (m_isDisplayed) { |
- show(); |
+ setIsWanted(true); |
didBecomeVisible(); |
} |
} |
@@ -308,10 +310,7 @@ void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event) |
void MediaControlOverlayPlayButtonElement::updateDisplayType() |
{ |
- if (mediaElement().shouldShowControls() && mediaElement().togglePlayStateWillPlay()) |
- show(); |
- else |
- hide(); |
+ setIsWanted(mediaElement().shouldShowControls() && mediaElement().togglePlayStateWillPlay()); |
} |
bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event) |
@@ -333,7 +332,7 @@ PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr |
button->ensureUserAgentShadowRoot(); |
button->setType(InputTypeNames::button); |
button->setShadowPseudoId(AtomicString("-webkit-media-controls-toggle-closed-captions-button", AtomicString::ConstructFromLiteral)); |
- button->hide(); |
+ button->setIsWanted(false); |
return button.release(); |
} |
@@ -432,7 +431,7 @@ void MediaControlTimelineElement::setDuration(double duration) |
bool MediaControlTimelineElement::keepEventInNode(Event* event) |
{ |
- return isUserInteractionEventForSlider(event); |
+ return isUserInteractionEventForSlider(event, layoutObject()); |
} |
// ---------------------------- |
@@ -495,7 +494,7 @@ void MediaControlVolumeSliderElement::setVolume(double volume) |
bool MediaControlVolumeSliderElement::keepEventInNode(Event* event) |
{ |
- return isUserInteractionEventForSlider(event); |
+ return isUserInteractionEventForSlider(event, layoutObject()); |
} |
// ---------------------------- |
@@ -511,7 +510,7 @@ PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre |
button->ensureUserAgentShadowRoot(); |
button->setType(InputTypeNames::button); |
button->setShadowPseudoId(AtomicString("-webkit-media-controls-fullscreen-button", AtomicString::ConstructFromLiteral)); |
- button->hide(); |
+ button->setIsWanted(false); |
return button.release(); |
} |