WebKit Bugzilla
Attachment 358085 Details for
Bug 193034
: Add support for using the current text selection as the find string on iOS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix 32-bit macOS build
bug-193034-20181226135556.patch (text/plain), 44.85 KB, created by
Wenson Hsieh
on 2018-12-26 13:55:57 PST
(
hide
)
Description:
Fix 32-bit macOS build
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-12-26 13:55:57 PST
Size:
44.85 KB
patch
obsolete
>Subversion Revision: 239547 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8ecfee1d2c9f6197df758209640135c8423828f2..8415bff25f3ed22d95578ab0562b2ba01bc1740b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,40 @@ >+2018-12-26 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Add support for using the current text selection as the find string on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=193034 >+ <rdar://problem/45138739> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add support for "TakeFindStringFromSelection" on iOS. Unlike macOS, iOS does not have a notion of a "find >+ pasteboard" like macOS; instead, we handle this editing command by sending the selection string to the UI >+ process, where it is exposed via WebKit SPI so that clients that present find-in-page UI (i.e. MobileSafari) are >+ able to trigger find-in-page with this string. >+ >+ Test: WebKit.UseSelectionAsFindString >+ >+ * editing/Editor.cpp: >+ (WebCore::Editor::canCopyExcludingStandaloneImages const): >+ >+ Make this helper function cross-platform. >+ >+ * editing/Editor.h: >+ * editing/EditorCommand.cpp: >+ (WebCore::createCommandMap): >+ * editing/cocoa/EditorCocoa.mm: >+ (WebCore::Editor::takeFindStringFromSelection): >+ >+ Move this from EditorMac to EditorCocoa, and implement it on iOS by calling into the editor client to update the >+ find string (see WebKit/ChangeLog for more details). >+ >+ * editing/mac/EditorMac.mm: >+ (WebCore::Editor::canCopyExcludingStandaloneImages): Deleted. >+ (WebCore::Editor::takeFindStringFromSelection): Deleted. >+ * loader/EmptyClients.cpp: >+ * page/EditorClient.h: >+ >+ Add a new editor client method to send the string for find-in-page to the UI process. >+ > 2018-12-22 Carlos Garcia Campos <cgarcia@igalia.com> > > [HarfBuzz] Width not correctly reported as 0 for zero font size >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index effac72476161450c545a3d9a8c37982911091c1..8d436c885871287785e8b8b28c55aa02aee9ae85 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,56 @@ >+2018-12-26 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Add support for using the current text selection as the find string on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=193034 >+ <rdar://problem/45138739> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * SourcesCocoa.txt: >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView _takeFindStringFromSelection:]): >+ >+ Provides a way to set the find string on iOS and macOS (an aside: takeFindStringFromSelection: already exists on >+ macOS, but there is no equivalent protocol method on iOS, so this new SPI acts as a cross-platform way for >+ WebKit clients to take the find string from the selection across all Cocoa platforms). >+ >+ (+[WKWebView _stringForFindInPage]): >+ (+[WKWebView _clearStringForFindInPage]): >+ >+ Call into find-in-page helper functions. >+ >+ * UIProcess/API/Cocoa/WKWebViewPrivate.h: >+ >+ Add some new cross-platform find-in-page SPI. See above for more details. >+ >+ * UIProcess/Cocoa/FindInPageHelpers.h: Added. >+ * UIProcess/Cocoa/FindInPageHelpers.mm: Added. >+ (WebKit::findPasteboard): >+ (WebKit::globalStringForFindInPage): >+ >+ Fetch the string to use when finding text in the page. On macOS, this accesses the AppKit find pasteboard; on >+ iOS, this instead returns the current global find string. >+ >+ (WebKit::updateStringForFindInPage): >+ >+ Sets the global find string. Uses the find pasteboard on macOS, and sets the global find string on iOS. >+ >+ (WebKit::stringForFindInPage): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ >+ Add plumbing to allow WebEditorClient to deliver the update the global find string in the UI process. >+ >+ * UIProcess/ios/WebPageProxyIOS.mm: >+ (WebKit::WebPageProxy::updateStringForFindInPage): >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/WebCoreSupport/WebEditorClient.h: >+ * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: >+ (WebKit::WebEditorClient::updateStringForFindInPage): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::updateStringForFindInPage): >+ > 2018-12-23 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] Remove some unnecessary editing SPI after <rdar://problem/46047546> >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 441bb0930ed9d9b6f60860a73543105936f85eee..e23ba084fbd0d19f56a49d6b7db72415b830fff7 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,15 @@ >+2018-12-26 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Add support for using the current text selection as the find string on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=193034 >+ <rdar://problem/45138739> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a method stub for WebKitLegacy. >+ >+ * WebCoreSupport/WebEditorClient.h: >+ > 2018-12-20 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > Use Ref<> as much as possible >diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp >index a5e8584f4ae8772314f63f3417bc0cd6e46176fd..8d17137bfd5476bceb4e9bd72e370fa4f538160d 100644 >--- a/Source/WebCore/editing/Editor.cpp >+++ b/Source/WebCore/editing/Editor.cpp >@@ -4256,4 +4256,10 @@ RefPtr<HTMLImageElement> Editor::insertEditableImage() > return InsertEditableImageCommand::insertEditableImage(document()); > } > >+bool Editor::canCopyExcludingStandaloneImages() const >+{ >+ auto& selection = m_frame.selection().selection(); >+ return selection.isRange() && !selection.isInPasswordField(); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/editing/Editor.h b/Source/WebCore/editing/Editor.h >index 7cad22098526006f9cc89c1ce0e279422ec7385f..05cc1b82aeac140b40930df6f37ea54955c63f46 100644 >--- a/Source/WebCore/editing/Editor.h >+++ b/Source/WebCore/editing/Editor.h >@@ -485,9 +485,8 @@ public: > #if PLATFORM(COCOA) > WEBCORE_EXPORT String stringSelectionForPasteboard(); > String stringSelectionForPasteboardWithImageAltText(); >-#if !PLATFORM(IOS_FAMILY) >- bool canCopyExcludingStandaloneImages(); > void takeFindStringFromSelection(); >+#if !PLATFORM(IOS_FAMILY) > WEBCORE_EXPORT void readSelectionFromPasteboard(const String& pasteboardName); > WEBCORE_EXPORT void replaceNodeFromPasteboard(Node*, const String& pasteboardName); > WEBCORE_EXPORT RefPtr<SharedBuffer> dataSelectionForPasteboard(const String& pasteboardName); >@@ -495,6 +494,8 @@ public: > WEBCORE_EXPORT void replaceSelectionWithAttributedString(NSAttributedString *, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote); > #endif > >+ bool canCopyExcludingStandaloneImages() const; >+ > String clientReplacementURLForResource(Ref<SharedBuffer>&& resourceData, const String& mimeType); > > #if !PLATFORM(WIN) >diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp >index 9fdac1d6119538ace3d4bf8c0ee3179f47c8bd31..0b3bbb9be69569eb82cf054dc24c715e7e4ad438 100644 >--- a/Source/WebCore/editing/EditorCommand.cpp >+++ b/Source/WebCore/editing/EditorCommand.cpp >@@ -1102,13 +1102,15 @@ static bool executeSwapWithMark(Frame& frame, Event*, EditorCommandSource, const > return true; > } > >-#if PLATFORM(MAC) >+#if PLATFORM(COCOA) >+ > static bool executeTakeFindStringFromSelection(Frame& frame, Event*, EditorCommandSource, const String&) > { > frame.editor().takeFindStringFromSelection(); > return true; > } >-#endif >+ >+#endif // PLATFORM(COCOA) > > static bool executeToggleBold(Frame& frame, Event*, EditorCommandSource source, const String&) > { >@@ -1367,12 +1369,14 @@ static bool enabledRedo(Frame& frame, Event*, EditorCommandSource) > return frame.editor().canRedo(); > } > >-#if PLATFORM(MAC) >+#if PLATFORM(COCOA) >+ > static bool enabledTakeFindStringFromSelection(Frame& frame, Event*, EditorCommandSource) > { > return frame.editor().canCopyExcludingStandaloneImages(); > } >-#endif >+ >+#endif // PLATFORM(COCOA) > > static bool enabledUndo(Frame& frame, Event*, EditorCommandSource) > { >@@ -1718,7 +1722,7 @@ static const CommandMap& createCommandMap() > { "PasteGlobalSelection", { executePasteGlobalSelection, supportedFromMenuOrKeyBinding, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, > #endif > >-#if PLATFORM(MAC) >+#if PLATFORM(COCOA) > { "TakeFindStringFromSelection", { executeTakeFindStringFromSelection, supportedFromMenuOrKeyBinding, enabledTakeFindStringFromSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, > #endif > }; >diff --git a/Source/WebCore/editing/cocoa/EditorCocoa.mm b/Source/WebCore/editing/cocoa/EditorCocoa.mm >index 5de716fa1ac4a9b69c85f0966ba293bfabb26bfc..9069d78bf599e2d8bb5a2b18b3278ea01777d19e 100644 >--- a/Source/WebCore/editing/cocoa/EditorCocoa.mm >+++ b/Source/WebCore/editing/cocoa/EditorCocoa.mm >@@ -45,8 +45,11 @@ > #import "HTMLConverter.h" > #import "HTMLImageElement.h" > #import "HTMLSpanElement.h" >+#import "LegacyNSPasteboardTypes.h" > #import "LegacyWebArchive.h" > #import "Pasteboard.h" >+#import "PasteboardStrategy.h" >+#import "PlatformStrategies.h" > #import "RenderElement.h" > #import "RenderStyle.h" > #import "Settings.h" >@@ -55,6 +58,7 @@ > #import "markup.h" > #import <pal/spi/cocoa/NSAttributedStringSPI.h> > #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> >+#import <pal/system/Sound.h> > #import <wtf/BlockObjCExceptions.h> > #import <wtf/cocoa/NSURLExtras.h> > >@@ -223,4 +227,28 @@ RefPtr<DocumentFragment> Editor::webContentFromPasteboard(Pasteboard& pasteboard > return WTFMove(reader.fragment); > } > >+void Editor::takeFindStringFromSelection() >+{ >+ if (!canCopyExcludingStandaloneImages()) { >+ PAL::systemBeep(); >+ return; >+ } >+ >+ auto stringFromSelection = m_frame.displayStringModifiedByEncoding(selectedTextForDataTransfer()); >+#if PLATFORM(MAC) >+ Vector<String> types; >+ types.append(String(legacyStringPasteboardType())); >+ ALLOW_DEPRECATED_DECLARATIONS_BEGIN >+ platformStrategies()->pasteboardStrategy()->setTypes(types, NSFindPboard); >+ platformStrategies()->pasteboardStrategy()->setStringForType(WTFMove(stringFromSelection), legacyStringPasteboardType(), NSFindPboard); >+ ALLOW_DEPRECATED_DECLARATIONS_END >+#else >+ if (auto* client = this->client()) { >+ // Since the find pasteboard doesn't exist on iOS, WebKit maintains its own notion of the latest find string, >+ // which SPI clients may respect when presenting find-in-page UI. >+ client->updateStringForFindInPage(stringFromSelection); >+ } >+#endif >+} >+ > } >diff --git a/Source/WebCore/editing/mac/EditorMac.mm b/Source/WebCore/editing/mac/EditorMac.mm >index 3fe6f4e7e452125b51fa1fc7d48061c2c46bb77d..6971f0097438beb4493cf210d255d071d2608b0d 100644 >--- a/Source/WebCore/editing/mac/EditorMac.mm >+++ b/Source/WebCore/editing/mac/EditorMac.mm >@@ -55,7 +55,6 @@ > #import "WebNSAttributedStringExtras.h" > #import "markup.h" > #import <AppKit/AppKit.h> >-#import <pal/system/Sound.h> > #import <wtf/cocoa/NSURLExtras.h> > > namespace WebCore { >@@ -98,27 +97,6 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, OptionSet<PasteOption> > client()->setInsertionPasteboard(String()); > } > >-bool Editor::canCopyExcludingStandaloneImages() >-{ >- const VisibleSelection& selection = m_frame.selection().selection(); >- return selection.isRange() && !selection.isInPasswordField(); >-} >- >-void Editor::takeFindStringFromSelection() >-{ >- if (!canCopyExcludingStandaloneImages()) { >- PAL::systemBeep(); >- return; >- } >- >- Vector<String> types; >- types.append(String(legacyStringPasteboardType())); >- ALLOW_DEPRECATED_DECLARATIONS_BEGIN >- platformStrategies()->pasteboardStrategy()->setTypes(types, NSFindPboard); >- platformStrategies()->pasteboardStrategy()->setStringForType(m_frame.displayStringModifiedByEncoding(selectedTextForDataTransfer()), legacyStringPasteboardType(), NSFindPboard); >- ALLOW_DEPRECATED_DECLARATIONS_END >-} >- > void Editor::readSelectionFromPasteboard(const String& pasteboardName) > { > Pasteboard pasteboard(pasteboardName); >diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp >index a28ec68cd39d44514ce7266a8378bf133b6cabf2..ff69fcc195ff19f889b5cb35c2f8c7136d0082bb 100644 >--- a/Source/WebCore/loader/EmptyClients.cpp >+++ b/Source/WebCore/loader/EmptyClients.cpp >@@ -215,6 +215,7 @@ private: > int getPasteboardItemsCount() final { return 0; } > RefPtr<DocumentFragment> documentFragmentFromDelegate(int) final { return nullptr; } > bool performsTwoStepPaste(DocumentFragment*) final { return false; } >+ void updateStringForFindInPage(const String&) final { } > #endif > > bool performTwoStepDrop(DocumentFragment&, Range&, bool) final { return false; } >diff --git a/Source/WebCore/page/EditorClient.h b/Source/WebCore/page/EditorClient.h >index a65d80cea0f27daf4bfd28a5ad08ea0a64c4648b..48ed7ce4683e98143e55afd0a071c82ef24e8dc4 100644 >--- a/Source/WebCore/page/EditorClient.h >+++ b/Source/WebCore/page/EditorClient.h >@@ -134,6 +134,7 @@ public: > virtual int getPasteboardItemsCount() = 0; > virtual RefPtr<DocumentFragment> documentFragmentFromDelegate(int index) = 0; > virtual bool performsTwoStepPaste(DocumentFragment*) = 0; >+ virtual void updateStringForFindInPage(const String&) = 0; > #endif > > #if PLATFORM(COCOA) >diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt >index 9d7cc5cc6c4e71c4bc63cd1fbf3424df47a3fc4c..ad493cdc3bbc8468e76543e7e11b19fc9a68e624 100644 >--- a/Source/WebKit/SourcesCocoa.txt >+++ b/Source/WebKit/SourcesCocoa.txt >@@ -316,6 +316,7 @@ UIProcess/Cocoa/AutomationSessionClient.mm > UIProcess/Cocoa/DiagnosticLoggingClient.mm > UIProcess/Cocoa/DownloadClient.mm > UIProcess/Cocoa/FindClient.mm >+UIProcess/Cocoa/FindInPageHelpers.mm > UIProcess/Cocoa/FullscreenClient.mm > UIProcess/Cocoa/IconLoadingDelegate.mm > UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index 6d893965eb345cb6813dfe7f0c64c4d321b6da6b..99d939864c95aae652b704eabb167da2ce4a8aec 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -35,6 +35,7 @@ > #import "DiagnosticLoggingClient.h" > #import "DynamicViewportSizeUpdate.h" > #import "FindClient.h" >+#import "FindInPageHelpers.h" > #import "FrontBoardServicesSPI.h" > #import "FullscreenClient.h" > #import "IconLoadingDelegate.h" >@@ -4442,6 +4443,25 @@ - (void)_setEditable:(BOOL)editable > #endif > } > >+- (void)_takeFindStringFromSelection:(id)sender >+{ >+#if PLATFORM(MAC) >+ [self takeFindStringFromSelection:sender]; >+#else >+ _page->executeEditCommand("TakeFindStringFromSelection"_s); >+#endif >+} >+ >++ (NSString *)_stringForFindInPage >+{ >+ return WebKit::stringForFindInPage(); >+} >+ >++ (void)_clearStringForFindInPage >+{ >+ WebKit::updateStringForFindInPage(emptyString()); >+} >+ > - (_WKRemoteObjectRegistry *)_remoteObjectRegistry > { > #if PLATFORM(MAC) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >index 88b5635be8fe6a0bb2e5d3cf62c7bf62f6c786bd..f9602209c23e792e0e32fb0aa9ad7fede81859d8 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >@@ -215,6 +215,10 @@ typedef NS_OPTIONS(NSUInteger, _WKRectEdge) { > - (IBAction)_changeListType:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > - (IBAction)_pasteAsQuotation:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > - (IBAction)_pasteAndMatchStyle:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >+- (IBAction)_takeFindStringFromSelection:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >+ >+@property (class, nonatomic, readonly) NSString *_stringForFindInPage WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >++ (void)_clearStringForFindInPage WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > > #if TARGET_OS_IPHONE > >diff --git a/Source/WebKit/UIProcess/Cocoa/FindInPageHelpers.h b/Source/WebKit/UIProcess/Cocoa/FindInPageHelpers.h >new file mode 100644 >index 0000000000000000000000000000000000000000..fd799285b355bbf8cfcd83f07552d4ff0301b8df >--- /dev/null >+++ b/Source/WebKit/UIProcess/Cocoa/FindInPageHelpers.h >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#pragma once >+ >+#if PLATFORM(COCOA) >+ >+namespace WTF { >+class String; >+} >+ >+namespace WebKit { >+ >+void updateStringForFindInPage(const WTF::String&); >+WTF::String stringForFindInPage(); >+ >+} // namespace WebKit >+ >+#endif // PLATFORM(COCOA) >diff --git a/Source/WebKit/UIProcess/Cocoa/FindInPageHelpers.mm b/Source/WebKit/UIProcess/Cocoa/FindInPageHelpers.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..78e4ab5c6b3a89e121cd396788a6c81c7158de95 >--- /dev/null >+++ b/Source/WebKit/UIProcess/Cocoa/FindInPageHelpers.mm >@@ -0,0 +1,75 @@ >+/* >+ * Copyright (C) 2018 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 "config.h" >+#import "FindInPageHelpers.h" >+ >+#import <wtf/text/WTFString.h> >+ >+#if PLATFORM(MAC) >+#import <AppKit/NSPasteboard.h> >+#import <WebCore/LegacyNSPasteboardTypes.h> >+#endif >+ >+namespace WebKit { >+ >+#if PLATFORM(MAC) >+ >+static NSPasteboard *findPasteboard() >+{ >+ ALLOW_DEPRECATED_DECLARATIONS_BEGIN >+ return [NSPasteboard pasteboardWithName:NSFindPboard]; >+ ALLOW_DEPRECATED_DECLARATIONS_END >+} >+ >+#else >+ >+static String& globalStringForFindInPage() >+{ >+ static NeverDestroyed<String> string; >+ return string.get(); >+} >+ >+#endif >+ >+void updateStringForFindInPage(const String& string) >+{ >+#if PLATFORM(MAC) >+ [findPasteboard() setString:string forType:WebCore::legacyStringPasteboardType()]; >+#else >+ globalStringForFindInPage() = string; >+#endif >+} >+ >+String stringForFindInPage() >+{ >+#if PLATFORM(MAC) >+ return [findPasteboard() stringForType:WebCore::legacyStringPasteboardType()]; >+#else >+ return globalStringForFindInPage(); >+#endif >+} >+ >+} // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 01bea50d4f2f281903dd61f9cfe408dfcc02b3ad..0911d6517520c28d961b04b804bbf01082d5d91a 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1720,6 +1720,8 @@ private: > void interpretKeyEvent(const EditorState&, bool isCharEvent, bool& handled); > void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect, WebCore::RouteSharingPolicy, const String&); > void selectionRectsCallback(const Vector<WebCore::SelectionRect>&, CallbackID); >+ >+ void updateStringForFindInPage(const String&); > #endif > #if PLATFORM(GTK) > void printFinishedCallback(const WebCore::ResourceError&, CallbackID); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index 1e4518f71c41fd1e628886fc03e3512f018aa1c9..464c0332771b21e995d2a5027549b6415a33d2f9 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -416,6 +416,8 @@ messages -> WebPageProxy { > > EnableInspectorNodeSearch() > DisableInspectorNodeSearch() >+ >+ UpdateStringForFindInPage(String findString) > #endif > > DidChangeInspectorFrontendCount(uint64_t count) >diff --git a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >index f6d304b81061b5ad418806bd89d6b767af4dbbc2..83b0e4c501c6f77834e955347ed1357081897330 100644 >--- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >@@ -31,6 +31,7 @@ > #import "APIUIClient.h" > #import "DataReference.h" > #import "EditingRange.h" >+#import "FindInPageHelpers.h" > #import "InteractionInformationAtPosition.h" > #import "Logging.h" > #import "NativeWebKeyboardEvent.h" >@@ -226,6 +227,14 @@ void WebPageProxy::resendLastVisibleContentRects() > m_process->send(Messages::ViewUpdateDispatcher::VisibleContentRectUpdate(m_pageID, m_lastVisibleContentRectUpdate), 0); > } > >+void WebPageProxy::updateStringForFindInPage(const String& string) >+{ >+ if (!isValid()) >+ return; >+ >+ WebKit::updateStringForFindInPage(string); >+} >+ > static inline float adjustedUnexposedEdge(float documentEdge, float exposedRectEdge, float factor) > { > if (exposedRectEdge < documentEdge) >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 4da02fab5127a1f4677f9e220e3123010345a37a..1f61adfd13be69a266ac53f72a1e38af7e200058 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -75,9 +75,9 @@ > 005D158F18E4C4EB00734619 /* _WKFindDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 005D158E18E4C4EB00734619 /* _WKFindDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 00B9661618E24CBA00CE1F88 /* APIFindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B9661518E24CBA00CE1F88 /* APIFindClient.h */; }; > 00B9661A18E25AE100CE1F88 /* FindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B9661818E25AE100CE1F88 /* FindClient.h */; }; >+ 07297F9F1C17AA1A015F0735 /* PersistencyUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 07321F9D1C17BBEA223F0735 /* PersistencyUtils.h */; }; > 07297F9F1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 07297F9D1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.h */; }; > 07297F9F1C17BBEA015F0735 /* DeviceIdHashSaltStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 07297F9D1C17BBEA223F0735 /* DeviceIdHashSaltStorage.h */; }; >- 07297F9F1C17AA1A015F0735 /* PersistencyUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 07321F9D1C17BBEA223F0735 /* PersistencyUtils.h */; }; > 07297FA31C186ADB003F0735 /* WKUserMediaPermissionCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 07297FA11C186ADB003F0735 /* WKUserMediaPermissionCheck.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 074E75FE1DF2211900D318EC /* UserMediaProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 074E75FB1DF1FD1300D318EC /* UserMediaProcessManager.h */; }; > 076E884E1A13CADF005E90FC /* APIContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 076E884D1A13CADF005E90FC /* APIContextMenuClient.h */; }; >@@ -1038,8 +1038,8 @@ > 57DCEDC3214F114C0016B847 /* MockLocalService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC1214F114C0016B847 /* MockLocalService.h */; }; > 57DCEDC7214F18300016B847 /* MockLocalConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC5214F18300016B847 /* MockLocalConnection.h */; }; > 57DCEDCB214F4E420016B847 /* MockAuthenticatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */; }; >- 58E977DF21C49A00005D92A6 /* NetworkHTTPSUpgradeChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 58E977DD21C49A00005D92A6 /* NetworkHTTPSUpgradeChecker.h */; }; > 587743A621C30BBE00AE9084 /* HTTPSUpgradeList.db in Resources */ = {isa = PBXBuildFile; fileRef = 587743A421C30AD800AE9084 /* HTTPSUpgradeList.db */; }; >+ 58E977DF21C49A00005D92A6 /* NetworkHTTPSUpgradeChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 58E977DD21C49A00005D92A6 /* NetworkHTTPSUpgradeChecker.h */; }; > 5C0B17781E7C880E00E9123C /* NetworkSocketStreamMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B17741E7C879C00E9123C /* NetworkSocketStreamMessageReceiver.cpp */; }; > 5C0B17791E7C882100E9123C /* WebSocketStreamMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */; }; > 5C1426ED1C23F80900D41183 /* NetworkProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1426E31C23F80500D41183 /* NetworkProcessCreationParameters.h */; }; >@@ -1856,14 +1856,14 @@ > 00B9661518E24CBA00CE1F88 /* APIFindClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIFindClient.h; sourceTree = "<group>"; }; > 00B9661718E25AE100CE1F88 /* FindClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindClient.mm; sourceTree = "<group>"; }; > 00B9661818E25AE100CE1F88 /* FindClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindClient.h; sourceTree = "<group>"; }; >+ 0729455C1C1711EA003F0735 /* PersistencyUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PersistencyUtils.cpp; sourceTree = "<group>"; }; > 07297F9C1C1711EA003F0735 /* DeviceIdHashSaltStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceIdHashSaltStorage.cpp; sourceTree = "<group>"; }; > 07297F9C1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMediaPermissionCheckProxy.cpp; sourceTree = "<group>"; }; > 07297F9D1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMediaPermissionCheckProxy.h; sourceTree = "<group>"; }; > 07297F9D1C17BBEA223F0735 /* DeviceIdHashSaltStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceIdHashSaltStorage.h; sourceTree = "<group>"; }; >- 0729455C1C1711EA003F0735 /* PersistencyUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PersistencyUtils.cpp; sourceTree = "<group>"; }; >- 07321F9D1C17BBEA223F0735 /* PersistencyUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PersistencyUtils.h; sourceTree = "<group>"; }; > 07297FA01C186ADB003F0735 /* WKUserMediaPermissionCheck.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserMediaPermissionCheck.cpp; sourceTree = "<group>"; }; > 07297FA11C186ADB003F0735 /* WKUserMediaPermissionCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserMediaPermissionCheck.h; sourceTree = "<group>"; }; >+ 07321F9D1C17BBEA223F0735 /* PersistencyUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PersistencyUtils.h; sourceTree = "<group>"; }; > 074E75FB1DF1FD1300D318EC /* UserMediaProcessManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMediaProcessManager.h; sourceTree = "<group>"; }; > 074E75FC1DF2002400D318EC /* UserMediaProcessManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMediaProcessManager.cpp; sourceTree = "<group>"; }; > 074E76001DF7075D00D318EC /* MediaDeviceSandboxExtensions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaDeviceSandboxExtensions.cpp; sourceTree = "<group>"; }; >@@ -2805,6 +2805,8 @@ > 2DFC7DB91BCCC19500C1548C /* WebViewImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewImpl.h; sourceTree = "<group>"; }; > 2DFC7DBA1BCCC19500C1548C /* WebViewImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewImpl.mm; sourceTree = "<group>"; }; > 2DFF7B6E1DA4CFAF00814614 /* WKBackForwardListItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListItemPrivate.h; sourceTree = "<group>"; }; >+ 2E133B4D21D40A9700ED1CB2 /* FindInPageHelpers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindInPageHelpers.mm; sourceTree = "<group>"; }; >+ 2E133B4E21D40A9800ED1CB2 /* FindInPageHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindInPageHelpers.h; sourceTree = "<group>"; }; > 2E16B6CC2017B7AB008996D6 /* WKFocusedFormControlView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFocusedFormControlView.mm; path = ios/forms/WKFocusedFormControlView.mm; sourceTree = "<group>"; }; > 2E16B6CD2017B7AC008996D6 /* WKFocusedFormControlView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFocusedFormControlView.h; path = ios/forms/WKFocusedFormControlView.h; sourceTree = "<group>"; }; > 2E5C770C1FA7D429005932C3 /* APIAttachment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIAttachment.h; sourceTree = "<group>"; }; >@@ -3406,9 +3408,9 @@ > 57DCEDC6214F18300016B847 /* MockLocalConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MockLocalConnection.mm; sourceTree = "<group>"; }; > 57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockAuthenticatorManager.h; sourceTree = "<group>"; }; > 57DCEDCD214F51680016B847 /* MockAuthenticatorManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockAuthenticatorManager.cpp; sourceTree = "<group>"; }; >+ 587743A421C30AD800AE9084 /* HTTPSUpgradeList.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = HTTPSUpgradeList.db; path = DerivedSources/WebKit2/HTTPSUpgradeList.db; sourceTree = BUILT_PRODUCTS_DIR; }; > 58E977DC21C499FE005D92A6 /* NetworkHTTPSUpgradeChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkHTTPSUpgradeChecker.cpp; sourceTree = "<group>"; }; > 58E977DD21C49A00005D92A6 /* NetworkHTTPSUpgradeChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkHTTPSUpgradeChecker.h; sourceTree = "<group>"; }; >- 587743A421C30AD800AE9084 /* HTTPSUpgradeList.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = HTTPSUpgradeList.db; path = DerivedSources/WebKit2/HTTPSUpgradeList.db; sourceTree = BUILT_PRODUCTS_DIR; }; > 5C0B17741E7C879C00E9123C /* NetworkSocketStreamMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkSocketStreamMessageReceiver.cpp; path = DerivedSources/WebKit2/NetworkSocketStreamMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; > 5C0B17751E7C879C00E9123C /* NetworkSocketStreamMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSocketStreamMessages.h; path = DerivedSources/WebKit2/NetworkSocketStreamMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; > 5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebSocketStreamMessageReceiver.cpp; path = DerivedSources/WebKit2/WebSocketStreamMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >@@ -5301,6 +5303,8 @@ > A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */, > 00B9661818E25AE100CE1F88 /* FindClient.h */, > 00B9661718E25AE100CE1F88 /* FindClient.mm */, >+ 2E133B4E21D40A9800ED1CB2 /* FindInPageHelpers.h */, >+ 2E133B4D21D40A9700ED1CB2 /* FindInPageHelpers.mm */, > CD78E1131DB7D7ED0014A2DE /* FullscreenClient.h */, > CD78E1121DB7D7ED0014A2DE /* FullscreenClient.mm */, > 51C0C9721DDD74F00032CAD3 /* IconLoadingDelegate.h */, >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >index 4b5a6d3addb443e9800f0a5547bb979fc64d80ba..16804cb89909ecc8726d1db6506979b687163cee 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >@@ -173,6 +173,7 @@ private: > int getPasteboardItemsCount() final; > RefPtr<WebCore::DocumentFragment> documentFragmentFromDelegate(int index) final; > bool performsTwoStepPaste(WebCore::DocumentFragment*) final; >+ void updateStringForFindInPage(const String&) final; > #endif > > bool performTwoStepDrop(WebCore::DocumentFragment&, WebCore::Range&, bool isMove) final; >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm b/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm >index c60438c4e5bcbb4a43c83b85d441912ec4774627..2212325e0e6b5bd4b696496714c3427192fda913 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm >+++ b/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm >@@ -86,6 +86,11 @@ bool WebEditorClient::performsTwoStepPaste(WebCore::DocumentFragment*) > return false; > } > >+void WebEditorClient::updateStringForFindInPage(const String& findString) >+{ >+ m_page->updateStringForFindInPage(findString); >+} >+ > void WebEditorClient::overflowScrollPositionChanged() > { > m_page->didChangeSelection(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index fc4ea1dfb94264ca1b97bfd8965320e402e07111..34ddff5150b0a6212ba2b6087f5d796bc57065e5 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -939,6 +939,8 @@ public: > const WebCore::ViewportConfiguration& viewportConfiguration() const { return m_viewportConfiguration; } > > void hardwareKeyboardAvailabilityChanged(); >+ >+ void updateStringForFindInPage(const String&); > #endif > > #if ENABLE(IOS_TOUCH_EVENTS) >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 90658056389737ef9caa5ffd61e8edaadf79cce9..6298ce95dc74a0c5b6f10b1e10a705445a424c01 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -3125,6 +3125,11 @@ void WebPage::hardwareKeyboardAvailabilityChanged() > focusedFrame->eventHandler().capsLockStateMayHaveChanged(); > } > >+void WebPage::updateStringForFindInPage(const String& findString) >+{ >+ send(Messages::WebPageProxy::UpdateStringForFindInPage(findString)); >+} >+ > #if USE(QUICK_LOOK) > void WebPage::didReceivePasswordForQuickLookDocument(const String& password) > { >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >index 8464059c4952b96f614b7d5453a751585d8e4ab5..0a3624e57c471c625a32696402c23ba4e64b99ab 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >@@ -144,6 +144,7 @@ private: > int getPasteboardItemsCount() final; > RefPtr<WebCore::DocumentFragment> documentFragmentFromDelegate(int index) final; > bool performsTwoStepPaste(WebCore::DocumentFragment*) final; >+ void updateStringForFindInPage(const String&) final { } > #endif > > bool performTwoStepDrop(WebCore::DocumentFragment&, WebCore::Range& destination, bool isMove) final; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 8dcee1e52700fae0a737c5008d5a85f0f1a8f060..ce72af9adf0f21025760a1b3b3cb9a1b833ab89b 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-26 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Add support for using the current text selection as the find string on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=193034 >+ <rdar://problem/45138739> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a new API test to verify that the new WebKit SPI (_stringForFindInPage, _takeFindStringFromSelection:, and >+ _clearStringForFindInPage) works as expected. >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/UseSelectionAsFindString.mm: Added. >+ (TestWebKitAPI::TEST): >+ > 2018-12-22 Carlos Garcia Campos <cgarcia@igalia.com> > > WebDriver: warn about non existing tests when parsing expectations >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 2314328fed4ea1119fe35d1a59cf54dcaeee9227..bcdd2cf98974bd25f4689b692a2f7408e357cf0d 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -118,6 +118,7 @@ > 2E92B8F7216490D4005B64F0 /* rich-text-attributes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2E92B8F6216490C3005B64F0 /* rich-text-attributes.html */; }; > 2E92B8FA2164A0C1005B64F0 /* FontAttributes.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E92B8F8216490EA005B64F0 /* FontAttributes.mm */; }; > 2E9896151D8F093800739892 /* text-and-password-inputs.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2E9896141D8F092B00739892 /* text-and-password-inputs.html */; }; >+ 2EB242B821D4140B0055C1C0 /* UseSelectionAsFindString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E133B4F21D40AF000ED1CB2 /* UseSelectionAsFindString.mm */; }; > 2EB29D5E1F762DB90023A5F1 /* dump-datatransfer-types.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EB29D5D1F762DA50023A5F1 /* dump-datatransfer-types.html */; }; > 2EBD9D0A2134730D002DA758 /* video.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 07CD32F72065B72A0064A4BE /* video.html */; }; > 2ECFF5551D9B12F800B55394 /* NowPlayingControlsTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2ECFF5541D9B12F800B55394 /* NowPlayingControlsTests.mm */; }; >@@ -1395,6 +1396,7 @@ > 2DE71AFF1D49C2F000904094 /* blinking-div.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "blinking-div.html"; sourceTree = "<group>"; }; > 2DFF7B6C1DA487AF00814614 /* SnapshotStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SnapshotStore.mm; sourceTree = "<group>"; }; > 2E131C171D83A97E001BA36C /* wide-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "wide-autoplaying-video-with-audio.html"; sourceTree = "<group>"; }; >+ 2E133B4F21D40AF000ED1CB2 /* UseSelectionAsFindString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UseSelectionAsFindString.mm; sourceTree = "<group>"; }; > 2E14A5281D3FE8B80010F35B /* autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "autoplaying-video-with-audio.html"; sourceTree = "<group>"; }; > 2E1B7AFF1D41A95F007558B4 /* large-video-seek-after-ending.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-seek-after-ending.html"; sourceTree = "<group>"; }; > 2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-hides-controls-after-seek-to-end.html"; sourceTree = "<group>"; }; >@@ -2537,6 +2539,7 @@ > 7CCB99201D3B41F6003922F6 /* UserInitiatedActionInNavigationAction.mm */, > 07EDEFAC1EB9400C00D43292 /* UserMediaDisabled.mm */, > 07F4E92D20AF58D3002E3803 /* UserMediaSimulateFailedSandbox.mm */, >+ 2E133B4F21D40AF000ED1CB2 /* UseSelectionAsFindString.mm */, > 93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */, > CD3065DF2165682E00E895DF /* VideoQualityDisplayCompositing.mm */, > 6356FB211EC4E0BA0044BF18 /* VisibleContentRect.mm */, >@@ -4191,6 +4194,7 @@ > 0799C3491EBA2D7B003B7532 /* UserMediaDisabled.mm in Sources */, > 07F4E92E20AF59E2002E3803 /* UserMediaSimulateFailedSandbox.mm in Sources */, > 7CCE7F181A411AE600447C4C /* UserMessage.cpp in Sources */, >+ 2EB242B821D4140B0055C1C0 /* UseSelectionAsFindString.mm in Sources */, > 7C83E03A1D0A602700FEBCF3 /* UtilitiesCocoa.mm in Sources */, > 7C83E0C61D0A654E00FEBCF3 /* VideoControlsManager.mm in Sources */, > CD3065E02165682E00E895DF /* VideoQualityDisplayCompositing.mm in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/UseSelectionAsFindString.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/UseSelectionAsFindString.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..680d532408a6f46be11c86a54652f0a3dd53b00c >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/UseSelectionAsFindString.mm >@@ -0,0 +1,50 @@ >+/* >+ * Copyright (C) 2018 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 "config.h" >+ >+#if WK_API_ENABLED >+ >+#import "PlatformUtilities.h" >+#import "TestWKWebView.h" >+#import <WebKit/WKWebViewPrivate.h> >+ >+namespace TestWebKitAPI { >+ >+TEST(WebKit, UseSelectionAsFindString) >+{ >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); >+ [webView synchronouslyLoadHTMLString:@"<body>Hello <span id='text'>world</span></body>"]; >+ [webView evaluateJavaScript:@"getSelection().selectAllChildren(text)" completionHandler:nil]; >+ [webView _takeFindStringFromSelection:nil]; >+ [webView waitForNextPresentationUpdate]; >+ EXPECT_WK_STREQ("world", [WKWebView _stringForFindInPage]); >+ [WKWebView _clearStringForFindInPage]; >+ EXPECT_WK_STREQ("", [WKWebView _stringForFindInPage]); >+} >+ >+} // namespace TestWebKitAPI >+ >+#endif // WK_API_ENABLED
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193034
:
358074
|
358076
|
358082
|
358085
|
358097
|
358099
|
358242