summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/html/HTMLMediaElement.cpp6
-rw-r--r--Source/WebCore/page/Settings.cpp2
-rw-r--r--Source/WebCore/page/Settings.h8
-rw-r--r--Source/WebKit/android/jni/WebSettings.cpp6
4 files changed, 19 insertions, 3 deletions
diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp
index d25bada..693f214 100644
--- a/Source/WebCore/html/HTMLMediaElement.cpp
+++ b/Source/WebCore/html/HTMLMediaElement.cpp
@@ -185,9 +185,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
document->registerForDocumentActivationCallbacks(this);
document->registerForMediaVolumeCallbacks(this);
document->registerForPrivateBrowsingStateChangedCallbacks(this);
-#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS)
- m_restrictions |= RequireUserGestureForRateChangeRestriction;
-#endif
+
+ if (document->settings() && document->settings()->mediaPlaybackRequiresUserGesture())
+ m_restrictions |= RequireUserGestureForRateChangeRestriction;
}
HTMLMediaElement::~HTMLMediaElement()
diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp
index f668f3e..79e38d1 100644
--- a/Source/WebCore/page/Settings.cpp
+++ b/Source/WebCore/page/Settings.cpp
@@ -201,6 +201,8 @@ Settings::Settings(Page* page)
#else
, m_passwordEchoEnabled(false)
#endif
+ , m_mediaPlaybackRequiresUserGesture(false)
+ , m_mediaPlaybackAllowsInline(true)
{
// A Frame may not have been created yet, so we initialize the AtomicString
// hash before trying to use it.
diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h
index 2cf7715..84828ab 100644
--- a/Source/WebCore/page/Settings.h
+++ b/Source/WebCore/page/Settings.h
@@ -479,6 +479,12 @@ namespace WebCore {
bool blockNetworkImage() const { return m_blockNetworkImage; }
#endif
+ void setMediaPlaybackRequiresUserGesture(bool flag) { m_mediaPlaybackRequiresUserGesture = flag; };
+ bool mediaPlaybackRequiresUserGesture() const { return m_mediaPlaybackRequiresUserGesture; }
+
+ void setMediaPlaybackAllowsInline(bool flag) { m_mediaPlaybackAllowsInline = flag; };
+ bool mediaPlaybackAllowsInline() const { return m_mediaPlaybackAllowsInline; }
+
private:
Page* m_page;
@@ -633,6 +639,8 @@ namespace WebCore {
#ifdef ANDROID_PLUGINS
bool m_pluginsOnDemand : 1;
#endif
+ bool m_mediaPlaybackRequiresUserGesture : 1;
+ bool m_mediaPlaybackAllowsInline : 1;
bool m_passwordEchoEnabled : 1;
#if USE(SAFARI_THEME)
diff --git a/Source/WebKit/android/jni/WebSettings.cpp b/Source/WebKit/android/jni/WebSettings.cpp
index 467da3d..1bd3e36 100644
--- a/Source/WebKit/android/jni/WebSettings.cpp
+++ b/Source/WebKit/android/jni/WebSettings.cpp
@@ -151,6 +151,7 @@ struct FieldIds {
#endif
mOverrideCacheMode = env->GetFieldID(clazz, "mOverrideCacheMode", "I");
mPasswordEchoEnabled = env->GetFieldID(clazz, "mPasswordEchoEnabled", "Z");
+ mMediaPlaybackRequiresUserGesture = env->GetFieldID(clazz, "mMediaPlaybackRequiresUserGesture", "Z");
ALOG_ASSERT(mLayoutAlgorithm, "Could not find field mLayoutAlgorithm");
ALOG_ASSERT(mTextSize, "Could not find field mTextSize");
@@ -195,6 +196,7 @@ struct FieldIds {
ALOG_ASSERT(mUseDoubleTree, "Could not find field mUseDoubleTree");
ALOG_ASSERT(mPageCacheCapacity, "Could not find field mPageCacheCapacity");
ALOG_ASSERT(mPasswordEchoEnabled, "Could not find field mPasswordEchoEnabled");
+ ALOG_ASSERT(mMediaPlaybackRequiresUserGesture, "Could not find field mMediaPlaybackRequiresUserGesture");
jclass enumClass = env->FindClass("java/lang/Enum");
ALOG_ASSERT(enumClass, "Could not find Enum class!");
@@ -281,6 +283,7 @@ struct FieldIds {
#endif
jfieldID mOverrideCacheMode;
jfieldID mPasswordEchoEnabled;
+ jfieldID mMediaPlaybackRequiresUserGesture;
};
static struct FieldIds* gFieldIds;
@@ -616,6 +619,9 @@ public:
bool echoPassword = env->GetBooleanField(obj,
gFieldIds->mPasswordEchoEnabled);
s->setPasswordEchoEnabled(echoPassword);
+
+ flag = env->GetBooleanField(obj, gFieldIds->mMediaPlaybackRequiresUserGesture);
+ s->setMediaPlaybackRequiresUserGesture(flag);
}
};