Title: [105178] branches/safari-534.54-branch/Source/WebCore
Diff
Modified: branches/safari-534.54-branch/Source/WebCore/ChangeLog (105177 => 105178)
--- branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-01-17 19:25:01 UTC (rev 105177)
+++ branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-01-17 19:25:29 UTC (rev 105178)
@@ -1,3 +1,28 @@
+2012-01-17 Mark Rowe <[email protected]>
+
+ Merge r104619.
+
+ 2012-01-10 Jer Noble <[email protected]>
+
+ REGRESSION (r102024): Having the Bing homepage open prevents idle sleep
+ https://bugs.webkit.org/show_bug.cgi?id=75972
+
+ Reviewed by Oliver Hunt.
+
+ No new tests; no testing infrastructure exists to test display sleep assertions.
+
+ Only disable idle and display sleep when a video element is not paused, not looping, and
+ has both a video and audio track.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerRateChanged): Factor into updateDisableSleep() and
+ shouldDisplaySleep().
+ (WebCore::HTMLMediaElement::setLoop): Ditto.
+ (WebCore::HTMLMediaElement::attributeChanged): Ditto.
+ (WebCore::HTMLMediaElement::updateDisableSleep):
+ (WebCore::HTMLMediaElement::shouldDisableSleep):
+ * html/HTMLMediaElement.h:
+
2012-01-16 Mark Rowe <[email protected]>
Merge r99591.
Modified: branches/safari-534.54-branch/Source/WebCore/html/HTMLMediaElement.cpp (105177 => 105178)
--- branches/safari-534.54-branch/Source/WebCore/html/HTMLMediaElement.cpp 2012-01-17 19:25:01 UTC (rev 105177)
+++ branches/safari-534.54-branch/Source/WebCore/html/HTMLMediaElement.cpp 2012-01-17 19:25:29 UTC (rev 105178)
@@ -242,6 +242,10 @@
m_player->setControls(controls());
#endif
}
+#if PLATFORM(MAC)
+ else if (attrName == loopAttr)
+ updateDisableSleep();
+#endif
}
void HTMLMediaElement::parseMappedAttribute(Attribute* attr)
@@ -1517,6 +1521,9 @@
{
LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b));
setBooleanAttribute(loopAttr, b);
+#if PLATFORM(MAC)
+ updateDisableSleep();
+#endif
}
bool HTMLMediaElement::controls() const
@@ -1971,10 +1978,7 @@
invalidateCachedTime();
#if PLATFORM(MAC)
- if (m_player->paused() && m_sleepDisabler)
- m_sleepDisabler = nullptr;
- else if (!m_player->paused() && !m_sleepDisabler)
- m_sleepDisabler = DisplaySleepDisabler::create("com.apple.WebCore: HTMLMediaElement playback");
+ updateDisableSleep();
#endif
endProcessingMediaPlayerCallback();
@@ -2787,6 +2791,21 @@
return height;
}
+#if PLATFORM(MAC)
+void HTMLMediaElement::updateDisableSleep()
+{
+ if (!shouldDisableSleep() && m_sleepDisabler)
+ m_sleepDisabler = nullptr;
+ else if (shouldDisableSleep() && !m_sleepDisabler)
+ m_sleepDisabler = DisplaySleepDisabler::create("com.apple.WebCore: HTMLMediaElement playback");
}
+bool HTMLMediaElement::shouldDisableSleep() const
+{
+ return !m_player->paused() && hasVideo() && hasAudio() && !loop();
+}
#endif
+
+}
+
+#endif
Modified: branches/safari-534.54-branch/Source/WebCore/html/HTMLMediaElement.h (105177 => 105178)
--- branches/safari-534.54-branch/Source/WebCore/html/HTMLMediaElement.h 2012-01-17 19:25:01 UTC (rev 105177)
+++ branches/safari-534.54-branch/Source/WebCore/html/HTMLMediaElement.h 2012-01-17 19:25:29 UTC (rev 105178)
@@ -352,6 +352,11 @@
virtual void* preDispatchEventHandler(Event*);
+#if PLATFORM(MAC)
+ void updateDisableSleep();
+ bool shouldDisableSleep() const;
+#endif
+
Timer<HTMLMediaElement> m_loadTimer;
Timer<HTMLMediaElement> m_asyncEventTimer;
Timer<HTMLMediaElement> m_progressEventTimer;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes