Title: [175139] trunk/Source/WebCore
- Revision
- 175139
- Author
- [email protected]
- Date
- 2014-10-23 13:27:27 -0700 (Thu, 23 Oct 2014)
Log Message
[Mac] don't update caption user style sheet during parsing
https://bugs.webkit.org/show_bug.cgi?id=137983
rdar://problem/18735366
Reviewed by Jer Noble.
No new tests, existing tests cover the changes.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF): Initialize m_updateStyleSheetTimer.
(WebCore::CaptionUserPreferencesMediaAF::updateTimerFired): Call updateCaptionStyleSheetOveride.
(WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges): Prime a timer to update
the captions style sheet after a slight delay.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (175138 => 175139)
--- trunk/Source/WebCore/ChangeLog 2014-10-23 19:56:22 UTC (rev 175138)
+++ trunk/Source/WebCore/ChangeLog 2014-10-23 20:27:27 UTC (rev 175139)
@@ -1,3 +1,19 @@
+2014-10-23 Eric Carlson <[email protected]>
+
+ [Mac] don't update caption user style sheet during parsing
+ https://bugs.webkit.org/show_bug.cgi?id=137983
+ rdar://problem/18735366
+
+ Reviewed by Jer Noble.
+
+ No new tests, existing tests cover the changes.
+
+ * page/CaptionUserPreferencesMediaAF.cpp:
+ (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF): Initialize m_updateStyleSheetTimer.
+ (WebCore::CaptionUserPreferencesMediaAF::updateTimerFired): Call updateCaptionStyleSheetOveride.
+ (WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges): Prime a timer to update
+ the captions style sheet after a slight delay.
+
2014-10-23 Chris Dumez <[email protected]>
Move remaining Length-type properties to the new StyleBuilder
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (175138 => 175139)
--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2014-10-23 19:56:22 UTC (rev 175138)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2014-10-23 20:27:27 UTC (rev 175139)
@@ -141,6 +141,7 @@
CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF(PageGroup& group)
: CaptionUserPreferences(group)
#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+ , m_updateStyleSheetTimer(this, &CaptionUserPreferencesMediaAF::updateTimerFired)
, m_listeningForPreferenceChanges(false)
#endif
{
@@ -223,6 +224,11 @@
return !(captioningMediaCharacteristics && CFArrayGetCount(captioningMediaCharacteristics.get()));
}
+void CaptionUserPreferencesMediaAF::updateTimerFired(Timer<CaptionUserPreferencesMediaAF>&)
+{
+ updateCaptionStyleSheetOveride();
+}
+
void CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges()
{
if (!MediaAccessibilityLibrary())
@@ -236,7 +242,11 @@
CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, userCaptionPreferencesChangedNotificationCallback, kMAXCaptionAppearanceSettingsChangedNotification, 0, CFNotificationSuspensionBehaviorCoalesce);
}
- updateCaptionStyleSheetOveride();
+ // Generating and registering the caption stylesheet can be expensive and this method is called indirectly when the parser creates an audio or
+ // video element, so do it after a brief pause.
+ if (m_updateStyleSheetTimer.isActive())
+ m_updateStyleSheetTimer.stop();
+ m_updateStyleSheetTimer.startOneShot(0);
}
void CaptionUserPreferencesMediaAF::captionPreferencesChanged()
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h (175138 => 175139)
--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h 2014-10-23 19:56:22 UTC (rev 175138)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h 2014-10-23 20:27:27 UTC (rev 175139)
@@ -68,6 +68,8 @@
private:
#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+ void updateTimerFired(Timer<CaptionUserPreferencesMediaAF>&);
+
String captionsWindowCSS() const;
String captionsBackgroundCSS() const;
String captionsTextColorCSS() const;
@@ -78,6 +80,7 @@
String captionsTextEdgeCSS() const;
String cssPropertyWithTextEdgeColor(CSSPropertyID, const String&, const Color&, bool) const;
String colorPropertyCSS(CSSPropertyID, const Color&, bool) const;
+ Timer<CaptionUserPreferencesMediaAF> m_updateStyleSheetTimer;
bool m_listeningForPreferenceChanges;
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes