<!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>[176542] trunk/Source</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/176542">176542</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-11-25 08:16:15 -0800 (Tue, 25 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a user content controller to WebViewGroup and use it for user content
https://bugs.webkit.org/show_bug.cgi?id=139043

Reviewed by Antti Koivisto.

Source/WebCore:

* WebCore.exp.in:
Export symbols.

* page/Page.cpp:
(WebCore::Page::setUserContentController):
Invalidate the injected style cache when setting a new user content controller.

Source/WebKit/mac:

This is another tiny step towards getting rid of user content handling inside PageGroup.

* WebCoreSupport/WebViewGroup.h:
(WebViewGroup::userContentController):
Add a UserContentController member and getter.

* WebCoreSupport/WebViewGroup.mm:
(WebViewGroup::get):
Helper function that returns a WebViewGroup by its name (or null if it doesn't exist).

(WebViewGroup::WebViewGroup):
Create a user content controller.

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
Instead of calling -[WebView setGroupName:], create a WebViewGroup before creating the page, that way we can
set its user content controller in the PageConfiguration.

(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
Ditto.

(+[WebView _addUserScriptToGroup:world:source:url:whitelist:blacklist:injectionTime:injectedFrames:]):
(+[WebView _addUserStyleSheetToGroup:world:source:url:whitelist:blacklist:injectedFrames:]):
(+[WebView _removeUserScriptFromGroup:world:url:]):
(+[WebView _removeUserStyleSheetFromGroup:world:url:]):
(+[WebView _removeUserScriptsFromGroup:world:]):
(+[WebView _removeUserStyleSheetsFromGroup:world:]):
(+[WebView _removeAllUserContentFromGroup:]):
Instead of calling into the PageGroup, get the WebViewGroup's user content controller and call into that.

(-[WebView setGroupName:]):
Set the user content controller to the new WebViewGroup's user content controller.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebViewGrouph">trunk/Source/WebKit/mac/WebCoreSupport/WebViewGroup.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebViewGroupmm">trunk/Source/WebKit/mac/WebCoreSupport/WebViewGroup.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176541 => 176542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-25 14:49:30 UTC (rev 176541)
+++ trunk/Source/WebCore/ChangeLog        2014-11-25 16:16:15 UTC (rev 176542)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-11-25  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Add a user content controller to WebViewGroup and use it for user content
+        https://bugs.webkit.org/show_bug.cgi?id=139043
+
+        Reviewed by Antti Koivisto.
+
+        * WebCore.exp.in:
+        Export symbols.
+
+        * page/Page.cpp:
+        (WebCore::Page::setUserContentController):
+        Invalidate the injected style cache when setting a new user content controller.
+
</ins><span class="cx"> 2014-11-25  Philippe Normand  &lt;pnormand@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GStreamer] gstmpegts is not initialized
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (176541 => 176542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-11-25 14:49:30 UTC (rev 176541)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-11-25 16:16:15 UTC (rev 176542)
</span><span class="lines">@@ -957,8 +957,11 @@
</span><span class="cx"> __ZN7WebCore21SerializedScriptValueD1Ev
</span><span class="cx"> __ZN7WebCore21URLByRemovingUserInfoEP5NSURL
</span><span class="cx"> __ZN7WebCore21UserContentController13addUserScriptERNS_15DOMWrapperWorldENSt3__110unique_ptrINS_10UserScriptENS3_14default_deleteIS5_EEEE
</span><ins>+__ZN7WebCore21UserContentController16removeUserScriptERNS_15DOMWrapperWorldERKNS_3URLE
</ins><span class="cx"> __ZN7WebCore21UserContentController17addUserStyleSheetERNS_15DOMWrapperWorldENSt3__110unique_ptrINS_14UserStyleSheetENS3_14default_deleteIS5_EEEENS_22UserStyleInjectionTimeE
</span><span class="cx"> __ZN7WebCore21UserContentController17removeUserScriptsERNS_15DOMWrapperWorldE
</span><ins>+__ZN7WebCore21UserContentController20removeAllUserContentEv
+__ZN7WebCore21UserContentController20removeUserStyleSheetERNS_15DOMWrapperWorldERKNS_3URLE
</ins><span class="cx"> __ZN7WebCore21UserContentController21removeUserStyleSheetsERNS_15DOMWrapperWorldE
</span><span class="cx"> __ZN7WebCore21UserContentController31addUserMessageHandlerDescriptorERNS_28UserMessageHandlerDescriptorE
</span><span class="cx"> __ZN7WebCore21UserContentController34removeUserMessageHandlerDescriptorERNS_28UserMessageHandlerDescriptorE
</span><span class="lines">@@ -1165,6 +1168,7 @@
</span><span class="cx"> __ZN7WebCore4Page24findStringMatchingRangesERKN3WTF6StringEhiRNS1_6VectorINS1_6RefPtrINS_5RangeEEELj0ENS1_15CrashOnOverflowEEERi
</span><span class="cx"> __ZN7WebCore4Page24resumeScriptedAnimationsEv
</span><span class="cx"> __ZN7WebCore4Page24scrollingStateTreeAsTextEv
</span><ins>+__ZN7WebCore4Page24setUserContentControllerEPNS_21UserContentControllerE
</ins><span class="cx"> __ZN7WebCore4Page25suspendScriptedAnimationsEv
</span><span class="cx"> __ZN7WebCore4Page27enableLegacyPrivateBrowsingEb
</span><span class="cx"> __ZN7WebCore4Page27invalidateStylesForAllLinksEv
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (176541 => 176542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2014-11-25 14:49:30 UTC (rev 176541)
+++ trunk/Source/WebCore/page/Page.cpp        2014-11-25 16:16:15 UTC (rev 176542)
</span><span class="lines">@@ -1620,6 +1620,13 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_userContentController)
</span><span class="cx">         m_userContentController-&gt;addPage(*this);
</span><ins>+
+    for (Frame* frame = &amp;mainFrame(); frame; frame = frame-&gt;tree().traverseNext()) {
+        if (Document *document = frame-&gt;document()) {
+            document-&gt;styleSheetCollection().invalidateInjectedStyleSheetCache();
+            document-&gt;styleResolverChanged(DeferRecalcStyle);
+        }
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VisitedLinkStore&amp; Page::visitedLinkStore()
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (176541 => 176542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-11-25 14:49:30 UTC (rev 176541)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-11-25 16:16:15 UTC (rev 176542)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2014-11-25  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Add a user content controller to WebViewGroup and use it for user content
+        https://bugs.webkit.org/show_bug.cgi?id=139043
+
+        Reviewed by Antti Koivisto.
+
+        This is another tiny step towards getting rid of user content handling inside PageGroup.
+
+        * WebCoreSupport/WebViewGroup.h:
+        (WebViewGroup::userContentController):
+        Add a UserContentController member and getter.
+
+        * WebCoreSupport/WebViewGroup.mm:
+        (WebViewGroup::get):
+        Helper function that returns a WebViewGroup by its name (or null if it doesn't exist).
+
+        (WebViewGroup::WebViewGroup):
+        Create a user content controller.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        Instead of calling -[WebView setGroupName:], create a WebViewGroup before creating the page, that way we can
+        set its user content controller in the PageConfiguration.
+
+        (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+        Ditto.
+
+        (+[WebView _addUserScriptToGroup:world:source:url:whitelist:blacklist:injectionTime:injectedFrames:]):
+        (+[WebView _addUserStyleSheetToGroup:world:source:url:whitelist:blacklist:injectedFrames:]):
+        (+[WebView _removeUserScriptFromGroup:world:url:]):
+        (+[WebView _removeUserStyleSheetFromGroup:world:url:]):
+        (+[WebView _removeUserScriptsFromGroup:world:]):
+        (+[WebView _removeUserStyleSheetsFromGroup:world:]):
+        (+[WebView _removeAllUserContentFromGroup:]):
+        Instead of calling into the PageGroup, get the WebViewGroup's user content controller and call into that.
+
+        (-[WebView setGroupName:]):
+        Set the user content controller to the new WebViewGroup's user content controller.
+
</ins><span class="cx"> 2014-11-21  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Support multiple signatures of diagnostic logging.
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebViewGrouph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebViewGroup.h (176541 => 176542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebViewGroup.h        2014-11-25 14:49:30 UTC (rev 176541)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebViewGroup.h        2014-11-25 16:16:15 UTC (rev 176542)
</span><span class="lines">@@ -23,10 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#import &lt;wtf/HashSet.h&gt;
-#import &lt;wtf/RefCounted.h&gt;
-#import &lt;wtf/PassRefPtr.h&gt;
-#import &lt;wtf/text/WTFString.h&gt;
</del><ins>+#import &lt;WebCore/UserContentController.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> @class WebView;
</span><span class="cx"> 
</span><span class="lines">@@ -35,12 +32,18 @@
</span><span class="cx">     static PassRefPtr&lt;WebViewGroup&gt; getOrCreate(const String&amp; name);
</span><span class="cx">     ~WebViewGroup();
</span><span class="cx"> 
</span><ins>+    static WebViewGroup* get(const String&amp; name);
+
</ins><span class="cx">     void addWebView(WebView *);
</span><span class="cx">     void removeWebView(WebView *);
</span><del>-    
</del><ins>+
+    WebCore::UserContentController&amp; userContentController() { return m_userContentController.get(); }
+
</ins><span class="cx"> private:
</span><span class="cx">     WebViewGroup(const String&amp; name);
</span><span class="cx"> 
</span><span class="cx">     String m_name;
</span><span class="cx">     HashSet&lt;WebView *&gt; m_webViews;
</span><ins>+
+    Ref&lt;WebCore::UserContentController&gt; m_userContentController;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebViewGroupmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebViewGroup.mm (176541 => 176542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebViewGroup.mm        2014-11-25 14:49:30 UTC (rev 176541)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebViewGroup.mm        2014-11-25 16:16:15 UTC (rev 176542)
</span><span class="lines">@@ -26,11 +26,11 @@
</span><span class="cx"> #import &quot;WebViewGroup.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebView.h&quot;
</span><del>-#import &lt;wtf/HashMap.h&gt;
</del><span class="cx"> #import &lt;wtf/NeverDestroyed.h&gt;
</span><del>-#import &lt;wtf/RefPtr.h&gt;
</del><span class="cx"> #import &lt;wtf/text/StringHash.h&gt;
</span><span class="cx"> 
</span><ins>+using namespace WebCore;
+
</ins><span class="cx"> // Any named groups will live for the lifetime of the process, thanks to the reference held by the RefPtr.
</span><span class="cx"> static HashMap&lt;String, RefPtr&lt;WebViewGroup&gt;&gt;&amp; webViewGroups()
</span><span class="cx"> {
</span><span class="lines">@@ -51,8 +51,16 @@
</span><span class="cx">     return webViewGroup;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WebViewGroup* WebViewGroup::get(const String&amp; name)
+{
+    ASSERT(!name.isEmpty());
+
+    return webViewGroups().get(name);
+}
+
</ins><span class="cx"> WebViewGroup::WebViewGroup(const String&amp; name)
</span><span class="cx">     : m_name(name)
</span><ins>+    , m_userContentController(*UserContentController::create())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (176541 => 176542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-11-25 14:49:30 UTC (rev 176541)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-11-25 16:16:15 UTC (rev 176542)
</span><span class="lines">@@ -176,6 +176,7 @@
</span><span class="cx"> #import &lt;WebCore/TextResourceDecoder.h&gt;
</span><span class="cx"> #import &lt;WebCore/ThreadCheck.h&gt;
</span><span class="cx"> #import &lt;WebCore/UserAgent.h&gt;
</span><ins>+#import &lt;WebCore/UserContentController.h&gt;
</ins><span class="cx"> #import &lt;WebCore/WebCoreObjCExtras.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreView.h&gt;
</span><span class="cx"> #import &lt;WebCore/Widget.h&gt;
</span><span class="lines">@@ -919,6 +920,9 @@
</span><span class="cx">         didOneTimeInitialization = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _private-&gt;group = WebViewGroup::getOrCreate(groupName);
+    _private-&gt;group-&gt;addWebView(self);
+
</ins><span class="cx">     PageConfiguration pageConfiguration;
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">     pageConfiguration.chromeClient = new WebChromeClient(self);
</span><span class="lines">@@ -935,7 +939,11 @@
</span><span class="cx">     pageConfiguration.alternativeTextClient = new WebAlternativeTextClient(self);
</span><span class="cx">     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
</span><span class="cx">     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
</span><ins>+    pageConfiguration.userContentController = &amp;_private-&gt;group-&gt;userContentController();
</ins><span class="cx">     _private-&gt;page = new Page(pageConfiguration);
</span><ins>+
+    _private-&gt;page-&gt;setGroupName(groupName);
+
</ins><span class="cx"> #if ENABLE(GEOLOCATION)
</span><span class="cx">     WebCore::provideGeolocationTo(_private-&gt;page, new WebGeolocationClient(self));
</span><span class="cx"> #endif
</span><span class="lines">@@ -992,7 +1000,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     [self _addToAllWebViewsSet];
</span><del>-    [self setGroupName:groupName];
</del><span class="cx">     
</span><span class="cx">     // If there's already a next key view (e.g., from a nib), wire it up to our
</span><span class="cx">     // contained frame view. In any case, wire our next key view up to the our
</span><span class="lines">@@ -1155,7 +1162,9 @@
</span><span class="cx">     [self addSubview:frameView];
</span><span class="cx">     [frameView release];
</span><span class="cx"> 
</span><del>-    
</del><ins>+    _private-&gt;group = WebViewGroup::getOrCreate(groupName);
+    _private-&gt;group-&gt;addWebView(self);
+
</ins><span class="cx">     PageConfiguration pageConfiguration;
</span><span class="cx">     pageConfiguration.chromeClient = new WebChromeClientIOS(self);
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="lines">@@ -1165,6 +1174,8 @@
</span><span class="cx">     pageConfiguration.inspectorClient = new WebInspectorClient(self);
</span><span class="cx">     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
</span><span class="cx">     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
</span><ins>+    pageConfiguration.userContentController = &amp;_private-&gt;group-&gt;userContentController();
+
</ins><span class="cx">     _private-&gt;page = new Page(pageConfiguration);
</span><span class="cx">     
</span><span class="cx">     [self setSmartInsertDeleteEnabled:YES];
</span><span class="lines">@@ -1192,7 +1203,7 @@
</span><span class="cx">     // FIXME: this is a workaround for &lt;rdar://problem/11820090&gt; Quoted text changes in size when replying to certain email
</span><span class="cx">     _private-&gt;page-&gt;settings().setMinimumFontSize([_private-&gt;preferences minimumFontSize]);
</span><span class="cx"> 
</span><del>-    [self setGroupName:groupName];
</del><ins>+    _private-&gt;page-&gt;setGroupName(groupName);
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx">     _private-&gt;page-&gt;setRemoteInspectionAllowed(isInternalInstall());
</span><span class="lines">@@ -3995,17 +4006,16 @@
</span><span class="cx">     String group(groupName);
</span><span class="cx">     if (group.isEmpty())
</span><span class="cx">         return;
</span><del>-    
-    PageGroup* pageGroup = PageGroup::pageGroup(group);
-    if (!pageGroup)
</del><ins>+
+    auto* viewGroup = WebViewGroup::get(group);
+    if (!viewGroup)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (!world)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    pageGroup-&gt;addUserScriptToWorld(*core(world), source, url, toStringVector(whitelist), toStringVector(blacklist),
-                                    injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd,
-                                    injectedFrames == WebInjectInAllFrames ? InjectInAllFrames : InjectInTopFrameOnly);
</del><ins>+    auto userScript = std::make_unique&lt;UserScript&gt;(source, url, toStringVector(whitelist), toStringVector(blacklist), injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd, injectedFrames == WebInjectInAllFrames ? InjectInAllFrames : InjectInTopFrameOnly);
+    viewGroup-&gt;userContentController().addUserScript(*core(world), WTF::move(userScript));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url
</span><span class="lines">@@ -4021,15 +4031,16 @@
</span><span class="cx">     String group(groupName);
</span><span class="cx">     if (group.isEmpty())
</span><span class="cx">         return;
</span><del>-    
-    PageGroup* pageGroup = PageGroup::pageGroup(group);
-    if (!pageGroup)
</del><ins>+
+    auto* viewGroup = WebViewGroup::get(group);
+    if (!viewGroup)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (!world)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    pageGroup-&gt;addUserStyleSheetToWorld(*core(world), source, url, toStringVector(whitelist), toStringVector(blacklist), injectedFrames == WebInjectInAllFrames ? InjectInAllFrames : InjectInTopFrameOnly);
</del><ins>+    auto styleSheet = std::make_unique&lt;UserStyleSheet&gt;(source, url, toStringVector(whitelist), toStringVector(blacklist), injectedFrames == WebInjectInAllFrames ? InjectInAllFrames : InjectInTopFrameOnly, UserStyleUserLevel);
+    viewGroup-&gt;userContentController().addUserStyleSheet(*core(world), WTF::move(styleSheet), InjectInExistingDocuments);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)_removeUserScriptFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url
</span><span class="lines">@@ -4037,15 +4048,15 @@
</span><span class="cx">     String group(groupName);
</span><span class="cx">     if (group.isEmpty())
</span><span class="cx">         return;
</span><del>-    
-    PageGroup* pageGroup = PageGroup::pageGroup(group);
-    if (!pageGroup)
</del><ins>+
+    auto* viewGroup = WebViewGroup::get(group);
+    if (!viewGroup)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (!world)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    pageGroup-&gt;removeUserScriptFromWorld(*core(world), url);
</del><ins>+    viewGroup-&gt;userContentController().removeUserScript(*core(world), url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)_removeUserStyleSheetFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url
</span><span class="lines">@@ -4053,15 +4064,15 @@
</span><span class="cx">     String group(groupName);
</span><span class="cx">     if (group.isEmpty())
</span><span class="cx">         return;
</span><del>-    
-    PageGroup* pageGroup = PageGroup::pageGroup(group);
-    if (!pageGroup)
</del><ins>+
+    auto* viewGroup = WebViewGroup::get(group);
+    if (!viewGroup)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (!world)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    pageGroup-&gt;removeUserStyleSheetFromWorld(*core(world), url);
</del><ins>+    viewGroup-&gt;userContentController().removeUserStyleSheet(*core(world), url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)_removeUserScriptsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world
</span><span class="lines">@@ -4069,15 +4080,15 @@
</span><span class="cx">     String group(groupName);
</span><span class="cx">     if (group.isEmpty())
</span><span class="cx">         return;
</span><del>-    
-    PageGroup* pageGroup = PageGroup::pageGroup(group);
-    if (!pageGroup)
</del><ins>+
+    auto* viewGroup = WebViewGroup::get(group);
+    if (!viewGroup)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (!world)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    pageGroup-&gt;removeUserScriptsFromWorld(*core(world));
</del><ins>+    viewGroup-&gt;userContentController().removeUserScripts(*core(world));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)_removeUserStyleSheetsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world
</span><span class="lines">@@ -4085,15 +4096,15 @@
</span><span class="cx">     String group(groupName);
</span><span class="cx">     if (group.isEmpty())
</span><span class="cx">         return;
</span><del>-    
-    PageGroup* pageGroup = PageGroup::pageGroup(group);
-    if (!pageGroup)
</del><ins>+
+    auto* viewGroup = WebViewGroup::get(group);
+    if (!viewGroup)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (!world)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    pageGroup-&gt;removeUserStyleSheetsFromWorld(*core(world));
</del><ins>+    viewGroup-&gt;userContentController().removeUserStyleSheets(*core(world));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)_removeAllUserContentFromGroup:(NSString *)groupName
</span><span class="lines">@@ -4101,12 +4112,12 @@
</span><span class="cx">     String group(groupName);
</span><span class="cx">     if (group.isEmpty())
</span><span class="cx">         return;
</span><del>-    
-    PageGroup* pageGroup = PageGroup::pageGroup(group);
-    if (!pageGroup)
</del><ins>+
+    auto* viewGroup = WebViewGroup::get(group);
+    if (!viewGroup)
</ins><span class="cx">         return;
</span><del>-    
-    pageGroup-&gt;removeAllUserContent();
</del><ins>+
+    viewGroup-&gt;userContentController().removeAllUserContent();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)allowsNewCSSAnimationsWhileSuspended
</span><span class="lines">@@ -6102,6 +6113,8 @@
</span><span class="cx"> 
</span><span class="cx">     if (!_private-&gt;page)
</span><span class="cx">         return;
</span><ins>+
+    _private-&gt;page-&gt;setUserContentController(&amp;_private-&gt;group-&gt;userContentController());
</ins><span class="cx">     _private-&gt;page-&gt;setGroupName(groupName);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>