Entering Tab View after a bunch of YouTube pages were opened in background tabs makes...
[WebKit-https.git] / Source / WebKit2 / ChangeLog
index d4fff195f8ca94e4bff0d565823af1f2bb8c9639..ceb1031412590ec10a4aa00f79602bb27d658f25 100644 (file)
@@ -1,3 +1,42 @@
+2012-11-27  Dan Bernstein  <mitz@apple.com>
+
+        Entering Tab View after a bunch of YouTube pages were opened in background tabs makes all of them start playing simultaneously
+        https://bugs.webkit.org/show_bug.cgi?id=103358
+
+        Reviewed by Adele Peterson.
+
+        To fix this, this patch adds WKPageSetMayStartMediaWhenInWindow(), which allows the client to
+        prevent media from starting automatically when the view is put in a window.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode): Encode mayStartMediaWhenInWindow.
+        (WebKit::WebPageCreationParameters::decode): Decode mayStartMediaWhenInWindow.
+        * Shared/WebPageCreationParameters.h:
+        (WebPageCreationParameters): Added boolean member mayStartMediaWhenInWindow.
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetMayStartMediaWhenInWindow): Added. Calls through to WebPageProxy.
+        * UIProcess/API/C/WKPagePrivate.h: Declared WKPageSetMayStartMediaWhenInWindow.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy): Added initializiation of m_mayStartMediaWhenInWindow
+        to true, the value matching the current behavior.
+        (WebKit::WebPageProxy::setMayStartMediaWhenInWindow): Added. Updates
+        m_mayStartMediaWhenInWindow and sends a message to the Web process to do the same.
+        (WebKit::WebPageProxy::creationParameters): Changed to set mayStartMediaWhenInWindow in the
+        process creation parameters.
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy): Declared setMayStartMediaWhenInWindow() and added member variable
+        m_mayStartMediaWhenInWindow.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Initialized m_mayStartMediaWhenInWindow from the creation
+        parameters.
+        (WebKit::WebPage::setIsInWindow): Made starting of media upon being added to a window
+        conditional on m_mayStartMediaWhenInWindow.
+        (WebKit::WebPage::setMayStartMediaWhenInWindow): Added. Sets m_mayStartMediaWhenInWindow. If
+        already in a window when changing from false to true, starts m_setCanStartMediaTimer.
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage): Declared setMayStartMediaWhenInWindow() and added member variable m_mayStartMediaWhenInWindow.
+        * WebProcess/WebPage/WebPage.messages.in: Added SetMayStartMediaWhenInWindow.
+
 2012-11-27  Pratik Solanki  <psolanki@apple.com>
 
         objc/objc-runtime.h does not exist on all PLATFORM(MAC)