Title: [272042] trunk/Source
Revision
272042
Author
megan_gard...@apple.com
Date
2021-01-28 18:21:37 -0800 (Thu, 28 Jan 2021)

Log Message

Add plumbing to allow AppHighlights to be stored.
https://bugs.webkit.org/show_bug.cgi?id=221020

Reviewed by Devin Rousso.

Source/WebCore:

* Modules/highlight/AppHighlightListData.cpp:
(WebCore::AppHighlightListData::toSharedBuffer const):
(WebCore::AppHighlightListData::toData const): Deleted.
* Modules/highlight/AppHighlightListData.h:
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::createAndSendAppHighlightsStorage):
(WebCore::AppHighlightStorage::createAppHighlightListData): Deleted.
* dom/Document.cpp:
* dom/Document.h:
* page/Chrome.cpp:
(WebCore::Chrome::didCreateHighlightsStorageData const):
* page/Chrome.h:
* page/ChromeClient.h:

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCreateHighlightsStorageData:]):
(-[WKWebView _appHighlightsStorageDelegate]):
(-[WKWebView _setAppHighlightsStorageDelegate:]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::didCreateHighlightsStorageData):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCreateHighlightsStorageData):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didCreateHighlightsStorageData):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createAppHighlightInSelectedRange):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272041 => 272042)


--- trunk/Source/WebCore/ChangeLog	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/ChangeLog	2021-01-29 02:21:37 UTC (rev 272042)
@@ -1,3 +1,24 @@
+2021-01-28  Megan Gardner  <megan_gard...@apple.com>
+
+        Add plumbing to allow AppHighlights to be stored.
+        https://bugs.webkit.org/show_bug.cgi?id=221020
+
+        Reviewed by Devin Rousso.
+
+        * Modules/highlight/AppHighlightListData.cpp:
+        (WebCore::AppHighlightListData::toSharedBuffer const):
+        (WebCore::AppHighlightListData::toData const): Deleted.
+        * Modules/highlight/AppHighlightListData.h:
+        * Modules/highlight/AppHighlightStorage.cpp:
+        (WebCore::AppHighlightStorage::createAndSendAppHighlightsStorage):
+        (WebCore::AppHighlightStorage::createAppHighlightListData): Deleted.
+        * dom/Document.cpp:
+        * dom/Document.h:
+        * page/Chrome.cpp:
+        (WebCore::Chrome::didCreateHighlightsStorageData const):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+
 2021-01-28  Peng Liu  <peng.l...@apple.com>
 
         [GPUP][MSE] A video element does not fire “canplaythrough” event if SourceBuffer.abort() is called

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlightListData.cpp (272041 => 272042)


--- trunk/Source/WebCore/Modules/highlight/AppHighlightListData.cpp	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlightListData.cpp	2021-01-29 02:21:37 UTC (rev 272042)
@@ -49,7 +49,7 @@
     return data ? *data : AppHighlightListData {{ }};
 }
 
-Ref<SharedBuffer> AppHighlightListData::toData() const
+Ref<SharedBuffer> AppHighlightListData::toSharedBuffer() const
 {
     WTF::Persistence::Encoder encoder;
     encoder << *this;

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlightListData.h (272041 => 272042)


--- trunk/Source/WebCore/Modules/highlight/AppHighlightListData.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlightListData.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -129,7 +129,7 @@
     void setRanges(Vector<AppHighlightRangeData>&& ranges) { m_annotationRanges = WTFMove(ranges); }
     void addRanges(Vector<AppHighlightRangeData>&& ranges) { m_annotationRanges.appendVector(WTFMove(ranges)); }
 
-    WEBCORE_EXPORT Ref<SharedBuffer> toData() const;
+    Ref<SharedBuffer> toSharedBuffer() const;
 
     size_t size() const { return m_annotationRanges.size(); }
     bool isEmpty() const { return m_annotationRanges.isEmpty(); }

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp (272041 => 272042)


--- trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.cpp	2021-01-29 02:21:37 UTC (rev 272042)
@@ -28,6 +28,7 @@
 #include "AppHighlightStorage.h"
 
 #include "AppHighlightListData.h"
+#include "Chrome.h"
 #include "Document.h"
 #include "DocumentMarkerController.h"
 #include "HTMLBodyElement.h"
@@ -209,13 +210,16 @@
 {
 }
 
-AppHighlightListData AppHighlightStorage::createAppHighlightListData()
+void AppHighlightStorage::updateAppHighlightsStorage()
 {
     Vector<AppHighlightRangeData> data;
 
     if (!m_document)
-        return { WTFMove(data) };
+        return;
 
+    if (!m_document->page())
+        return;
+
     if (auto appHighlightRegister = m_document->appHighlightRegisterIfExists()) {
         for (auto& highlight : appHighlightRegister->map()) {
             for (auto& rangeData : highlight.value->rangesData())
@@ -222,8 +226,9 @@
                 data.append(createAppHighlightRangeData(rangeData->range));
         }
     }
+    AppHighlightListData listData { WTFMove(data) };
 
-    return { WTFMove(data) };
+    m_document->page()->chrome().updateAppHighlightsStorage(listData.toSharedBuffer());
 }
 
 Vector<AppHighlightRangeData> AppHighlightStorage::restoreAppHighlights(Ref<SharedBuffer>&& buffer)

Modified: trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.h (272041 => 272042)


--- trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -46,7 +46,7 @@
 public:
     AppHighlightStorage(Document&);
 
-    AppHighlightListData createAppHighlightListData();
+    WEBCORE_EXPORT void updateAppHighlightsStorage();
     Vector<AppHighlightRangeData> restoreAppHighlights(Ref<SharedBuffer>&&);
 
 private:

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (272041 => 272042)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-01-29 02:21:37 UTC (rev 272042)
@@ -1213,7 +1213,7 @@
 		43C092BC12D9E4EE00A989C3 /* RenderSVGForeignObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */; };
 		43EDD67F1B485DBF00640E75 /* CombinedFiltersAlphabet.h in Headers */ = {isa = PBXBuildFile; fileRef = 43EDD67D1B485DBF00640E75 /* CombinedFiltersAlphabet.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4415292E0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4415292C0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		4425070925829A2700C09368 /* AppHighlightStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4425070725829A1400C09368 /* AppHighlightStorage.h */; };
+		4425070925829A2700C09368 /* AppHighlightStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4425070725829A1400C09368 /* AppHighlightStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4430D00B2575A83E0046D401 /* Highlight.h in Headers */ = {isa = PBXBuildFile; fileRef = 44E88E51236A5C8D009B4847 /* Highlight.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4430D00D2575A8A50046D401 /* HighlightRegister.h in Headers */ = {isa = PBXBuildFile; fileRef = 44E88E50236A56AC009B4847 /* HighlightRegister.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		445775E520472F73008DCE5D /* LocalDefaultSystemAppearance.h in Headers */ = {isa = PBXBuildFile; fileRef = 445775E420472F73008DCE5D /* LocalDefaultSystemAppearance.h */; settings = {ATTRIBUTES = (Private, ); }; };

Modified: trunk/Source/WebCore/dom/Document.cpp (272041 => 272042)


--- trunk/Source/WebCore/dom/Document.cpp	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/dom/Document.cpp	2021-01-29 02:21:37 UTC (rev 272042)
@@ -264,7 +264,6 @@
 #include <wtf/text/TextStream.h>
 
 #if ENABLE(APP_HIGHLIGHTS)
-#include "AppHighlightListData.h"
 #include "AppHighlightStorage.h"
 #endif
 

Modified: trunk/Source/WebCore/dom/Document.h (272041 => 272042)


--- trunk/Source/WebCore/dom/Document.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/dom/Document.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -1581,7 +1581,7 @@
     HighlightRegister* appHighlightRegisterIfExists() { return m_appHighlightRegister.get(); }
     WEBCORE_EXPORT HighlightRegister& appHighlightRegister();
 
-    AppHighlightStorage& appHighlightStorage();
+    WEBCORE_EXPORT AppHighlightStorage& appHighlightStorage();
     AppHighlightStorage* appHighlightStorageIfExists() const { return m_appHighlightStorage.get(); };
 #endif
 

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (272041 => 272042)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2021-01-29 02:21:37 UTC (rev 272042)
@@ -501,6 +501,12 @@
 
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+void EmptyChromeClient::updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&&) const
+{
+}
+#endif
+
 void EmptyChromeClient::runOpenPanel(Frame&, FileChooser&)
 {
 }

Modified: trunk/Source/WebCore/loader/EmptyClients.h (272041 => 272042)


--- trunk/Source/WebCore/loader/EmptyClients.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -145,6 +145,10 @@
     std::unique_ptr<DateTimeChooser> createDateTimeChooser(DateTimeChooserClient&) final;
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+    void updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&&) const final;
+#endif
+
     void runOpenPanel(Frame&, FileChooser&) final;
     void showShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) final;
     void loadIconForFiles(const Vector<String>&, FileIconLoader&) final { }

Modified: trunk/Source/WebCore/page/Chrome.cpp (272041 => 272042)


--- trunk/Source/WebCore/page/Chrome.cpp	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/page/Chrome.cpp	2021-01-29 02:21:37 UTC (rev 272042)
@@ -511,6 +511,13 @@
     m_client.dispatchViewportPropertiesDidChange(arguments);
 }
 
+#if ENABLE(APP_HIGHLIGHTS)
+void Chrome::updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&& data) const
+{
+    m_client.updateAppHighlightsStorage(WTFMove(data));
+}
+#endif
+
 void Chrome::setCursor(const Cursor& cursor)
 {
     m_client.setCursor(cursor);

Modified: trunk/Source/WebCore/page/Chrome.h (272041 => 272042)


--- trunk/Source/WebCore/page/Chrome.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/page/Chrome.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -164,6 +164,10 @@
     std::unique_ptr<DateTimeChooser> createDateTimeChooser(DateTimeChooserClient&);
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+    void updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&&) const;
+#endif
+
     void runOpenPanel(Frame&, FileChooser&);
     void showShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&);
     void showContactPicker(const ContactsRequestData&, CompletionHandler<void(Optional<Vector<ContactInfo>>&&)>&&);

Modified: trunk/Source/WebCore/page/ChromeClient.h (272041 => 272042)


--- trunk/Source/WebCore/page/ChromeClient.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebCore/page/ChromeClient.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -303,6 +303,10 @@
     virtual std::unique_ptr<DateTimeChooser> createDateTimeChooser(DateTimeChooserClient&) = 0;
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+    virtual void updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&&) const = 0;
+#endif
+
     virtual void runOpenPanel(Frame&, FileChooser&) = 0;
     virtual void showShareSheet(ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback) { callback(false); }
     virtual void showContactPicker(const ContactsRequestData&, WTF::CompletionHandler<void(Optional<Vector<ContactInfo>>&&)>&& callback) { callback(WTF::nullopt); }

Modified: trunk/Source/WebKit/ChangeLog (272041 => 272042)


--- trunk/Source/WebKit/ChangeLog	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/ChangeLog	2021-01-29 02:21:37 UTC (rev 272042)
@@ -1,3 +1,30 @@
+2021-01-28  Megan Gardner  <megan_gard...@apple.com>
+
+        Add plumbing to allow AppHighlights to be stored.
+        https://bugs.webkit.org/show_bug.cgi?id=221020
+
+        Reviewed by Devin Rousso.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _didCreateHighlightsStorageData:]):
+        (-[WKWebView _appHighlightsStorageDelegate]):
+        (-[WKWebView _setAppHighlightsStorageDelegate:]):
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/Cocoa/PageClientImplCocoa.mm:
+        (WebKit::PageClientImplCocoa::didCreateHighlightsStorageData):
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didCreateHighlightsStorageData):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::didCreateHighlightsStorageData):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createAppHighlightInSelectedRange):
+
 2021-01-28  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebAuthn] Adopt new SPI to show no credentials error for the platform authenticator

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


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-01-29 02:21:37 UTC (rev 272042)
@@ -99,6 +99,7 @@
 #import "WebURLSchemeHandlerCocoa.h"
 #import "WebViewImpl.h"
 #import "_WKActivatedElementInfoInternal.h"
+#import "_WKAppHighlightDelegate.h"
 #import "_WKDiagnosticLoggingDelegate.h"
 #import "_WKFindDelegate.h"
 #import "_WKFrameHandleInternal.h"
@@ -1408,6 +1409,28 @@
 
 #endif // ENABLE(ATTACHMENT_ELEMENT)
 
+#if ENABLE(APP_HIGHLIGHTS)
+- (id <_WKAppHighlightDelegate>)_appHighlightsDelegate
+{
+    return _appHighlightsDelegate.getAutoreleased();
+}
+
+- (void)_setAppHighlightsDelegate:(id <_WKAppHighlightDelegate>)delegate
+{
+    _appHighlightsDelegate = delegate;
+}
+
+- (void)_updateAppHighlightsStorage:(NSData *)data
+{
+    auto delegate = self._appHighlightsDelegate;
+    if (!delegate)
+        return;
+
+    if ([delegate respondsToSelector:@selector(_webView:updateAppHighlightsStorage:)])
+        [delegate _webView:self updateAppHighlightsStorage:data];
+}
+#endif
+
 - (WKPageRef)_pageForTesting
 {
     return toAPI(_page.get());

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h (272041 => 272042)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -105,6 +105,7 @@
 
 @protocol _WKTextManipulationDelegate;
 @protocol _WKInputDelegate;
+@protocol _WKAppHighlightDelegate;
 
 @interface WKWebView () WK_WEB_VIEW_PROTOCOLS {
 
@@ -119,6 +120,7 @@
 
     WeakObjCPtr<id <_WKTextManipulationDelegate>> _textManipulationDelegate;
     WeakObjCPtr<id <_WKInputDelegate>> _inputDelegate;
+    WeakObjCPtr<id <_WKAppHighlightDelegate>> _appHighlightsDelegate;
 
     RetainPtr<WKSafeBrowsingWarning> _safeBrowsingWarning;
 
@@ -258,6 +260,10 @@
 - (void)_didInvalidateDataForAttachment:(API::Attachment&)attachment;
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+- (void)_updateAppHighlightsStorage:(NSData *)data;
+#endif
+
 - (void)_internalDoAfterNextPresentationUpdate:(void (^)(void))updateBlock withoutWaitingForPainting:(BOOL)withoutWaitingForPainting withoutWaitingForAnimatedResize:(BOOL)withoutWaitingForAnimatedResize;
 
 - (void)_showSafeBrowsingWarning:(const WebKit::SafeBrowsingWarning&)warning completionHandler:(CompletionHandler<void(Variant<WebKit::ContinueUnsafeLoad, URL>&&)>&&)completionHandler;

Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightDelegate.h (from rev 272041, trunk/Source/WebCore/Modules/highlight/AppHighlightStorage.h) (0 => 272042)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightDelegate.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightDelegate.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#import <Foundation/Foundation.h>
+
+@protocol _WKAppHighlightDelegate <NSObject>
+
+@optional
+
+- (void)_webView:(WKWebView *)webView updateAppHighlightsStorage:(NSData *)data;
+
+@end
+

Modified: trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h (272041 => 272042)


--- trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -71,6 +71,10 @@
     Vector<String> dictationAlternatives(WebCore::DictationContext) final;
     NSTextAlternatives *platformDictationAlternatives(WebCore::DictationContext) final;
 
+#if ENABLE(APP_HIGHLIGHTS)
+    void updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&& data) final;
+#endif
+
 protected:
     WeakObjCPtr<WKWebView> m_webView;
     std::unique_ptr<WebCore::AlternativeTextUIController> m_alternativeTextUIController;

Modified: trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm (272041 => 272042)


--- trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm	2021-01-29 02:21:37 UTC (rev 272042)
@@ -113,6 +113,14 @@
 
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+void PageClientImplCocoa::updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&& data)
+{
+    auto nsData = data->createNSData();
+    [m_webView _updateAppHighlightsStorage:nsData.get()];
+}
+#endif // ENABLE(APP_HIGHLIGHTS)
+
 void PageClientImplCocoa::pageClosed()
 {
     m_alternativeTextUIController->clear();

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (272041 => 272042)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -558,6 +558,10 @@
 #endif
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+    virtual void updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&& data) = 0;
+#endif
+
 #if PLATFORM(COCOA)
     virtual void cancelPointersForGestureRecognizer(UIGestureRecognizer*) { }
     virtual WTF::Optional<unsigned> activeTouchIdentifierForGestureRecognizer(UIGestureRecognizer*) { return WTF::nullopt; }

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (272041 => 272042)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-01-29 02:21:37 UTC (rev 272042)
@@ -9933,6 +9933,15 @@
 }
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+void WebPageProxy::updateAppHighlightsStorage(const IPC::SharedBufferCopy& data)
+{
+    MESSAGE_CHECK(m_process, data.buffer());
+
+    pageClient().updateAppHighlightsStorage(*data.buffer());
+}
+#endif
+
 namespace {
 enum class CompletionCondition {
     Cancellation,

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (272041 => 272042)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -1823,6 +1823,7 @@
 
 #if ENABLE(APP_HIGHLIGHTS)
     void createAppHighlightInSelectedRange(CreateNewGroupForHighlight);
+    void updateAppHighlightsStorage(const IPC::SharedBufferCopy&);
 #endif
 
 #if ENABLE(MEDIA_STREAM)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (272041 => 272042)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-01-29 02:21:37 UTC (rev 272042)
@@ -536,6 +536,10 @@
     WritePromisedAttachmentToPasteboard(struct WebCore::PromisedAttachmentInfo info)
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+    UpdateAppHighlightsStorage(IPC::SharedBufferCopy data)
+#endif
+
     SignedPublicKeyAndChallengeString(unsigned keySizeIndex, String challengeString, URL url) -> (String result) Synchronous
 
 #if ENABLE(SPEECH_SYNTHESIS)

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (272041 => 272042)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-01-29 02:21:37 UTC (rev 272042)
@@ -944,6 +944,7 @@
 		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, ); }; };
 		4482734724528F6000A95493 /* CocoaImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4482734624528F6000A95493 /* CocoaImage.h */; };
 		449D90DA21FDC30B00F677C0 /* LocalAuthenticationSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 449D90D821FD63FE00F677C0 /* LocalAuthenticationSoftLink.mm */; };
 		44E936FD2447C2D8009FA3E3 /* LegacyCustomProtocolID.h in Headers */ = {isa = PBXBuildFile; fileRef = 44E936FC2447C256009FA3E3 /* LegacyCustomProtocolID.h */; };
@@ -3776,6 +3777,7 @@
 		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>"; };
+		4476EF0825BFC8B7004A0587 /* _WKAppHighlightDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKAppHighlightDelegate.h; sourceTree = "<group>"; };
 		4482734624528F6000A95493 /* CocoaImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaImage.h; sourceTree = "<group>"; };
 		449D90D821FD63FE00F677C0 /* LocalAuthenticationSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalAuthenticationSoftLink.mm; sourceTree = "<group>"; };
 		44A481C621F2D27B00F2F919 /* ClientCertificateAuthenticationXPCConstants.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ClientCertificateAuthenticationXPCConstants.cpp; sourceTree = "<group>"; };
@@ -7672,6 +7674,7 @@
 				37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */,
 				37A5E01118BBF937000A081E /* _WKActivatedElementInfo.mm */,
 				379A873518BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h */,
+				4476EF0825BFC8B7004A0587 /* _WKAppHighlightDelegate.h */,
 				63108F941F96719C00A0DB84 /* _WKApplicationManifest.h */,
 				63108F951F96719C00A0DB84 /* _WKApplicationManifest.mm */,
 				63108F981F9671F700A0DB84 /* _WKApplicationManifestInternal.h */,
@@ -11282,6 +11285,7 @@
 			files = (
 				37A5E01418BBF93F000A081E /* _WKActivatedElementInfo.h in Headers */,
 				379A873618BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h in Headers */,
+				4476EF0925BFC8B7004A0587 /* _WKAppHighlightDelegate.h in Headers */,
 				63108F961F96719C00A0DB84 /* _WKApplicationManifest.h in Headers */,
 				63108F991F9671F700A0DB84 /* _WKApplicationManifestInternal.h in Headers */,
 				F44291921FA591C9002CC93E /* _WKAttachment.h in Headers */,

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (272041 => 272042)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-01-29 02:21:37 UTC (rev 272042)
@@ -40,6 +40,7 @@
 #include "NetworkProcessConnection.h"
 #include "PageBanner.h"
 #include "RemoteRenderingBackendProxy.h"
+#include "SharedBufferCopy.h"
 #include "UserData.h"
 #include "WebColorChooser.h"
 #include "WebCoreArgumentCoders.h"
@@ -1239,6 +1240,14 @@
 
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+void WebChromeClient::updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&& data) const
+{
+    auto buffer = IPC::SharedBufferCopy(data);
+    m_page.send(Messages::WebPageProxy::UpdateAppHighlightsStorage(buffer));
+}
+#endif
+
 String WebChromeClient::signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL& url) const
 {
     String result;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (272041 => 272042)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -346,6 +346,10 @@
     void isPlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags, uint64_t) final;
     void handleAutoplayEvent(WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final;
 
+#if ENABLE(APP_HIGHLIGHTS)
+    void updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&&) const final;
+#endif
+
 #if ENABLE(WEB_CRYPTO)
     bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const final;
     bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const final;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (272041 => 272042)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-01-29 02:21:37 UTC (rev 272042)
@@ -254,6 +254,10 @@
 #include <wtf/SetForScope.h>
 #include <wtf/text/TextStream.h>
 
+#if ENABLE(APP_HIGHLIGHTS)
+#include <WebCore/AppHighlightStorage.h>
+#endif
+
 #if ENABLE(DATA_DETECTION)
 #include "DataDetectionResult.h"
 #endif
@@ -7180,6 +7184,7 @@
         return false;
 
     document->appHighlightRegister().addAppHighlight(StaticRange::create(selectionRange.value()));
+    document->appHighlightStorage().updateAppHighlightsStorage();
 
     return true;
 }

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (272041 => 272042)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-01-29 02:21:37 UTC (rev 272042)
@@ -151,6 +151,10 @@
     std::unique_ptr<WebCore::DateTimeChooser> createDateTimeChooser(WebCore::DateTimeChooserClient&) final;
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+    void updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&&) const final;
+#endif
+
 #if ENABLE(POINTER_LOCK)
     bool requestPointerLock() final;
     void requestPointerUnlock() final;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (272041 => 272042)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2021-01-29 01:50:29 UTC (rev 272041)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2021-01-29 02:21:37 UTC (rev 272042)
@@ -744,6 +744,12 @@
 }
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
+void WebChromeClient::updateAppHighlightsStorage(Ref<WebCore::SharedBuffer>&&) const
+{
+}
+#endif
+
 #if ENABLE(POINTER_LOCK)
 bool WebChromeClient::requestPointerLock()
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to