<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[285325] branches/safari-612-branch/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/285325">285325</a></dd>
<dt>Author</dt> <dd>repstein@apple.com</dd>
<dt>Date</dt> <dd>2021-11-04 18:54:42 -0700 (Thu, 04 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/284163">r284163</a>. rdar://problem/85042122

    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</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari612branchSourceWebCoreChangeLog">branches/safari-612-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari612branchSourceWebCoreSourcesCocoatxt">branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt</a></li>
<li><a href="#branchessafari612branchSourceWebCoreWebCorexcodeprojprojectpbxproj">branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari612branchSourceWebCorepageCaptionUserPreferencescpp">branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCorepageCaptionUserPreferencesh">branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.h</a></li>
<li><a href="#branchessafari612branchSourceWebCorepageCaptionUserPreferencesMediaAFcpp">branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCorepageCaptionUserPreferencesMediaAFh">branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.h</a></li>
<li><a href="#branchessafari612branchSourceWebCorepagePageGroupcpp">branches/safari-612-branch/Source/WebCore/page/PageGroup.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCorepagePageGrouph">branches/safari-612-branch/Source/WebCore/page/PageGroup.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari612branchSourceWebCorepagecocoaCaptionUserPreferencesMediaAFCocoamm">branches/safari-612-branch/Source/WebCore/page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari612branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/ChangeLog      2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -1,5 +1,156 @@
</span><span class="cx"> 2021-11-04  Russell Epstein  <repstein@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r284163. rdar://problem/85042122
+
+    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  <ddkilzer@apple.com>
+
+            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  <repstein@apple.com>
+
</ins><span class="cx">         Cherry-pick r282379. rdar://problem/85039227
</span><span class="cx"> 
</span><span class="cx">     Fix computed style for transform-origin on SVG boxes
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreSourcesCocoatxt"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt       2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/SourcesCocoa.txt  2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -184,6 +184,7 @@
</span><span class="cx"> loader/mac/LoaderNSURLExtras.mm
</span><span class="cx"> loader/mac/ResourceLoaderMac.mm
</span><span class="cx"> page/CaptionUserPreferencesMediaAF.cpp
</span><ins>+page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm
</ins><span class="cx"> page/cocoa/MemoryReleaseCocoa.mm
</span><span class="cx"> page/cocoa/PerformanceLoggingCocoa.mm
</span><span class="cx"> page/cocoa/ResourceUsageOverlayCocoa.mm
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -8226,6 +8226,7 @@
</span><span class="cx">          442956CA218A6D300080DB54 /* DictionaryLookupLegacy.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DictionaryLookupLegacy.mm; sourceTree = "<group>"; };
</span><span class="cx">          4437C4A724E2AE5F00095128 /* LazyLoadFrameObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LazyLoadFrameObserver.h; sourceTree = "<group>"; };
</span><span class="cx">          4437C4A924E2AE5F00095128 /* LazyLoadFrameObserver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LazyLoadFrameObserver.cpp; sourceTree = "<group>"; };
</span><ins>+               443877E3271681F600FD3E33 /* CaptionUserPreferencesMediaAFCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CaptionUserPreferencesMediaAFCocoa.mm; sourceTree = "<group>"; };
</ins><span class="cx">           443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkStateNotifierIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">          444D4E210F708B2E003158E0 /* WebCoreURLResponseIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponseIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">          445210DD25D61EFF003A2ED8 /* AppHighlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppHighlight.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -21511,6 +21512,7 @@
</span><span class="cx">          5D5975B5196362BE00D00878 /* cocoa */ = {
</span><span class="cx">                  isa = PBXGroup;
</span><span class="cx">                  children = (
</span><ins>+                               443877E3271681F600FD3E33 /* CaptionUserPreferencesMediaAFCocoa.mm */,
</ins><span class="cx">                           F446EDDD265DAE3F0031DA8F /* DataDetectionResultsStorage.h */,
</span><span class="cx">                          F446EDE7265DD8900031DA8F /* DataDetectorElementInfo.h */,
</span><span class="cx">                          F446EDE0265DB1E50031DA8F /* ImageOverlayDataDetectionResultIdentifier.h */,
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorepageCaptionUserPreferencescpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.cpp (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.cpp        2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.cpp   2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -49,6 +49,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+Ref<CaptionUserPreferences> CaptionUserPreferences::create(PageGroup& group)
+{
+    return adoptRef(*new CaptionUserPreferences(group));
+}
+
</ins><span class="cx"> CaptionUserPreferences::CaptionUserPreferences(PageGroup& group)
</span><span class="cx">     : m_pageGroup(group)
</span><span class="cx">     , m_displayMode(ForcedOnly)
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorepageCaptionUserPreferencesh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.h (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.h  2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferences.h     2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "Timer.h"
</span><span class="cx"> #include <wtf/EnumTraits.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><ins>+#include <wtf/WeakPtr.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -41,10 +42,10 @@
</span><span class="cx"> class TextTrackList;
</span><span class="cx"> struct MediaSelectionOption;
</span><span class="cx"> 
</span><del>-class CaptionUserPreferences {
</del><ins>+class CaptionUserPreferences : public RefCounted<CaptionUserPreferences>, public CanMakeWeakPtr<CaptionUserPreferences> {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    CaptionUserPreferences(PageGroup&);
</del><ins>+    static Ref<CaptionUserPreferences> create(PageGroup&);
</ins><span class="cx">     virtual ~CaptionUserPreferences();
</span><span class="cx"> 
</span><span class="cx">     enum CaptionDisplayMode {
</span><span class="lines">@@ -102,6 +103,8 @@
</span><span class="cx">     PageGroup& pageGroup() const { return m_pageGroup; }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><ins>+    explicit CaptionUserPreferences(PageGroup&);
+
</ins><span class="cx">     void updateCaptionStyleSheetOverride();
</span><span class="cx">     void beginBlockingNotifications();
</span><span class="cx">     void endBlockingNotifications();
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorepageCaptionUserPreferencesMediaAFcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp    2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -24,13 +24,10 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include "config.h"
</span><ins>+#include "CaptionUserPreferencesMediaAF.h"
</ins><span class="cx"> 
</span><del>-#if ENABLE(VIDEO)
</del><ins>+#if ENABLE(VIDEO) && !USE(DIRECT2D)
</ins><span class="cx"> 
</span><del>-#if !USE(DIRECT2D)
-
-#include "CaptionUserPreferencesMediaAF.h"
-
</del><span class="cx"> #include "AudioTrackList.h"
</span><span class="cx"> #include "ColorSerialization.h"
</span><span class="cx"> #include "FloatConversion.h"
</span><span class="lines">@@ -51,8 +48,12 @@
</span><span class="cx"> #include <wtf/text/cf/StringConcatenateCF.h>
</span><span class="cx"> #include <wtf/unicode/Collator.h>
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+#include <pal/spi/cf/CFNotificationCenterSPI.h>
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><del>-#import "WebCoreThreadRun.h"
</del><ins>+#include "WebCoreThreadRun.h"
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="lines">@@ -118,24 +119,35 @@
</span><span class="cx">     return preferredLanguages;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void userCaptionPreferencesChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void *, CFDictionaryRef)
</del><ins>+static void userCaptionPreferencesChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
</ins><span class="cx"> {
</span><ins>+#if PLATFORM(COCOA)
+    RefPtr userPreferences = CaptionUserPreferencesMediaAF::extractCaptionUserPreferencesMediaAF(observer);
+#elif PLATFORM(WIN)
+    auto* userPreferences = static_cast<CaptionUserPreferencesMediaAF*>(observer);
+#endif
+    if (userPreferences) {
</ins><span class="cx"> #if !PLATFORM(IOS_FAMILY)
</span><del>-    static_cast<CaptionUserPreferencesMediaAF*>(observer)->captionPreferencesChanged();
</del><ins>+        userPreferences->captionPreferencesChanged();
</ins><span class="cx"> #else
</span><del>-    WebThreadRun(^{
-        static_cast<CaptionUserPreferencesMediaAF*>(observer)->captionPreferencesChanged();
-    });
</del><ins>+        WebThreadRun(^{
+            userPreferences->captionPreferencesChanged();
+        });
</ins><span class="cx"> #endif
</span><ins>+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+#endif // HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</ins><span class="cx"> 
</span><ins>+Ref<CaptionUserPreferencesMediaAF> CaptionUserPreferencesMediaAF::create(PageGroup& group)
+{
+    return adoptRef(*new CaptionUserPreferencesMediaAF(group));
+}
+
</ins><span class="cx"> CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF(PageGroup& group)
</span><span class="cx">     : CaptionUserPreferences(group)
</span><span class="cx"> #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</span><span class="cx">     , m_updateStyleSheetTimer(*this, &CaptionUserPreferencesMediaAF::updateTimerFired)
</span><del>-    , m_listeningForPreferenceChanges(false)
</del><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     static bool initialized;
</span><span class="lines">@@ -163,11 +175,19 @@
</span><span class="cx"> CaptionUserPreferencesMediaAF::~CaptionUserPreferencesMediaAF()
</span><span class="cx"> {
</span><span class="cx"> #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</span><del>-    if (kMAXCaptionAppearanceSettingsChangedNotification)
-        CFNotificationCenterRemoveObserver(CFNotificationCenterGetLocalCenter(), this, kMAXCaptionAppearanceSettingsChangedNotification, 0);
-    if (kMAAudibleMediaSettingsChangedNotification)
-        CFNotificationCenterRemoveObserver(CFNotificationCenterGetLocalCenter(), this, kMAAudibleMediaSettingsChangedNotification, 0);
</del><ins>+#if PLATFORM(COCOA)
+    auto* observer = m_weakObserver.get();
+#elif PLATFORM(WIN)
+    auto* observer = this;
</ins><span class="cx"> #endif
</span><ins>+    if (observer) {
+        auto center = CFNotificationCenterGetLocalCenter();
+        if (kMAXCaptionAppearanceSettingsChangedNotification)
+            CFNotificationCenterRemoveObserver(center, observer, kMAXCaptionAppearanceSettingsChangedNotification, 0);
+        if (kMAAudibleMediaSettingsChangedNotification)
+            CFNotificationCenterRemoveObserver(center, observer, kMAAudibleMediaSettingsChangedNotification, 0);
+    }
+#endif // HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</span><span class="lines">@@ -285,10 +305,21 @@
</span><span class="cx">     m_listeningForPreferenceChanges = true;
</span><span class="cx">     m_registeringForNotification = true;
</span><span class="cx"> 
</span><ins>+#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();
</ins><span class="cx">     if (kMAXCaptionAppearanceSettingsChangedNotification)
</span><del>-        CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, userCaptionPreferencesChangedNotificationCallback, kMAXCaptionAppearanceSettingsChangedNotification, 0, CFNotificationSuspensionBehaviorCoalesce);
</del><ins>+        CFNotificationCenterAddObserver(center, observer, userCaptionPreferencesChangedNotificationCallback, kMAXCaptionAppearanceSettingsChangedNotification, 0, suspensionBehavior);
+
</ins><span class="cx">     if (canLoad_MediaAccessibility_kMAAudibleMediaSettingsChangedNotification())
</span><del>-        CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, userCaptionPreferencesChangedNotificationCallback, kMAAudibleMediaSettingsChangedNotification, 0, CFNotificationSuspensionBehaviorCoalesce);
</del><ins>+        CFNotificationCenterAddObserver(center, observer, userCaptionPreferencesChangedNotificationCallback, kMAAudibleMediaSettingsChangedNotification, 0, suspensionBehavior);
</ins><span class="cx">     m_registeringForNotification = false;
</span><span class="cx"> 
</span><span class="cx">     // Generating and registering the caption stylesheet can be expensive and this method is called indirectly when the parser creates an audio or
</span><span class="lines">@@ -963,6 +994,4 @@
</span><span class="cx">     
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif
-
-#endif // ENABLE(VIDEO)
</del><ins>+#endif // ENABLE(VIDEO) && !USE(DIRECT2D)
</ins></span></pre></div>
<a id="branchessafari612branchSourceWebCorepageCaptionUserPreferencesMediaAFh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.h (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.h   2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.h      2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><del>-#if ENABLE(VIDEO)
</del><ins>+#if ENABLE(VIDEO) && !USE(DIRECT2D)
</ins><span class="cx"> 
</span><span class="cx"> #include "CSSPropertyNames.h"
</span><span class="cx"> #include "CaptionPreferencesDelegate.h"
</span><span class="lines">@@ -32,12 +32,16 @@
</span><span class="cx"> #include "CaptionUserPreferences.h"
</span><span class="cx"> #include "Color.h"
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+OBJC_CLASS WebCaptionUserPreferencesMediaAFWeakObserver;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class CaptionUserPreferencesMediaAF : public CaptionUserPreferences {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    CaptionUserPreferencesMediaAF(PageGroup&);
</del><ins>+    static Ref<CaptionUserPreferencesMediaAF> create(PageGroup&);
</ins><span class="cx">     virtual ~CaptionUserPreferencesMediaAF();
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</span><span class="lines">@@ -75,6 +79,10 @@
</span><span class="cx">     bool shouldFilterTrackMenu() const { return false; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) && PLATFORM(COCOA)
+    static RefPtr<CaptionUserPreferencesMediaAF> extractCaptionUserPreferencesMediaAF(void* observer);
+#endif
+
</ins><span class="cx">     String captionsStyleSheetOverride() const override;
</span><span class="cx">     Vector<RefPtr<AudioTrack>> sortedTrackListForMenu(AudioTrackList*) override;
</span><span class="cx">     Vector<RefPtr<TextTrack>> sortedTrackListForMenu(TextTrackList*, HashSet<TextTrack::Kind>) override;
</span><span class="lines">@@ -82,6 +90,8 @@
</span><span class="cx">     String displayNameForTrack(TextTrack*) const override;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    CaptionUserPreferencesMediaAF(PageGroup&);
+
</ins><span class="cx"> #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</span><span class="cx">     void updateTimerFired();
</span><span class="cx"> 
</span><span class="lines">@@ -93,9 +103,17 @@
</span><span class="cx">     String windowRoundedCornerRadiusCSS() const;
</span><span class="cx">     String captionsTextEdgeCSS() const;
</span><span class="cx">     String colorPropertyCSS(CSSPropertyID, const Color&, bool) const;
</span><ins>+#endif
+
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK) && PLATFORM(COCOA)
+    static RetainPtr<WebCaptionUserPreferencesMediaAFWeakObserver> createWeakObserver(CaptionUserPreferencesMediaAF*);
+
+    RetainPtr<WebCaptionUserPreferencesMediaAFWeakObserver> m_weakObserver;
+#endif
+
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</ins><span class="cx">     Timer m_updateStyleSheetTimer;
</span><del>-
-    bool m_listeningForPreferenceChanges;
</del><ins>+    bool m_listeningForPreferenceChanges { false };
</ins><span class="cx">     bool m_registeringForNotification { false };
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="lines">@@ -102,4 +120,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-#endif // ENABLE(VIDEO)
</del><ins>+#endif // ENABLE(VIDEO) && !USE(DIRECT2D)
</ins></span></pre></div>
<a id="branchessafari612branchSourceWebCorepagePageGroupcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/page/PageGroup.cpp (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/page/PageGroup.cpp     2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/page/PageGroup.cpp        2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -113,9 +113,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_captionPreferences) {
</span><span class="cx"> #if PLATFORM(MAC) || HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</span><del>-        m_captionPreferences = makeUnique<CaptionUserPreferencesMediaAF>(*this);
</del><ins>+        m_captionPreferences = CaptionUserPreferencesMediaAF::create(*this);
</ins><span class="cx"> #else
</span><del>-        m_captionPreferences = makeUnique<CaptionUserPreferences>(*this);
</del><ins>+        m_captionPreferences = CaptionUserPreferences::create(*this);
</ins><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorepagePageGrouph"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/page/PageGroup.h (285324 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/page/PageGroup.h       2021-11-05 01:35:44 UTC (rev 285324)
+++ branches/safari-612-branch/Source/WebCore/page/PageGroup.h  2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     unsigned m_identifier;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>-    std::unique_ptr<CaptionUserPreferences> m_captionPreferences;
</del><ins>+    RefPtr<CaptionUserPreferences> m_captionPreferences;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorepagecocoaCaptionUserPreferencesMediaAFCocoamm"></a>
<div class="addfile"><h4>Added: branches/safari-612-branch/Source/WebCore/page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm (0 => 285325)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm                               (rev 0)
+++ branches/safari-612-branch/Source/WebCore/page/cocoa/CaptionUserPreferencesMediaAFCocoa.mm  2021-11-05 01:54:42 UTC (rev 285325)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+/*
+ * 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_ns_cast<WebCaptionUserPreferencesMediaAFWeakObserver>(reinterpret_cast<id>(observer)) };
+    if (!strongObserver)
+        return nullptr;
+    return [strongObserver userPreferences];
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(VIDEO) && PLATFORM(COCOA)
</ins></span></pre>
</div>
</div>

</body>
</html>