Title: [285323] branches/safari-612-branch/Source/WebCore

Diff

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-11-05 01:01:37 UTC (rev 285323)
@@ -444,157 +444,6 @@
 
 2021-11-04  Russell Epstein  <[email protected]>
 
-        Cherry-pick r284163. rdar://problem/84129338
-
-    WebCore::CaptionUserPreferencesMediaAF should use a weak observer with CFNotificationCenter
-    <https://webkit.org/b/231550>
-    <rdar://problem/84129338>
-    
-    Reviewed by Darin Adler.
-    
-    * SourcesCocoa.txt:
-    * WebCore.xcodeproj/project.pbxproj:
-    - Add CaptionUserPreferencesMediaAF.mm.
-    
-    * page/CaptionUserPreferences.cpp:
-    (WebCore::CaptionUserPreferences::create): Add.
-    * page/CaptionUserPreferences.h:
-    (WebCore::CaptionUserPreferences):
-    - Make subclass of RefCounted<> and CanMakeWeakPtr<>.
-    (WebCore::CaptionUserPreferences::create): Add.
-    (WebCore::CaptionUserPreferences::CaptionUserPreferences):
-    - Move constructor to protected visiblity with explicit keyword,
-      and add static create() method.
-    
-    * page/CaptionUserPreferencesMediaAF.cpp:
-    (WebCore::userCaptionPreferencesChangedNotificationCallback):
-    - Update to use extractCaptionUserPreferencesMediaAF() for
-      Cococa platforms.  Note that -> is used for two different
-      `userPreferences` variable types based on the platform.
-    (WebCore::CaptionUserPreferencesMediaAF::create): Add.
-    (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF):
-    - Move initialization of m_listeningForPreferenceChanges to
-      class definition.
-    (WebCore::CaptionUserPreferencesMediaAF::~CaptionUserPreferencesMediaAF):
-    - Update to use m_weakObserver as observer for Cocoa platforms.
-    (WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):
-    - Update to use m_weakObserver as observer and
-      _CFNotificationObserverIsObjC in suspension behavior for Cocoa
-      platforms.
-    
-    * page/CaptionUserPreferencesMediaAF.h:
-    (WebCore::CaptionUserPreferencesMediaAF::create): Add.
-    (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF):
-    - Move constructor to private visiblity, and add static create()
-      method.
-    (WebCore::CaptionUserPreferencesMediaAF::extractCaptionUserPreferencesMediaAF): Add.
-    (WebCore::CaptionUserPreferencesMediaAF::createWeakObserver): Add.
-    (WebCore::CaptionUserPreferencesMediaAF::m_weakObserver):
-    - Add m_weakObserver instance variable for use with
-      CFNotificationCenter.
-    (WebCore::CaptionUserPreferencesMediaAF::m_listeningForPreferenceChanges):
-    - Move initialization of m_listeningForPreferenceChanges here
-      from the constructor.
-    
-    * page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm: Add.
-    (-[WebCaptionUserPreferencesMediaAFWeakObserver initWithWeakPtr:]):
-    (-[WebCaptionUserPreferencesMediaAFWeakObserver userPreferences]):
-    - Declare and implement
-      WebCaptionUserPreferencesMediaAFWeakObserver class for use as
-      a weak CFNotificationCenter observer.
-    (WebCore::CaptionUserPreferencesMediaAF::createWeakObserver): Add.
-    - Helper method to call from C++ that creates weak observer
-      object from Objective-C++.
-    (WebCore::CaptionUserPreferencesMediaAF::extractCaptionUserPreferencesMediaAF): Add.
-    - Helper method to extract RefPtr<CaptionUserPreferencesMediaAF>
-      from CFNotification observer parameter.
-    
-    * page/PageGroup.cpp:
-    (WebCore::PageGroup::ensureCaptionPreferences):
-    - Switch to using new create() methods.
-    
-    * page/PageGroup.h:
-    (WebCore::PageGroup::m_captionPreferences):
-    - Change from std::unique_ptr<> to RefPtr<>.
-    
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
-    2021-10-14  David Kilzer  <[email protected]>
-
-            WebCore::CaptionUserPreferencesMediaAF should use a weak observer with CFNotificationCenter
-            <https://webkit.org/b/231550>
-            <rdar://problem/84129338>
-
-            Reviewed by Darin Adler.
-
-            * SourcesCocoa.txt:
-            * WebCore.xcodeproj/project.pbxproj:
-            - Add CaptionUserPreferencesMediaAF.mm.
-
-            * page/CaptionUserPreferences.cpp:
-            (WebCore::CaptionUserPreferences::create): Add.
-            * page/CaptionUserPreferences.h:
-            (WebCore::CaptionUserPreferences):
-            - Make subclass of RefCounted<> and CanMakeWeakPtr<>.
-            (WebCore::CaptionUserPreferences::create): Add.
-            (WebCore::CaptionUserPreferences::CaptionUserPreferences):
-            - Move constructor to protected visiblity with explicit keyword,
-              and add static create() method.
-
-            * page/CaptionUserPreferencesMediaAF.cpp:
-            (WebCore::userCaptionPreferencesChangedNotificationCallback):
-            - Update to use extractCaptionUserPreferencesMediaAF() for
-              Cococa platforms.  Note that -> is used for two different
-              `userPreferences` variable types based on the platform.
-            (WebCore::CaptionUserPreferencesMediaAF::create): Add.
-            (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF):
-            - Move initialization of m_listeningForPreferenceChanges to
-              class definition.
-            (WebCore::CaptionUserPreferencesMediaAF::~CaptionUserPreferencesMediaAF):
-            - Update to use m_weakObserver as observer for Cocoa platforms.
-            (WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):
-            - Update to use m_weakObserver as observer and
-              _CFNotificationObserverIsObjC in suspension behavior for Cocoa
-              platforms.
-
-            * page/CaptionUserPreferencesMediaAF.h:
-            (WebCore::CaptionUserPreferencesMediaAF::create): Add.
-            (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF):
-            - Move constructor to private visiblity, and add static create()
-              method.
-            (WebCore::CaptionUserPreferencesMediaAF::extractCaptionUserPreferencesMediaAF): Add.
-            (WebCore::CaptionUserPreferencesMediaAF::createWeakObserver): Add.
-            (WebCore::CaptionUserPreferencesMediaAF::m_weakObserver):
-            - Add m_weakObserver instance variable for use with
-              CFNotificationCenter.
-            (WebCore::CaptionUserPreferencesMediaAF::m_listeningForPreferenceChanges):
-            - Move initialization of m_listeningForPreferenceChanges here
-              from the constructor.
-
-            * page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm: Add.
-            (-[WebCaptionUserPreferencesMediaAFWeakObserver initWithWeakPtr:]):
-            (-[WebCaptionUserPreferencesMediaAFWeakObserver userPreferences]):
-            - Declare and implement
-              WebCaptionUserPreferencesMediaAFWeakObserver class for use as
-              a weak CFNotificationCenter observer.
-            (WebCore::CaptionUserPreferencesMediaAF::createWeakObserver): Add.
-            - Helper method to call from C++ that creates weak observer
-              object from Objective-C++.
-            (WebCore::CaptionUserPreferencesMediaAF::extractCaptionUserPreferencesMediaAF): Add.
-            - Helper method to extract RefPtr<CaptionUserPreferencesMediaAF>
-              from CFNotification observer parameter.
-
-            * page/PageGroup.cpp:
-            (WebCore::PageGroup::ensureCaptionPreferences):
-            - Switch to using new create() methods.
-
-            * page/PageGroup.h:
-            (WebCore::PageGroup::m_captionPreferences):
-            - Change from std::unique_ptr<> to RefPtr<>.
-
-2021-11-04  Russell Epstein  <[email protected]>
-
         Cherry-pick r283803. rdar://problem/83823282
 
     REGRESSION (r277818): XHR with requestType document broken for larger HTML files

Modified: branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt	2021-11-05 01:01:37 UTC (rev 285323)
@@ -184,7 +184,6 @@
 loader/mac/LoaderNSURLExtras.mm
 loader/mac/ResourceLoaderMac.mm
 page/CaptionUserPreferencesMediaAF.cpp
-page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm
 page/cocoa/MemoryReleaseCocoa.mm
 page/cocoa/PerformanceLoggingCocoa.mm
 page/cocoa/ResourceUsageOverlayCocoa.mm

Modified: branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-11-05 01:01:37 UTC (rev 285323)
@@ -8226,7 +8226,6 @@
 		442956CA218A6D300080DB54 /* DictionaryLookupLegacy.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DictionaryLookupLegacy.mm; sourceTree = "<group>"; };
 		4437C4A724E2AE5F00095128 /* LazyLoadFrameObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LazyLoadFrameObserver.h; sourceTree = "<group>"; };
 		4437C4A924E2AE5F00095128 /* LazyLoadFrameObserver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LazyLoadFrameObserver.cpp; sourceTree = "<group>"; };
-		443877E3271681F600FD3E33 /* CaptionUserPreferencesMediaAFCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CaptionUserPreferencesMediaAFCocoa.mm; sourceTree = "<group>"; };
 		443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkStateNotifierIOS.mm; sourceTree = "<group>"; };
 		444D4E210F708B2E003158E0 /* WebCoreURLResponseIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponseIOS.mm; sourceTree = "<group>"; };
 		445210DD25D61EFF003A2ED8 /* AppHighlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppHighlight.h; sourceTree = "<group>"; };
@@ -21512,7 +21511,6 @@
 		5D5975B5196362BE00D00878 /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
-				443877E3271681F600FD3E33 /* CaptionUserPreferencesMediaAFCocoa.mm */,
 				F446EDDD265DAE3F0031DA8F /* DataDetectionResultsStorage.h */,
 				F446EDE7265DD8900031DA8F /* DataDetectorElementInfo.h */,
 				F446EDE0265DB1E50031DA8F /* ImageOverlayDataDetectionResultIdentifier.h */,

Modified: branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.cpp (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.cpp	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.cpp	2021-11-05 01:01:37 UTC (rev 285323)
@@ -49,11 +49,6 @@
 
 namespace WebCore {
 
-Ref<CaptionUserPreferences> CaptionUserPreferences::create(PageGroup& group)
-{
-    return adoptRef(*new CaptionUserPreferences(group));
-}
-
 CaptionUserPreferences::CaptionUserPreferences(PageGroup& group)
     : m_pageGroup(group)
     , m_displayMode(ForcedOnly)

Modified: branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.h (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.h	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.h	2021-11-05 01:01:37 UTC (rev 285323)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,7 +32,6 @@
 #include "Timer.h"
 #include <wtf/EnumTraits.h>
 #include <wtf/HashSet.h>
-#include <wtf/WeakPtr.h>
 
 namespace WebCore {
 
@@ -42,10 +41,10 @@
 class TextTrackList;
 struct MediaSelectionOption;
 
-class CaptionUserPreferences : public RefCounted<CaptionUserPreferences>, public CanMakeWeakPtr<CaptionUserPreferences> {
+class CaptionUserPreferences {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static Ref<CaptionUserPreferences> create(PageGroup&);
+    CaptionUserPreferences(PageGroup&);
     virtual ~CaptionUserPreferences();
 
     enum CaptionDisplayMode {
@@ -103,8 +102,6 @@
     PageGroup& pageGroup() const { return m_pageGroup; }
 
 protected:
-    explicit CaptionUserPreferences(PageGroup&);
-
     void updateCaptionStyleSheetOverride();
     void beginBlockingNotifications();
     void endBlockingNotifications();

Modified: branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp	2021-11-05 01:01:37 UTC (rev 285323)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,10 +24,13 @@
  */
 
 #include "config.h"
+
+#if ENABLE(VIDEO)
+
+#if !USE(DIRECT2D)
+
 #include "CaptionUserPreferencesMediaAF.h"
 
-#if ENABLE(VIDEO) && !USE(DIRECT2D)
-
 #include "AudioTrackList.h"
 #include "ColorSerialization.h"
 #include "FloatConversion.h"
@@ -48,12 +51,8 @@
 #include <wtf/text/cf/StringConcatenateCF.h>
 #include <wtf/unicode/Collator.h>
 
-#if PLATFORM(COCOA)
-#include <pal/spi/cf/CFNotificationCenterSPI.h>
-#endif
-
 #if PLATFORM(IOS_FAMILY)
-#include "WebCoreThreadRun.h"
+#import "WebCoreThreadRun.h"
 #endif
 
 #if PLATFORM(WIN)
@@ -119,35 +118,24 @@
     return preferredLanguages;
 }
 
-static void userCaptionPreferencesChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
+static void userCaptionPreferencesChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void *, CFDictionaryRef)
 {
-#if PLATFORM(COCOA)
-    RefPtr userPreferences = CaptionUserPreferencesMediaAF::extractCaptionUserPreferencesMediaAF(observer);
-#elif PLATFORM(WIN)
-    auto* userPreferences = static_cast<CaptionUserPreferencesMediaAF*>(observer);
-#endif
-    if (userPreferences) {
 #if !PLATFORM(IOS_FAMILY)
-        userPreferences->captionPreferencesChanged();
+    static_cast<CaptionUserPreferencesMediaAF*>(observer)->captionPreferencesChanged();
 #else
-        WebThreadRun(^{
-            userPreferences->captionPreferencesChanged();
-        });
+    WebThreadRun(^{
+        static_cast<CaptionUserPreferencesMediaAF*>(observer)->captionPreferencesChanged();
+    });
 #endif
-    }
 }
 
-#endif // HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+#endif
 
-Ref<CaptionUserPreferencesMediaAF> CaptionUserPreferencesMediaAF::create(PageGroup& group)
-{
-    return adoptRef(*new CaptionUserPreferencesMediaAF(group));
-}
-
 CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF(PageGroup& group)
     : CaptionUserPreferences(group)
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
     , m_updateStyleSheetTimer(*this, &CaptionUserPreferencesMediaAF::updateTimerFired)
+    , m_listeningForPreferenceChanges(false)
 #endif
 {
     static bool initialized;
@@ -175,19 +163,11 @@
 CaptionUserPreferencesMediaAF::~CaptionUserPreferencesMediaAF()
 {
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
-#if PLATFORM(COCOA)
-    auto* observer = m_weakObserver.get();
-#elif PLATFORM(WIN)
-    auto* observer = this;
+    if (kMAXCaptionAppearanceSettingsChangedNotification)
+        CFNotificationCenterRemoveObserver(CFNotificationCenterGetLocalCenter(), this, kMAXCaptionAppearanceSettingsChangedNotification, 0);
+    if (kMAAudibleMediaSettingsChangedNotification)
+        CFNotificationCenterRemoveObserver(CFNotificationCenterGetLocalCenter(), this, kMAAudibleMediaSettingsChangedNotification, 0);
 #endif
-    if (observer) {
-        auto center = CFNotificationCenterGetLocalCenter();
-        if (kMAXCaptionAppearanceSettingsChangedNotification)
-            CFNotificationCenterRemoveObserver(center, observer, kMAXCaptionAppearanceSettingsChangedNotification, 0);
-        if (kMAAudibleMediaSettingsChangedNotification)
-            CFNotificationCenterRemoveObserver(center, observer, kMAAudibleMediaSettingsChangedNotification, 0);
-    }
-#endif // HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
 }
 
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
@@ -305,21 +285,10 @@
     m_listeningForPreferenceChanges = true;
     m_registeringForNotification = true;
 
-#if PLATFORM(COCOA)
-    if (!m_weakObserver)
-        m_weakObserver = createWeakObserver(this);
-    auto* observer = m_weakObserver.get();
-    auto suspensionBehavior = static_cast<CFNotificationSuspensionBehavior>(CFNotificationSuspensionBehaviorCoalesce | _CFNotificationObserverIsObjC);
-#elif PLATFORM(WIN)
-    auto* observer = this;
-    auto suspensionBehavior = CFNotificationSuspensionBehaviorCoalesce;
-#endif
-    auto center = CFNotificationCenterGetLocalCenter();
     if (kMAXCaptionAppearanceSettingsChangedNotification)
-        CFNotificationCenterAddObserver(center, observer, userCaptionPreferencesChangedNotificationCallback, kMAXCaptionAppearanceSettingsChangedNotification, 0, suspensionBehavior);
-
+        CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, userCaptionPreferencesChangedNotificationCallback, kMAXCaptionAppearanceSettingsChangedNotification, 0, CFNotificationSuspensionBehaviorCoalesce);
     if (canLoad_MediaAccessibility_kMAAudibleMediaSettingsChangedNotification())
-        CFNotificationCenterAddObserver(center, observer, userCaptionPreferencesChangedNotificationCallback, kMAAudibleMediaSettingsChangedNotification, 0, suspensionBehavior);
+        CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, userCaptionPreferencesChangedNotificationCallback, kMAAudibleMediaSettingsChangedNotification, 0, CFNotificationSuspensionBehaviorCoalesce);
     m_registeringForNotification = false;
 
     // Generating and registering the caption stylesheet can be expensive and this method is called indirectly when the parser creates an audio or
@@ -994,4 +963,6 @@
     
 }
 
-#endif // ENABLE(VIDEO) && !USE(DIRECT2D)
+#endif
+
+#endif // ENABLE(VIDEO)

Modified: branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.h (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.h	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.h	2021-11-05 01:01:37 UTC (rev 285323)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#if ENABLE(VIDEO) && !USE(DIRECT2D)
+#if ENABLE(VIDEO)
 
 #include "CSSPropertyNames.h"
 #include "CaptionPreferencesDelegate.h"
@@ -32,16 +32,12 @@
 #include "CaptionUserPreferences.h"
 #include "Color.h"
 
-#if PLATFORM(COCOA)
-OBJC_CLASS WebCaptionUserPreferencesMediaAFWeakObserver;
-#endif
-
 namespace WebCore {
 
 class CaptionUserPreferencesMediaAF : public CaptionUserPreferences {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static Ref<CaptionUserPreferencesMediaAF> create(PageGroup&);
+    CaptionUserPreferencesMediaAF(PageGroup&);
     virtual ~CaptionUserPreferencesMediaAF();
 
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
@@ -79,10 +75,6 @@
     bool shouldFilterTrackMenu() const { return false; }
 #endif
 
-#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) && PLATFORM(COCOA)
-    static RefPtr<CaptionUserPreferencesMediaAF> extractCaptionUserPreferencesMediaAF(void* observer);
-#endif
-
     String captionsStyleSheetOverride() const override;
     Vector<RefPtr<AudioTrack>> sortedTrackListForMenu(AudioTrackList*) override;
     Vector<RefPtr<TextTrack>> sortedTrackListForMenu(TextTrackList*, HashSet<TextTrack::Kind>) override;
@@ -90,8 +82,6 @@
     String displayNameForTrack(TextTrack*) const override;
 
 private:
-    CaptionUserPreferencesMediaAF(PageGroup&);
-
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
     void updateTimerFired();
 
@@ -103,17 +93,9 @@
     String windowRoundedCornerRadiusCSS() const;
     String captionsTextEdgeCSS() const;
     String colorPropertyCSS(CSSPropertyID, const Color&, bool) const;
-#endif
+    Timer m_updateStyleSheetTimer;
 
-#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) && PLATFORM(COCOA)
-    static RetainPtr<WebCaptionUserPreferencesMediaAFWeakObserver> createWeakObserver(CaptionUserPreferencesMediaAF*);
-
-    RetainPtr<WebCaptionUserPreferencesMediaAFWeakObserver> m_weakObserver;
-#endif
-
-#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
-    Timer m_updateStyleSheetTimer;
-    bool m_listeningForPreferenceChanges { false };
+    bool m_listeningForPreferenceChanges;
     bool m_registeringForNotification { false };
 #endif
 };
@@ -120,4 +102,4 @@
 
 } // namespace WebCore
 
-#endif // ENABLE(VIDEO) && !USE(DIRECT2D)
+#endif // ENABLE(VIDEO)

Modified: branches/safari-612-branch/Source/WebCore/page/PageGroup.cpp (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/page/PageGroup.cpp	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/page/PageGroup.cpp	2021-11-05 01:01:37 UTC (rev 285323)
@@ -113,9 +113,9 @@
 {
     if (!m_captionPreferences) {
 #if PLATFORM(MAC) || HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
-        m_captionPreferences = CaptionUserPreferencesMediaAF::create(*this);
+        m_captionPreferences = makeUnique<CaptionUserPreferencesMediaAF>(*this);
 #else
-        m_captionPreferences = CaptionUserPreferences::create(*this);
+        m_captionPreferences = makeUnique<CaptionUserPreferences>(*this);
 #endif
     }
 

Modified: branches/safari-612-branch/Source/WebCore/page/PageGroup.h (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/page/PageGroup.h	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/page/PageGroup.h	2021-11-05 01:01:37 UTC (rev 285323)
@@ -66,7 +66,7 @@
     unsigned m_identifier;
 
 #if ENABLE(VIDEO)
-    RefPtr<CaptionUserPreferences> m_captionPreferences;
+    std::unique_ptr<CaptionUserPreferences> m_captionPreferences;
 #endif
 };
 

Deleted: branches/safari-612-branch/Source/WebCore/page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm (285322 => 285323)


--- branches/safari-612-branch/Source/WebCore/page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm	2021-11-05 00:54:11 UTC (rev 285322)
+++ branches/safari-612-branch/Source/WebCore/page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm	2021-11-05 01:01:37 UTC (rev 285323)
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "CaptionUserPreferencesMediaAF.h"
-
-#if ENABLE(VIDEO) && PLATFORM(COCOA)
-
-#import <wtf/cocoa/TypeCastsCocoa.h>
-#import <wtf/spi/cocoa/NSObjCRuntimeSPI.h>
-
-@interface WebCaptionUserPreferencesMediaAFWeakObserver : NSObject {
-    WeakPtr<WebCore::CaptionUserPreferencesMediaAF> m_weakPtr;
-}
-@property (nonatomic, readonly, direct) RefPtr<WebCore::CaptionUserPreferencesMediaAF> userPreferences;
-- (instancetype)init NS_UNAVAILABLE;
-- (instancetype)initWithWeakPtr:(WeakPtr<WebCore::CaptionUserPreferencesMediaAF>&&)weakPtr NS_DESIGNATED_INITIALIZER;
-@end
-
-NS_DIRECT_MEMBERS
-@implementation WebCaptionUserPreferencesMediaAFWeakObserver
-- (instancetype)initWithWeakPtr:(WeakPtr<WebCore::CaptionUserPreferencesMediaAF>&&)weakPtr
-{
-    if ((self = [super init]))
-        m_weakPtr = WTFMove(weakPtr);
-    return self;
-}
-
-- (RefPtr<WebCore::CaptionUserPreferencesMediaAF>)userPreferences
-{
-    return m_weakPtr.get();
-}
-@end
-
-namespace WebCore {
-
-RetainPtr<WebCaptionUserPreferencesMediaAFWeakObserver> CaptionUserPreferencesMediaAF::createWeakObserver(CaptionUserPreferencesMediaAF* thisPtr)
-{
-    return adoptNS([[WebCaptionUserPreferencesMediaAFWeakObserver alloc] initWithWeakPtr:WeakPtr { *thisPtr }]);
-}
-
-RefPtr<CaptionUserPreferencesMediaAF> CaptionUserPreferencesMediaAF::extractCaptionUserPreferencesMediaAF(void* observer)
-{
-    RetainPtr strongObserver { dynamic_objc_cast<WebCaptionUserPreferencesMediaAFWeakObserver>(reinterpret_cast<id>(observer)) };
-    if (!strongObserver)
-        return nullptr;
-    return [strongObserver userPreferences];
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(VIDEO) && PLATFORM(COCOA)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to