summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-03-14 13:23:18 -0700
committerNicolas Roard <nicolasroard@google.com>2011-03-14 19:07:36 -0700
commit833c9ceaa300f52cf2d1b12a9b3482ad417a3c21 (patch)
tree0fa83f5b4a725f225ef285f1b5e28e404feb8050 /WebCore/rendering
parenta0fb3c7e0c38540c392a5248b0f1100c158612f9 (diff)
downloadexternal_webkit-833c9ceaa300f52cf2d1b12a9b3482ad417a3c21.zip
external_webkit-833c9ceaa300f52cf2d1b12a9b3482ad417a3c21.tar.gz
external_webkit-833c9ceaa300f52cf2d1b12a9b3482ad417a3c21.tar.bz2
Improving HTML5 video controls
- correct support for the fullscreen button - change the controls to be 48px high - auto-hide the controls, touching the video makes them appear again bug:2126902 Change-Id: Idd2b720034de3d5d432c9ea62d9045934c46f6c1
Diffstat (limited to 'WebCore/rendering')
-rw-r--r--WebCore/rendering/RenderMedia.cpp24
-rw-r--r--WebCore/rendering/RenderMedia.h3
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)