diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-03-14 19:19:29 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-14 19:19:29 -0700 |
commit | 6ac5b7fa7883dbde29a2568ce210588dfbb4afbc (patch) | |
tree | b9ab22455cf38986d95168b62248ac289dc454c6 /WebCore/rendering | |
parent | 8bdd64a8dcb679707d613788c66fe2211daedbaf (diff) | |
parent | 38f3c4a204bfa7d75953f6d9cbd489b696d5a8b1 (diff) | |
download | external_webkit-6ac5b7fa7883dbde29a2568ce210588dfbb4afbc.zip external_webkit-6ac5b7fa7883dbde29a2568ce210588dfbb4afbc.tar.gz external_webkit-6ac5b7fa7883dbde29a2568ce210588dfbb4afbc.tar.bz2 |
am 38f3c4a2: am 833c9cea: Improving HTML5 video controls
* commit '38f3c4a204bfa7d75953f6d9cbd489b696d5a8b1':
Improving HTML5 video controls
Diffstat (limited to 'WebCore/rendering')
-rw-r--r-- | WebCore/rendering/RenderMedia.cpp | 24 | ||||
-rw-r--r-- | WebCore/rendering/RenderMedia.h | 3 |
2 files changed, 26 insertions, 1 deletions
diff --git a/WebCore/rendering/RenderMedia.cpp b/WebCore/rendering/RenderMedia.cpp index 49a536c..f19ca96 100644 --- a/WebCore/rendering/RenderMedia.cpp +++ b/WebCore/rendering/RenderMedia.cpp @@ -39,6 +39,10 @@ #include <wtf/CurrentTime.h> #include <wtf/MathExtras.h> +#if PLATFORM(ANDROID) +#define TOUCH_DELAY 4 +#endif + using namespace std; namespace WebCore { @@ -57,6 +61,9 @@ RenderMedia::RenderMedia(HTMLMediaElement* video) , m_opacityAnimationDuration(0) , m_opacityAnimationFrom(0) , m_opacityAnimationTo(1.0f) +#if PLATFORM(ANDROID) + , m_lastTouch(0) +#endif { setImageResource(RenderImageResource::create()); } @@ -70,6 +77,9 @@ RenderMedia::RenderMedia(HTMLMediaElement* video, const IntSize& intrinsicSize) , m_opacityAnimationDuration(0) , m_opacityAnimationFrom(0) , m_opacityAnimationTo(1.0f) +#if PLATFORM(ANDROID) + , m_lastTouch(0) +#endif { setImageResource(RenderImageResource::create()); setIntrinsicSize(intrinsicSize); @@ -456,7 +466,14 @@ void RenderMedia::updateControlVisibility() // Don't fade if the media element is not visible if (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(); // Do fading manually, css animations don't work with shadow trees @@ -535,6 +552,11 @@ void RenderMedia::updateVolumeSliderContainer(bool visible) void RenderMedia::forwardEvent(Event* event) { +#if PLATFORM(ANDROID) + if (event->isMouseEvent()) + m_lastTouch = WTF::currentTime(); +#endif + if (event->isMouseEvent() && m_controlsShadowRoot) { MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); IntPoint point(mouseEvent->absoluteLocation()); diff --git a/WebCore/rendering/RenderMedia.h b/WebCore/rendering/RenderMedia.h index aa725ff..65fdc7d 100644 --- a/WebCore/rendering/RenderMedia.h +++ b/WebCore/rendering/RenderMedia.h @@ -151,6 +151,9 @@ private: double m_opacityAnimationDuration; float m_opacityAnimationFrom; float m_opacityAnimationTo; +#if PLATFORM(ANDROID) + double m_lastTouch; +#endif }; inline RenderMedia* toRenderMedia(RenderObject* object) |