Title: [273826] trunk/Source
Revision
273826
Author
megan_gard...@apple.com
Date
2021-03-03 10:54:58 -0800 (Wed, 03 Mar 2021)

Log Message

Preserve information about the origin of the app highlight request
https://bugs.webkit.org/show_bug.cgi?id=222223

Reviewed by Wenson Hsieh.

Source/WebCore:

* Modules/highlight/AppHighlight.h:
(WebCore::AppHighlight::encode const):
(WebCore::AppHighlight::decode):
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::storeAppHighlight):
* Modules/highlight/AppHighlightStorage.h:
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::storeAppHighlight const):
* loader/EmptyClients.h:
* page/Chrome.cpp:
(WebCore::Chrome::storeAppHighlight const):
* page/Chrome.h:
* page/ChromeClient.h:

Source/WebKit:

* Scripts/webkit/messages.py:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _storeAppHighlight:]):
(-[WKWebView _addAppHighlight]):
* UIProcess/API/Cocoa/_WKAppHighlightDelegate.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::createAppHighlightInSelectedRange):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView createHighlightInCurrentGroupWithRange:]):
(-[WKContentView createHighlightInNewGroupWithRange:]):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::storeAppHighlight const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createAppHighlightInSelectedRange):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::highlightIsNewGroup const):
(WebKit::WebPage::highlightRequestOriginatedInApp const):
* WebProcess/WebPage/WebPage.messages.in:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::storeAppHighlight const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273825 => 273826)


--- trunk/Source/WebCore/ChangeLog	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/ChangeLog	2021-03-03 18:54:58 UTC (rev 273826)
@@ -1,3 +1,24 @@
+2021-03-03  Megan Gardner  <megan_gard...@apple.com>
+
+        Preserve information about the origin of the app highlight request
+        https://bugs.webkit.org/show_bug.cgi?id=222223
+
+        Reviewed by Wenson Hsieh.
+
+        * Modules/highlight/AppHighlight.h:
+        (WebCore::AppHighlight::encode const):
+        (WebCore::AppHighlight::decode):
+        * Modules/highlight/AppHighlightStorage.cpp:
+        (WebCore::AppHighlightStorage::storeAppHighlight):
+        * Modules/highlight/AppHighlightStorage.h:
+        * loader/EmptyClients.cpp:
+        (WebCore::EmptyChromeClient::storeAppHighlight const):
+        * loader/EmptyClients.h:
+        * page/Chrome.cpp:
+        (WebCore::Chrome::storeAppHighlight const):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+
 2021-03-03  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed, reverting r273809.

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlight.h (273825 => 273826)


--- trunk/Source/WebCore/Modules/highlight/AppHighlight.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlight.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -35,10 +35,13 @@
 
 enum class CreateNewGroupForHighlight : bool { No, Yes };
 
+enum class HighlightRequestOriginatedInApp : bool { No, Yes };
+
 struct AppHighlight {
     Ref<WebCore::SharedBuffer> highlight;
     Optional<String> text;
     CreateNewGroupForHighlight isNewGroup;
+    HighlightRequestOriginatedInApp requestOriginatedInApp;
 
     template<class Encoder> void encode(Encoder&) const;
     template<class Decoder> static Optional<AppHighlight> decode(Decoder&);
@@ -54,6 +57,8 @@
     encoder << text;
 
     encoder << isNewGroup;
+
+    encoder << requestOriginatedInApp;
 }
 
 template<class Decoder>
@@ -84,7 +89,11 @@
     if (!decoder.decode(isNewGroup))
         return WTF::nullopt;
 
-    return {{ SharedBuffer::create(WTFMove(highlight)), WTFMove(*text), isNewGroup }};
+    HighlightRequestOriginatedInApp requestOriginatedInApp;
+    if (!decoder.decode(requestOriginatedInApp))
+        return WTF::nullopt;
+
+    return {{ SharedBuffer::create(WTFMove(highlight)), WTFMove(*text), isNewGroup, requestOriginatedInApp }};
 }
 
 }

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp (273825 => 273826)


--- trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp	2021-03-03 18:54:58 UTC (rev 273826)
@@ -214,7 +214,7 @@
 {
 }
 
-void AppHighlightStorage::storeAppHighlight(StaticRange& range, CreateNewGroupForHighlight isNewGroup)
+void AppHighlightStorage::storeAppHighlight(Ref<StaticRange>&& range)
 {
     auto data = ""
     Optional<String> text;
@@ -222,9 +222,9 @@
     if (!data.text().isEmpty())
         text = data.text();
 
-    AppHighlight highlight = {data.toSharedBuffer(), text, isNewGroup};
+    AppHighlight highlight = {data.toSharedBuffer(), text, CreateNewGroupForHighlight::No, HighlightRequestOriginatedInApp::No};
 
-    m_document->page()->chrome().storeAppHighlight(highlight);
+    m_document->page()->chrome().storeAppHighlight(WTFMove(highlight));
 }
 
 bool AppHighlightStorage::restoreAppHighlight(Ref<SharedBuffer>&& buffer)

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.h (273825 => 273826)


--- trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -48,7 +48,7 @@
 public:
     AppHighlightStorage(Document&);
 
-    WEBCORE_EXPORT void storeAppHighlight(StaticRange& , CreateNewGroupForHighlight isNewGroup);
+    WEBCORE_EXPORT void storeAppHighlight(Ref<StaticRange>&&);
     WEBCORE_EXPORT bool restoreAppHighlight(Ref<SharedBuffer>&&);
 
 private:

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (273825 => 273826)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2021-03-03 18:54:58 UTC (rev 273826)
@@ -506,7 +506,7 @@
 #endif
 
 #if ENABLE(APP_HIGHLIGHTS)
-void EmptyChromeClient::storeAppHighlight(const AppHighlight&) const
+void EmptyChromeClient::storeAppHighlight(AppHighlight&&) const
 {
 }
 #endif

Modified: trunk/Source/WebCore/loader/EmptyClients.h (273825 => 273826)


--- trunk/Source/WebCore/loader/EmptyClients.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -146,7 +146,7 @@
 #endif
 
 #if ENABLE(APP_HIGHLIGHTS)
-    void storeAppHighlight(const AppHighlight&) const final;
+    void storeAppHighlight(AppHighlight&&) const final;
 #endif
 
     void runOpenPanel(Frame&, FileChooser&) final;

Modified: trunk/Source/WebCore/page/Chrome.cpp (273825 => 273826)


--- trunk/Source/WebCore/page/Chrome.cpp	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/page/Chrome.cpp	2021-03-03 18:54:58 UTC (rev 273826)
@@ -513,9 +513,9 @@
 }
 
 #if ENABLE(APP_HIGHLIGHTS)
-void Chrome::storeAppHighlight(const AppHighlight& highlight) const
+void Chrome::storeAppHighlight(AppHighlight&& highlight) const
 {
-    m_client.storeAppHighlight(highlight);
+    m_client.storeAppHighlight(WTFMove(highlight));
 }
 #endif
 

Modified: trunk/Source/WebCore/page/Chrome.h (273825 => 273826)


--- trunk/Source/WebCore/page/Chrome.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/page/Chrome.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -166,7 +166,7 @@
 #endif
 
 #if ENABLE(APP_HIGHLIGHTS)
-    void storeAppHighlight(const AppHighlight&) const;
+    void storeAppHighlight(AppHighlight&&) const;
 #endif
 
     void runOpenPanel(Frame&, FileChooser&);

Modified: trunk/Source/WebCore/page/ChromeClient.h (273825 => 273826)


--- trunk/Source/WebCore/page/ChromeClient.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebCore/page/ChromeClient.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -305,7 +305,7 @@
 #endif
 
 #if ENABLE(APP_HIGHLIGHTS)
-    virtual void storeAppHighlight(const WebCore::AppHighlight&) const = 0;
+    virtual void storeAppHighlight(WebCore::AppHighlight&&) const = 0;
 #endif
 
     virtual void runOpenPanel(Frame&, FileChooser&) = 0;

Modified: trunk/Source/WebKit/ChangeLog (273825 => 273826)


--- trunk/Source/WebKit/ChangeLog	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/ChangeLog	2021-03-03 18:54:58 UTC (rev 273826)
@@ -1,3 +1,34 @@
+2021-03-03  Megan Gardner  <megan_gard...@apple.com>
+
+        Preserve information about the origin of the app highlight request
+        https://bugs.webkit.org/show_bug.cgi?id=222223
+
+        Reviewed by Wenson Hsieh.
+
+        * Scripts/webkit/messages.py:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _storeAppHighlight:]):
+        (-[WKWebView _addAppHighlight]):
+        * UIProcess/API/Cocoa/_WKAppHighlightDelegate.h:
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::createAppHighlightInSelectedRange):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::contextMenuItemSelected):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView createHighlightInCurrentGroupWithRange:]):
+        (-[WKContentView createHighlightInNewGroupWithRange:]):
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::storeAppHighlight const):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createAppHighlightInSelectedRange):
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::highlightIsNewGroup const):
+        (WebKit::WebPage::highlightRequestOriginatedInApp const):
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2021-03-03  Kate Cheney  <katherine_che...@apple.com>
 
         Report the correct document uri in the case of a ContentSecurityPolicyClient

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (273825 => 273826)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2021-03-03 18:54:58 UTC (rev 273826)
@@ -686,6 +686,7 @@
         'WebCore::GenericCueData': ['<WebCore/InbandGenericCue.h>'],
         'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'],
         'WebCore::HasInsecureContent': ['<WebCore/FrameLoaderTypes.h>'],
+        'WebCore::HighlightRequestOriginatedInApp': ['<WebCore/AppHighlight.h>'],
         'WebCore::IncludeSecureCookies': ['<WebCore/CookieJar.h>'],
         'WebCore::IndexedDB::ObjectStoreOverwriteMode': ['<WebCore/IndexedDB.h>'],
         'WebCore::InputMode': ['<WebCore/InputMode.h>'],

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (273825 => 273826)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-03-03 18:54:58 UTC (rev 273826)
@@ -1441,7 +1441,7 @@
     if (!delegate)
         return;
 
-    if (![delegate respondsToSelector:@selector(_webView:storeAppHighlight:inNewGroup:)])
+    if (![delegate respondsToSelector:@selector(_webView:storeAppHighlight:inNewGroup:requestOriginatedInApp:)])
         return;
 
     NSString *text = nil;
@@ -1451,7 +1451,7 @@
 
     auto wkHighlight = adoptNS([[_WKAppHighlight alloc] initWithHighlight:highlight.highlight->createNSData().get() text:text image:nil]);
 
-    [delegate _webView:self storeAppHighlight:wkHighlight.get() inNewGroup:highlight.isNewGroup == WebCore::CreateNewGroupForHighlight::Yes ? YES : NO];
+    [delegate _webView:self storeAppHighlight:wkHighlight.get() inNewGroup:highlight.isNewGroup == WebCore::CreateNewGroupForHighlight::Yes requestOriginatedInApp:highlight.requestOriginatedInApp == WebCore::HighlightRequestOriginatedInApp::Yes];
 }
 #endif
 
@@ -2091,7 +2091,7 @@
 - (void)_addAppHighlight
 {
 #if ENABLE(APP_HIGHLIGHTS)
-    _page->createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight::No);
+    _page->createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight::No, WebCore::HighlightRequestOriginatedInApp::Yes);
 #endif
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightDelegate.h (273825 => 273826)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightDelegate.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightDelegate.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -31,9 +31,7 @@
 
 @optional
 
-- (void)_webView:(WKWebView *)webView updateAppHighlightsStorage:(NSData *)data WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView storeAppHighlight:(_WKAppHighlight *)highlight inNewGroup:(BOOL)inNewGroup requestOriginatedInApp:(BOOL)requestOriginatedInApp WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
-- (void)_webView:(WKWebView *)webView storeAppHighlight:(_WKAppHighlight *)highlight inNewGroup:(BOOL)inNewGroup WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
-
 @end
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (273825 => 273826)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2021-03-03 18:54:58 UTC (rev 273826)
@@ -547,12 +547,12 @@
 }
 
 #if ENABLE(APP_HIGHLIGHTS)
-void WebPageProxy::createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight createNewGroup)
+void WebPageProxy::createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight createNewGroup, WebCore::HighlightRequestOriginatedInApp requestOriginatedInApp)
 {
     if (!hasRunningProcess())
         return;
 
-    send(Messages::WebPage::CreateAppHighlightInSelectedRange(createNewGroup));
+    send(Messages::WebPage::CreateAppHighlightInSelectedRange(createNewGroup, requestOriginatedInApp));
 }
 
 void WebPageProxy::restoreAppHighlights(const Vector<Ref<SharedMemory>>& highlights)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (273825 => 273826)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-03-03 18:54:58 UTC (rev 273826)
@@ -6701,11 +6701,11 @@
 
 #if ENABLE(APP_HIGHLIGHTS)
     case ContextMenuItemTagAddHighlightToNewGroup:
-        createAppHighlightInSelectedRange(CreateNewGroupForHighlight::Yes);
+        createAppHighlightInSelectedRange(CreateNewGroupForHighlight::Yes, HighlightRequestOriginatedInApp::No);
         return;
 
     case ContextMenuItemTagAddHighlightToCurrentGroup:
-        createAppHighlightInSelectedRange(CreateNewGroupForHighlight::No);
+        createAppHighlightInSelectedRange(CreateNewGroupForHighlight::No, HighlightRequestOriginatedInApp::No);
         return;
 #endif
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (273825 => 273826)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -245,6 +245,7 @@
 enum class EventMakesGamepadsVisible : bool;
 enum class LockBackForwardList : bool;
 enum class HasInsecureContent : bool;
+enum class HighlightRequestOriginatedInApp : bool;
 enum class MouseEventPolicy : uint8_t;
 enum class NotificationDirection : uint8_t;
 enum class RouteSharingPolicy : uint8_t;
@@ -1845,7 +1846,7 @@
     void syncIfMockDevicesEnabledChanged();
 
 #if ENABLE(APP_HIGHLIGHTS)
-    void createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight);
+    void createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight, WebCore::HighlightRequestOriginatedInApp);
     void storeAppHighlight(const WebCore::AppHighlight&);
     void restoreAppHighlights(const Vector<Ref<WebKit::SharedMemory>>& highlights);
 #endif

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (273825 => 273826)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-03-03 18:54:58 UTC (rev 273826)
@@ -9030,12 +9030,12 @@
 
 - (void)createHighlightInCurrentGroupWithRange:(id)sender
 {
-    _page->createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight::No);
+    _page->createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight::No, WebCore::HighlightRequestOriginatedInApp::No);
 }
 
 - (void)createHighlightInNewGroupWithRange:(id)sender
 {
-    _page->createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight::Yes);
+    _page->createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight::Yes, WebCore::HighlightRequestOriginatedInApp::No);
 }
 
 #endif

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (273825 => 273826)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-03-03 18:54:58 UTC (rev 273826)
@@ -937,7 +937,6 @@
 		41FABD2A1F4DE001006A6C97 /* CacheStorageEngineCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FABD281F4DDFDC006A6C97 /* CacheStorageEngineCache.h */; };
 		41FAF5F51E3C0649001AE678 /* WebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F41E3C0641001AE678 /* WebRTCResolver.h */; };
 		41FAF5F81E3C1021001AE678 /* LibWebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F61E3C0B47001AE678 /* LibWebRTCResolver.h */; };
-		4430D0172576D9DD0046D401 /* CreateNewGroupForHighlight.h in Headers */ = {isa = PBXBuildFile; fileRef = 4430D0162576D9DC0046D401 /* CreateNewGroupForHighlight.h */; };
 		4459984222833E8700E61373 /* SyntheticEditingCommandType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4459984122833E6000E61373 /* SyntheticEditingCommandType.h */; };
 		446DC64C24A2D8E50061F390 /* PlaybackSessionContextIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 446DC64B24A2D8AD0061F390 /* PlaybackSessionContextIdentifier.h */; };
 		4476EF0925BFC8B7004A0587 /* _WKAppHighlightDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4476EF0825BFC8B7004A0587 /* _WKAppHighlightDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3806,7 +3805,6 @@
 		41FCD6BD23CE043F00C62567 /* RemoteSampleBufferDisplayLayerManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RemoteSampleBufferDisplayLayerManager.messages.in; sourceTree = "<group>"; };
 		41FCD6BE23CE044000C62567 /* RemoteSampleBufferDisplayLayerManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteSampleBufferDisplayLayerManager.cpp; sourceTree = "<group>"; };
 		41FCD6BF23CE044000C62567 /* RemoteSampleBufferDisplayLayerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteSampleBufferDisplayLayerManager.h; sourceTree = "<group>"; };
-		4430D0162576D9DC0046D401 /* CreateNewGroupForHighlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CreateNewGroupForHighlight.h; sourceTree = "<group>"; };
 		4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedMemoryCocoa.cpp; sourceTree = "<group>"; };
 		4459984122833E6000E61373 /* SyntheticEditingCommandType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SyntheticEditingCommandType.h; sourceTree = "<group>"; };
 		446DC64B24A2D8AD0061F390 /* PlaybackSessionContextIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaybackSessionContextIdentifier.h; sourceTree = "<group>"; };
@@ -6591,7 +6589,6 @@
 				5106D7BF18BDBE73000AB166 /* ContextMenuContextData.cpp */,
 				5106D7C018BDBE73000AB166 /* ContextMenuContextData.h */,
 				99F642D21FABE378009621E9 /* CoordinateSystem.h */,
-				4430D0162576D9DC0046D401 /* CreateNewGroupForHighlight.h */,
 				99036AE823A970870000B06A /* DebuggableInfoData.cpp */,
 				99036AE723A970870000B06A /* DebuggableInfoData.h */,
 				0F189CAB24749F2F00E58D81 /* DisplayLinkObserverID.h */,
@@ -11721,7 +11718,6 @@
 				A15799BC2584433200528236 /* CoreMediaWrapped.h in Headers */,
 				37C21CAE1E994C0C0029D5F9 /* CorePredictionSPI.h in Headers */,
 				B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
-				4430D0172576D9DD0046D401 /* CreateNewGroupForHighlight.h in Headers */,
 				57597EBD218184900037F924 /* CtapAuthenticator.h in Headers */,
 				57597EB921811D9A0037F924 /* CtapHidDriver.h in Headers */,
 				570DAACA230385FD00E8FC04 /* CtapNfcDriver.h in Headers */,

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (273825 => 273826)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-03-03 18:54:58 UTC (rev 273826)
@@ -1254,8 +1254,10 @@
 #endif
 
 #if ENABLE(APP_HIGHLIGHTS)
-void WebChromeClient::storeAppHighlight(const WebCore::AppHighlight& highlight) const
+void WebChromeClient::storeAppHighlight(WebCore::AppHighlight&& highlight) const
 {
+    highlight.isNewGroup = m_page.highlightIsNewGroup();
+    highlight.requestOriginatedInApp = m_page.highlightRequestOriginatedInApp();
     m_page.send(Messages::WebPageProxy::StoreAppHighlight(highlight));
 }
 #endif

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (273825 => 273826)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -347,7 +347,7 @@
     void handleAutoplayEvent(WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final;
 
 #if ENABLE(APP_HIGHLIGHTS)
-    void storeAppHighlight(const WebCore::AppHighlight&) const final;
+    void storeAppHighlight(WebCore::AppHighlight&&) const final;
 #endif
 
 #if ENABLE(WEB_CRYPTO)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (273825 => 273826)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-03-03 18:54:58 UTC (rev 273826)
@@ -147,6 +147,7 @@
 #include <_javascript_Core/JSLock.h>
 #include <_javascript_Core/ProfilerDatabase.h>
 #include <_javascript_Core/SamplingProfiler.h>
+#include <WebCore/AppHighlight.h>
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/ArchiveResource.h>
 #include <WebCore/BackForwardCache.h>
@@ -7335,8 +7336,11 @@
 }
 
 #if ENABLE(APP_HIGHLIGHTS)
-bool WebPage::createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight createNewGroup)
+bool WebPage::createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight createNewGroup, WebCore::HighlightRequestOriginatedInApp requestOriginatedInApp)
 {
+    SetForScope<WebCore::CreateNewGroupForHighlight> highlightIsNewGroupScope { m_highlightIsNewGroup, createNewGroup };
+    SetForScope<WebCore::HighlightRequestOriginatedInApp> highlightRequestOriginScope { m_highlightRequestOriginatedInApp, requestOriginatedInApp };
+
     auto document = makeRefPtr(m_page->focusController().focusedOrMainFrame().document());
 
     auto frame = makeRefPtr(document->frame());
@@ -7348,7 +7352,7 @@
         return false;
 
     document->appHighlightRegister().addAppHighlight(StaticRange::create(selectionRange.value()));
-    document->appHighlightStorage().storeAppHighlight(StaticRange::create(selectionRange.value()), createNewGroup);
+    document->appHighlightStorage().storeAppHighlight(StaticRange::create(selectionRange.value()));
 
     return true;
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (273825 => 273826)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -64,6 +64,7 @@
 #include "WebsitePoliciesData.h"
 #include <_javascript_Core/InspectorFrontendChannel.h>
 #include <WebCore/ActivityState.h>
+#include <WebCore/AppHighlight.h>
 #include <WebCore/DictionaryPopupInfo.h>
 #include <WebCore/DisabledAdaptations.h>
 #include <WebCore/DragActions.h>
@@ -208,6 +209,7 @@
 enum class DragApplicationFlags : uint8_t;
 enum class DragHandlingMethod : uint8_t;
 enum class EventMakesGamepadsVisible : bool;
+enum class HighlightRequestOriginatedInApp : bool;
 enum class SelectionDirection : uint8_t;
 enum class ShouldTreatAsContinuingLoad : bool;
 enum class TextIndicatorPresentationTransition : uint8_t;
@@ -1397,7 +1399,10 @@
 #endif
 
 #if ENABLE(APP_HIGHLIGHTS)
-    bool createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight);
+    WebCore::CreateNewGroupForHighlight highlightIsNewGroup() const { return m_highlightIsNewGroup; }
+    WebCore::HighlightRequestOriginatedInApp highlightRequestOriginatedInApp() const { return m_highlightRequestOriginatedInApp; }
+
+    bool createAppHighlightInSelectedRange(WebCore::CreateNewGroupForHighlight, WebCore::HighlightRequestOriginatedInApp);
     void restoreAppHighlights(const Vector<SharedMemory::IPCHandle>&&);
 #endif
 
@@ -1892,6 +1897,11 @@
     // The layer hosting mode.
     LayerHostingMode m_layerHostingMode;
 
+#if ENABLE(APP_HIGHLIGHTS)
+    WebCore::CreateNewGroupForHighlight m_highlightIsNewGroup { WebCore::CreateNewGroupForHighlight::No };
+    WebCore::HighlightRequestOriginatedInApp m_highlightRequestOriginatedInApp { WebCore::HighlightRequestOriginatedInApp::No };
+#endif
+
 #if PLATFORM(COCOA)
     bool m_pdfPluginEnabled { false };
     bool m_hasCachedWindowFrame { false };

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (273825 => 273826)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-03-03 18:54:58 UTC (rev 273826)
@@ -626,7 +626,7 @@
     SetCanUseCredentialStorage(bool canUse)
 
 #if ENABLE(APP_HIGHLIGHTS)
-    CreateAppHighlightInSelectedRange(enum:bool WebCore::CreateNewGroupForHighlight createNewGroup)
+    CreateAppHighlightInSelectedRange(enum:bool WebCore::CreateNewGroupForHighlight createNewGroup, enum:bool WebCore::HighlightRequestOriginatedInApp requestOrigin)
     RestoreAppHighlights(Vector<WebKit::SharedMemory::IPCHandle> memoryHandles)
 #endif
 

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (273825 => 273826)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-03-03 18:54:58 UTC (rev 273826)
@@ -1,3 +1,14 @@
+2021-03-03  Megan Gardner  <megan_gard...@apple.com>
+
+        Preserve information about the origin of the app highlight request
+        https://bugs.webkit.org/show_bug.cgi?id=222223
+
+        Reviewed by Wenson Hsieh.
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::storeAppHighlight const):
+
 2021-03-01  Peng Liu  <peng.l...@apple.com>
 
         Rename the delegate property of WebAVPlayerView to webDelegate to fix a build failure with new SDKs

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (273825 => 273826)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-03-03 18:54:58 UTC (rev 273826)
@@ -152,7 +152,7 @@
 #endif
 
 #if ENABLE(APP_HIGHLIGHTS)
-    void storeAppHighlight(const WebCore::AppHighlight&) const final;
+    void storeAppHighlight(WebCore::AppHighlight&&) const final;
 #endif
 
 #if ENABLE(POINTER_LOCK)

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (273825 => 273826)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2021-03-03 18:47:07 UTC (rev 273825)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2021-03-03 18:54:58 UTC (rev 273826)
@@ -715,7 +715,7 @@
 #endif
 
 #if ENABLE(APP_HIGHLIGHTS)
-void WebChromeClient::storeAppHighlight(const WebCore::AppHighlight&) const
+void WebChromeClient::storeAppHighlight(WebCore::AppHighlight&&) const
 {
 }
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to