Title: [175336] trunk/Source/WebCore
- Revision
- 175336
- Author
- [email protected]
- Date
- 2014-10-29 11:56:42 -0700 (Wed, 29 Oct 2014)
Log Message
Add API to mute/unmute a page.
https://bugs.webkit.org/show_bug.cgi?id=138150
Reviewed by Eric Carlson.
No new tests, since it's difficult to test whether the Page has indeed been muted.
* dom/Document.cpp:
(WebCore::Document::setMuted):
Go through each AudioProducer and call setMuted() on it.
* dom/Document.h:
* page/AudioProducer.h:
Add setMuted(bool). HTMLMediaElement, the only derived class of AudioProducer so far,
has already implemented setMuted().
* page/Page.cpp:
(WebCore::Page::setMuted):
Go through all its frames and call setMuted() on each frame's Document.
* page/Page.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (175335 => 175336)
--- trunk/Source/WebCore/ChangeLog 2014-10-29 18:48:23 UTC (rev 175335)
+++ trunk/Source/WebCore/ChangeLog 2014-10-29 18:56:42 UTC (rev 175336)
@@ -1,3 +1,24 @@
+2014-10-28 Ada Chan <[email protected]>
+
+ Add API to mute/unmute a page.
+ https://bugs.webkit.org/show_bug.cgi?id=138150
+
+ Reviewed by Eric Carlson.
+
+ No new tests, since it's difficult to test whether the Page has indeed been muted.
+
+ * dom/Document.cpp:
+ (WebCore::Document::setMuted):
+ Go through each AudioProducer and call setMuted() on it.
+ * dom/Document.h:
+ * page/AudioProducer.h:
+ Add setMuted(bool). HTMLMediaElement, the only derived class of AudioProducer so far,
+ has already implemented setMuted().
+ * page/Page.cpp:
+ (WebCore::Page::setMuted):
+ Go through all its frames and call setMuted() on each frame's Document.
+ * page/Page.h:
+
2014-10-29 Tim Horton <[email protected]>
Implement action menus for data detected items
Modified: trunk/Source/WebCore/dom/Document.cpp (175335 => 175336)
--- trunk/Source/WebCore/dom/Document.cpp 2014-10-29 18:48:23 UTC (rev 175335)
+++ trunk/Source/WebCore/dom/Document.cpp 2014-10-29 18:56:42 UTC (rev 175336)
@@ -3304,6 +3304,12 @@
page()->updateIsPlayingAudio();
}
+void Document::setMuted(bool muted)
+{
+ for (auto audioProducer : m_audioProducers)
+ audioProducer->setMuted(muted);
+}
+
void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag)
{
if (m_optimizedStyleSheetUpdateTimer.isActive())
Modified: trunk/Source/WebCore/dom/Document.h (175335 => 175336)
--- trunk/Source/WebCore/dom/Document.h 2014-10-29 18:48:23 UTC (rev 175335)
+++ trunk/Source/WebCore/dom/Document.h 2014-10-29 18:56:42 UTC (rev 175336)
@@ -1292,6 +1292,7 @@
void removeAudioProducer(AudioProducer*);
bool isPlayingAudio() const { return m_isPlayingAudio; }
void updateIsPlayingAudio();
+ void setMuted(bool);
protected:
enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
Modified: trunk/Source/WebCore/page/AudioProducer.h (175335 => 175336)
--- trunk/Source/WebCore/page/AudioProducer.h 2014-10-29 18:48:23 UTC (rev 175335)
+++ trunk/Source/WebCore/page/AudioProducer.h 2014-10-29 18:56:42 UTC (rev 175336)
@@ -31,6 +31,7 @@
class AudioProducer {
public:
virtual bool isPlayingAudio() = 0;
+ virtual void setMuted(bool) = 0;
protected:
virtual ~AudioProducer() { }
Modified: trunk/Source/WebCore/page/Page.cpp (175335 => 175336)
--- trunk/Source/WebCore/page/Page.cpp 2014-10-29 18:48:23 UTC (rev 175335)
+++ trunk/Source/WebCore/page/Page.cpp 2014-10-29 18:56:42 UTC (rev 175336)
@@ -1211,6 +1211,12 @@
chrome().client().isPlayingAudioDidChange(m_isPlayingAudio);
}
+void Page::setMuted(bool muted)
+{
+ for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
+ frame->document()->setMuted(muted);
+}
+
#if !ASSERT_DISABLED
void Page::checkSubframeCountConsistency() const
{
Modified: trunk/Source/WebCore/page/Page.h (175335 => 175336)
--- trunk/Source/WebCore/page/Page.h 2014-10-29 18:48:23 UTC (rev 175335)
+++ trunk/Source/WebCore/page/Page.h 2014-10-29 18:56:42 UTC (rev 175336)
@@ -438,6 +438,7 @@
bool isPlayingAudio() const { return m_isPlayingAudio; }
void updateIsPlayingAudio();
+ void setMuted(bool);
private:
WEBCORE_EXPORT void initGroup();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes