Title: [187696] branches/safari-601.1-branch/Source/WebCore

Diff

Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187695 => 187696)


--- branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-08-01 00:19:07 UTC (rev 187695)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-08-01 00:27:09 UTC (rev 187696)
@@ -1,5 +1,30 @@
 2015-07-31  Babak Shafiei  <[email protected]>
 
+        Merge r187688.
+
+    2015-07-31  Eric Carlson  <[email protected]>
+
+            [iOS] use a media-specific user gesture check
+            https://bugs.webkit.org/show_bug.cgi?id=147509
+
+            Reviewed by Jer Noble.
+
+            * bindings/js/ScriptController.cpp:
+            (WebCore::ScriptController::processingUserGestureForMedia): New.
+            * bindings/js/ScriptController.h:
+
+            * dom/UserGestureIndicator.cpp:
+            (WebCore::isDefinite): Allow DefinitelyProcessingMediaUserGesture.
+            (WebCore::UserGestureIndicator::processingUserGestureForMedia): New.
+            * dom/UserGestureIndicator.h:
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::load): Use ScriptController::processingUserGestureForMedia instead of 
+              ScriptController::processingUserGesture
+            (WebCore::HTMLMediaElement::play): Ditto.
+
+2015-07-31  Babak Shafiei  <[email protected]>
+
         Merge r187684.
 
     2015-07-31  Jeremy Jones  <[email protected]>

Modified: branches/safari-601.1-branch/Source/WebCore/bindings/js/ScriptController.cpp (187695 => 187696)


--- branches/safari-601.1-branch/Source/WebCore/bindings/js/ScriptController.cpp	2015-08-01 00:19:07 UTC (rev 187695)
+++ branches/safari-601.1-branch/Source/WebCore/bindings/js/ScriptController.cpp	2015-08-01 00:27:09 UTC (rev 187696)
@@ -306,6 +306,11 @@
     return UserGestureIndicator::processingUserGesture();
 }
 
+bool ScriptController::processingUserGestureForMedia()
+{
+    return UserGestureIndicator::processingUserGestureForMedia();
+}
+
 bool ScriptController::canAccessFromCurrentOrigin(Frame *frame)
 {
     ExecState* exec = JSMainThreadExecState::currentState();

Modified: branches/safari-601.1-branch/Source/WebCore/bindings/js/ScriptController.h (187695 => 187696)


--- branches/safari-601.1-branch/Source/WebCore/bindings/js/ScriptController.h	2015-08-01 00:19:07 UTC (rev 187695)
+++ branches/safari-601.1-branch/Source/WebCore/bindings/js/ScriptController.h	2015-08-01 00:27:09 UTC (rev 187696)
@@ -121,6 +121,7 @@
     void disableEval(const String& errorMessage);
 
     WEBCORE_EXPORT static bool processingUserGesture();
+    WEBCORE_EXPORT static bool processingUserGestureForMedia();
 
     static bool canAccessFromCurrentOrigin(Frame*);
     WEBCORE_EXPORT bool canExecuteScripts(ReasonForCallingCanExecuteScripts);

Modified: branches/safari-601.1-branch/Source/WebCore/dom/UserGestureIndicator.cpp (187695 => 187696)


--- branches/safari-601.1-branch/Source/WebCore/dom/UserGestureIndicator.cpp	2015-08-01 00:19:07 UTC (rev 187695)
+++ branches/safari-601.1-branch/Source/WebCore/dom/UserGestureIndicator.cpp	2015-08-01 00:27:09 UTC (rev 187696)
@@ -33,7 +33,7 @@
 
 static bool isDefinite(ProcessingUserGestureState state)
 {
-    return state == DefinitelyProcessingUserGesture || state == DefinitelyNotProcessingUserGesture;
+    return state == DefinitelyProcessingUserGesture || state == DefinitelyNotProcessingUserGesture || state == DefinitelyProcessingMediaUserGesture;
 }
 
 ProcessingUserGestureState UserGestureIndicator::s_state = DefinitelyNotProcessingUserGesture;
@@ -66,4 +66,12 @@
     return isMainThread() ? s_state == DefinitelyProcessingUserGesture : false;
 }
 
+bool UserGestureIndicator::processingUserGestureForMedia()
+{
+    if (!isMainThread())
+        return false;
+
+    return s_state == DefinitelyProcessingUserGesture || s_state == DefinitelyProcessingMediaUserGesture;
 }
+
+}

Modified: branches/safari-601.1-branch/Source/WebCore/dom/UserGestureIndicator.h (187695 => 187696)


--- branches/safari-601.1-branch/Source/WebCore/dom/UserGestureIndicator.h	2015-08-01 00:19:07 UTC (rev 187695)
+++ branches/safari-601.1-branch/Source/WebCore/dom/UserGestureIndicator.h	2015-08-01 00:27:09 UTC (rev 187696)
@@ -34,6 +34,7 @@
 
 enum ProcessingUserGestureState {
     DefinitelyProcessingUserGesture,
+    DefinitelyProcessingMediaUserGesture,
     PossiblyProcessingUserGesture,
     DefinitelyNotProcessingUserGesture
 };
@@ -42,6 +43,7 @@
     WTF_MAKE_NONCOPYABLE(UserGestureIndicator);
 public:
     static bool processingUserGesture();
+    static bool processingUserGestureForMedia();
 
     // If a document is provided, its last known user gesture timestamp is updated.
     WEBCORE_EXPORT explicit UserGestureIndicator(ProcessingUserGestureState, Document* = nullptr);

Modified: branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp (187695 => 187696)


--- branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp	2015-08-01 00:19:07 UTC (rev 187695)
+++ branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp	2015-08-01 00:27:09 UTC (rev 187696)
@@ -920,7 +920,7 @@
     
     if (!m_mediaSession->dataLoadingPermitted(*this))
         return;
-    if (ScriptController::processingUserGesture())
+    if (ScriptController::processingUserGestureForMedia())
         removeBehaviorsRestrictionsAfterFirstUserGesture();
 
     prepareForLoad();
@@ -2839,7 +2839,7 @@
 
     if (!m_mediaSession->playbackPermitted(*this))
         return;
-    if (ScriptController::processingUserGesture())
+    if (ScriptController::processingUserGestureForMedia())
         removeBehaviorsRestrictionsAfterFirstUserGesture();
 
     playInternal();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to