diff options
author | Steve Block <steveblock@google.com> | 2011-05-18 16:43:59 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-25 12:25:47 +0100 |
commit | 15f1859ccdb0b25adc4607224a80c99b686fe0bb (patch) | |
tree | 9b24e985a39db7162d91c7ee05cff2462ba306f8 /Source/WebCore/html | |
parent | a1f6960b1e7568f18887cd35bb3fe6b3b7f69eae (diff) | |
download | external_webkit-15f1859ccdb0b25adc4607224a80c99b686fe0bb.zip external_webkit-15f1859ccdb0b25adc4607224a80c99b686fe0bb.tar.gz external_webkit-15f1859ccdb0b25adc4607224a80c99b686fe0bb.tar.bz2 |
Merge WebKit at r78450: Fix conflicts in media controls
Conflict due to Android modifications to handle touch events.
See http://trac.webkit.org/changeset/76950
Change-Id: I499d66319614af4bc23f1c0f89f072b814503703
Diffstat (limited to 'Source/WebCore/html')
-rw-r--r-- | Source/WebCore/html/shadow/MediaControls.cpp | 45 | ||||
-rw-r--r-- | Source/WebCore/html/shadow/MediaControls.h | 8 |
2 files changed, 53 insertions, 0 deletions
diff --git a/Source/WebCore/html/shadow/MediaControls.cpp b/Source/WebCore/html/shadow/MediaControls.cpp index 731a934..a374e49 100644 --- a/Source/WebCore/html/shadow/MediaControls.cpp +++ b/Source/WebCore/html/shadow/MediaControls.cpp @@ -40,6 +40,11 @@ #include <wtf/CurrentTime.h> #include <wtf/MathExtras.h> +#if PLATFORM(ANDROID) +#include "TouchEvent.h" +#define TOUCH_DELAY 4 +#endif + using namespace std; @@ -59,6 +64,9 @@ MediaControls::MediaControls(HTMLMediaElement* mediaElement) , m_opacityAnimationFrom(0) , m_opacityAnimationTo(1.0f) , m_mouseOver(false) +#if PLATFORM(ANDROID) + , m_lastTouch(0) +#endif { } @@ -404,6 +412,13 @@ void MediaControls::updateControlVisibility() // Don't fade if the media element is not visible if (media->renderer()->style()->visibility() != VISIBLE) return; + +#if PLATFORM(ANDROID) + if (WTF::currentTime() - m_lastTouch > TOUCH_DELAY) + m_mouseOver = false; + else + m_mouseOver = true; +#endif bool shouldHideController = !m_mouseOver && !media->canPlay(); @@ -483,6 +498,15 @@ void MediaControls::updateVolumeSliderContainer(bool visible) void MediaControls::forwardEvent(Event* event) { +#if PLATFORM(ANDROID) + if (event->isMouseEvent()) + updateLastTouch(); +#if ENABLE(TOUCH_EVENTS) + if (event->isTouchEvent()) + updateLastTouch(); +#endif +#endif + ASSERT(m_mediaElement->renderer()); if (event->isMouseEvent() && m_controlsShadowRoot) { @@ -548,6 +572,20 @@ void MediaControls::forwardEvent(Event* event) updateControlVisibility(); } } +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) + // We want to process touch events landing on the timeline so that the user + // can drag the scrollbar thumb with their finger. + else if (event->isTouchEvent() && m_controlsShadowRoot) { + TouchEvent* touchEvent = static_cast<TouchEvent*>(event); + if (touchEvent->touches() && touchEvent->touches()->item(0)) { + IntPoint point; + point.setX(touchEvent->touches()->item(0)->pageX()); + point.setY(touchEvent->touches()->item(0)->pageY()); + if (m_timeline && m_timeline->hitTest(point)) + m_timeline->defaultEventHandler(event); + } + } +#endif } // We want the timeline slider to be at least 100 pixels wide. @@ -567,6 +605,13 @@ void MediaControls::updateTimeDisplayVisibility() m_timeRemainingDisplay->setVisible(shouldShowTimeDisplays); } +#if PLATFORM(ANDROID) +void MediaControls::updateLastTouch() +{ + m_lastTouch = WTF::currentTime(); +} +#endif + } #endif diff --git a/Source/WebCore/html/shadow/MediaControls.h b/Source/WebCore/html/shadow/MediaControls.h index 98e017f..a4fbbd6 100644 --- a/Source/WebCore/html/shadow/MediaControls.h +++ b/Source/WebCore/html/shadow/MediaControls.h @@ -73,6 +73,10 @@ public: // Once shadow DOM refactoring is complete, the tweaking will be in MediaControlsShadowRoot and this accessor will no longer be necessary. RenderBox* renderBox(); +#if PLATFORM(ANDROID) + void updateLastTouch(); +#endif + private: void createControlsShadowRoot(); void destroyControlsShadowRoot(); @@ -132,6 +136,10 @@ private: float m_opacityAnimationTo; bool m_mouseOver; + +#if PLATFORM(ANDROID) + double m_lastTouch; +#endif }; |