Diff
Modified: trunk/Source/WebCore/ChangeLog (288731 => 288732)
--- trunk/Source/WebCore/ChangeLog 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebCore/ChangeLog 2022-01-28 07:31:41 UTC (rev 288732)
@@ -1,3 +1,25 @@
+2022-01-27 Aditya Keerthi <[email protected]>
+
+ Introduce WebFoundTextRange and WebFoundTextRangeController to support restorable find results
+ https://bugs.webkit.org/show_bug.cgi?id=235691
+ rdar://88117167
+
+ Reviewed by Wenson Hsieh.
+
+ * editing/TextIterator.cpp:
+ (WebCore::findIteratorOptions): Deleted.
+ * editing/TextIterator.h:
+ (WebCore::findIteratorOptions):
+
+ Moved method into header to share logic.
+
+ * page/Page.cpp:
+ (WebCore::Page::findTextMatches):
+
+ Added a way to suppress marking text matches.
+
+ * page/Page.h:
+
2022-01-27 Carlos Garcia Campos <[email protected]>
[WPE][a11y] Add option to build with ATSPI
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (288731 => 288732)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2022-01-28 07:31:41 UTC (rev 288732)
@@ -2478,14 +2478,6 @@
return plainText(range, defaultBehaviors, isDisplayString).replace(noBreakSpace, ' ');
}
-static constexpr TextIteratorBehaviors findIteratorOptions(FindOptions options)
-{
- TextIteratorBehaviors iteratorOptions { TextIteratorBehavior::EntersTextControls, TextIteratorBehavior::ClipsToFrameAncestors, TextIteratorBehavior::EntersImageOverlays };
- if (!options.contains(DoNotTraverseFlatTree))
- iteratorOptions.add(TextIteratorBehavior::TraversesFlatTree);
- return iteratorOptions;
-}
-
static void forEachMatch(const SimpleRange& range, const String& target, FindOptions options, const Function<bool(CharacterRange)>& match)
{
SearchBuffer buffer(target, options);
Modified: trunk/Source/WebCore/editing/TextIterator.h (288731 => 288732)
--- trunk/Source/WebCore/editing/TextIterator.h 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebCore/editing/TextIterator.h 2022-01-28 07:31:41 UTC (rev 288732)
@@ -293,6 +293,14 @@
bool m_didLookAhead { true };
};
+constexpr TextIteratorBehaviors findIteratorOptions(FindOptions options = { })
+{
+ TextIteratorBehaviors iteratorOptions { TextIteratorBehavior::EntersTextControls, TextIteratorBehavior::ClipsToFrameAncestors, TextIteratorBehavior::EntersImageOverlays };
+ if (!options.contains(DoNotTraverseFlatTree))
+ iteratorOptions.add(TextIteratorBehavior::TraversesFlatTree);
+ return iteratorOptions;
+}
+
inline CharacterRange characterRange(const BoundaryPoint& start, const SimpleRange& range, TextIteratorBehaviors behaviors)
{
return { characterCount({ start, range.start }, behaviors), characterCount(range, behaviors) };
Modified: trunk/Source/WebCore/page/Page.cpp (288731 => 288732)
--- trunk/Source/WebCore/page/Page.cpp 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebCore/page/Page.cpp 2022-01-28 07:31:41 UTC (rev 288732)
@@ -782,7 +782,7 @@
return false;
}
-auto Page::findTextMatches(const String& target, FindOptions options, unsigned limit) -> MatchingRanges
+auto Page::findTextMatches(const String& target, FindOptions options, unsigned limit, bool markMatches) -> MatchingRanges
{
MatchingRanges result;
@@ -789,7 +789,7 @@
Frame* frame = &mainFrame();
Frame* frameWithSelection = nullptr;
do {
- frame->editor().countMatchesForText(target, { }, options, limit ? (limit - result.ranges.size()) : 0, true, &result.ranges);
+ frame->editor().countMatchesForText(target, { }, options, limit ? (limit - result.ranges.size()) : 0, markMatches, &result.ranges);
if (frame->selection().isRange())
frameWithSelection = frame;
frame = incrementFrame(frame, true, CanWrap::No);
Modified: trunk/Source/WebCore/page/Page.h (288731 => 288732)
--- trunk/Source/WebCore/page/Page.h 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebCore/page/Page.h 2022-01-28 07:31:41 UTC (rev 288732)
@@ -396,7 +396,7 @@
int indexForSelection { 0 }; // FIXME: Consider std::optional<unsigned> or unsigned for this instead.
};
static constexpr int NoMatchAfterUserSelection = -1;
- WEBCORE_EXPORT MatchingRanges findTextMatches(const String&, FindOptions, unsigned maxCount);
+ WEBCORE_EXPORT MatchingRanges findTextMatches(const String&, FindOptions, unsigned maxCount, bool markMatches = true);
#if PLATFORM(COCOA)
void platformInitialize();
Modified: trunk/Source/WebKit/ChangeLog (288731 => 288732)
--- trunk/Source/WebKit/ChangeLog 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/ChangeLog 2022-01-28 07:31:41 UTC (rev 288732)
@@ -1,3 +1,81 @@
+2022-01-27 Aditya Keerthi <[email protected]>
+
+ Introduce WebFoundTextRange and WebFoundTextRangeController to support restorable find results
+ https://bugs.webkit.org/show_bug.cgi?id=235691
+ rdar://88117167
+
+ Reviewed by Wenson Hsieh.
+
+ To better support the _UITextSearching protocol, WKWebView needs to be
+ able to restore find-in-page results found in other views with the same
+ content.
+
+ The desired functionality is achieved through the use of two new interfaces:
+ WebFoundTextRange, which represents a range of found text, and
+ WebFoundTextRangeController, which will be responsible for finding,
+ decorating, and scrolling to ranges.
+
+ A "found text range" is uniquely identified by a location, length,
+ frame identifier, and order. The location and length represent a
+ character range in document corresponding to the frame identifier.
+ The order represents the relative ordering between ranges - for
+ example, results in the main frame are ordered before results in a
+ subframe.
+
+ This is the first in a series of patches that implements the interface.
+ The available methods on WebFoundTextRangeController map one-to-one with
+ the _UITextSearching protocol. This patch implements the creation of
+ restorable found ranges.
+
+ * Scripts/generate-unified-sources.sh:
+
+ Increase unified build files to 120.
+
+ * Scripts/webkit/messages.py:
+ (headers_for_type):
+ * Shared/WebFindOptions.cpp: Copied from Source/WebKit/Shared/WebFindOptions.h.
+ (WebKit::core):
+ * Shared/WebFindOptions.h:
+ * Shared/WebFoundTextRange.cpp:
+ (WebKit::WebFoundTextRange::operator== const):
+ (WebKit::WebFoundTextRange::encode const):
+ (WebKit::WebFoundTextRange::decode):
+ * Shared/WebFoundTextRange.h:
+ (WTF::WebFoundTextRangeHash::hash):
+ (WTF::WebFoundTextRangeHash::equal):
+ (WTF::HashTraits<WebKit::WebFoundTextRange>::emptyValue):
+ (WTF::HashTraits<WebKit::WebFoundTextRange>::constructDeletedValue):
+ (WTF::HashTraits<WebKit::WebFoundTextRange>::isDeletedValue):
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::decode):
+
+ Fix unified source-related build failure.
+
+ * Sources.txt:
+ * UnifiedSources-output.xcfilelist:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::core): Deleted.
+ * WebProcess/WebPage/FindController.h:
+ * WebProcess/WebPage/WebFoundTextRangeController.cpp: Added.
+ (WebKit::WebFoundTextRangeController::WebFoundTextRangeController):
+ (WebKit::WebFoundTextRangeController::findTextRangesForStringMatches):
+
+ Use the FrameTrees's uniqueName as a frame identifier for the found
+ text range. These names are consistent across web content with the
+ same markup.
+
+ (WebKit::WebFoundTextRangeController::decorateTextRangeWithStyle):
+ (WebKit::WebFoundTextRangeController::scrollTextRangeToVisible):
+ (WebKit::WebFoundTextRangeController::clearAllDecoratedFoundText):
+ (WebKit::WebFoundTextRangeController::didBeginTextSearchOperation):
+ (WebKit::WebFoundTextRangeController::didEndTextSearchOperation):
+ (WebKit::WebFoundTextRangeController::willMoveToPage):
+ (WebKit::WebFoundTextRangeController::didMoveToPage):
+ (WebKit::WebFoundTextRangeController::mouseEvent):
+ (WebKit::WebFoundTextRangeController::drawRect):
+ * WebProcess/WebPage/WebFoundTextRangeController.h: Added.
+
2022-01-27 Carlos Garcia Campos <[email protected]>
[WPE][a11y] Add option to build with ATSPI
Modified: trunk/Source/WebKit/Scripts/generate-unified-sources.sh (288731 => 288732)
--- trunk/Source/WebKit/Scripts/generate-unified-sources.sh 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/Scripts/generate-unified-sources.sh 2022-01-28 07:31:41 UTC (rev 288732)
@@ -14,7 +14,7 @@
fi
fi
-UnifiedSourceCppFileCount=115
+UnifiedSourceCppFileCount=120
UnifiedSourceMmFileCount=80
if [ $# -eq 0 ]; then
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (288731 => 288732)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2022-01-28 07:31:41 UTC (rev 288732)
@@ -864,6 +864,7 @@
'WebKit::CallDownloadDidStart': ['"DownloadManager.h"'],
'WebKit::ContentWorldIdentifier': ['"ContentWorldShared.h"'],
'WebKit::DocumentEditingContextRequest': ['"DocumentEditingContext.h"'],
+ 'WebKit::FindDecorationStyle': ['"WebFindOptions.h"'],
'WebKit::FindOptions': ['"WebFindOptions.h"'],
'WebKit::FormSubmitListenerIdentifier': ['"IdentifierTypes.h"'],
'WebKit::GestureRecognizerState': ['"GestureTypes.h"'],
Copied: trunk/Source/WebKit/Shared/WebFindOptions.cpp (from rev 288731, trunk/Source/WebKit/Shared/WebFindOptions.h) (0 => 288732)
--- trunk/Source/WebKit/Shared/WebFindOptions.cpp (rev 0)
+++ trunk/Source/WebKit/Shared/WebFindOptions.cpp 2022-01-28 07:31:41 UTC (rev 288732)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "config.h"
+#include "WebFindOptions.h"
+
+namespace WebKit {
+
+WebCore::FindOptions core(OptionSet<FindOptions> options)
+{
+ WebCore::FindOptions result;
+ if (options.contains(FindOptions::CaseInsensitive))
+ result.add(WebCore::CaseInsensitive);
+ if (options.contains(FindOptions::AtWordStarts))
+ result.add(WebCore::AtWordStarts);
+ if (options.contains(FindOptions::TreatMedialCapitalAsWordStart))
+ result.add(WebCore::TreatMedialCapitalAsWordStart);
+ if (options.contains(FindOptions::Backwards))
+ result.add(WebCore::Backwards);
+ if (options.contains(FindOptions::WrapAround))
+ result.add(WebCore::WrapAround);
+ if (options.contains(FindOptions::AtWordEnds))
+ result.add(WebCore::AtWordEnds);
+ return result;
+}
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/Shared/WebFindOptions.h (288731 => 288732)
--- trunk/Source/WebKit/Shared/WebFindOptions.h 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/Shared/WebFindOptions.h 2022-01-28 07:31:41 UTC (rev 288732)
@@ -25,6 +25,7 @@
#pragma once
+#include <WebCore/FindOptions.h>
#include <wtf/EnumTraits.h>
namespace WebKit {
@@ -43,6 +44,14 @@
AtWordEnds = 1 << 10,
};
+enum class FindDecorationStyle : uint8_t {
+ Normal,
+ Found,
+ Highlighted,
+};
+
+WebCore::FindOptions core(OptionSet<FindOptions>);
+
} // namespace WebKit
namespace WTF {
@@ -64,4 +73,13 @@
>;
};
+template<> struct EnumTraits<WebKit::FindDecorationStyle> {
+ using values = EnumValues<
+ WebKit::FindDecorationStyle,
+ WebKit::FindDecorationStyle::Normal,
+ WebKit::FindDecorationStyle::Found,
+ WebKit::FindDecorationStyle::Highlighted
+ >;
+};
+
} // namespace WTF
Copied: trunk/Source/WebKit/Shared/WebFoundTextRange.cpp (from rev 288731, trunk/Source/WebKit/Shared/WebFindOptions.h) (0 => 288732)
--- trunk/Source/WebKit/Shared/WebFoundTextRange.cpp (rev 0)
+++ trunk/Source/WebKit/Shared/WebFoundTextRange.cpp 2022-01-28 07:31:41 UTC (rev 288732)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "config.h"
+#include "WebFoundTextRange.h"
+
+#include "WebCoreArgumentCoders.h"
+
+namespace WebKit {
+
+bool WebFoundTextRange::operator==(const WebFoundTextRange& other) const
+{
+ return location == other.location
+ && length == other.length
+ && frameIdentifier == other.frameIdentifier
+ && order == other.order;
+}
+
+void WebFoundTextRange::encode(IPC::Encoder& encoder) const
+{
+ encoder << location;
+ encoder << length;
+ encoder << frameIdentifier;
+ encoder << order;
+}
+
+std::optional<WebFoundTextRange> WebFoundTextRange::decode(IPC::Decoder& decoder)
+{
+ WebFoundTextRange result;
+
+ if (!decoder.decode(result.location))
+ return std::nullopt;
+
+ if (!decoder.decode(result.length))
+ return std::nullopt;
+
+ if (!decoder.decode(result.frameIdentifier))
+ return std::nullopt;
+
+ if (!decoder.decode(result.order))
+ return std::nullopt;
+
+ return WTFMove(result);
+}
+
+} // namespace WebKit
Copied: trunk/Source/WebKit/Shared/WebFoundTextRange.h (from rev 288731, trunk/Source/WebKit/Shared/WebFindOptions.h) (0 => 288732)
--- trunk/Source/WebKit/Shared/WebFoundTextRange.h (rev 0)
+++ trunk/Source/WebKit/Shared/WebFoundTextRange.h 2022-01-28 07:31:41 UTC (rev 288732)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2022 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
+
+#include "ArgumentCoders.h"
+#include <wtf/HashTraits.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+struct WebFoundTextRange {
+ uint64_t location { 0 };
+ uint64_t length { 0 };
+ String frameIdentifier;
+ uint64_t order { 0 };
+
+ bool operator==(const WebFoundTextRange& other) const;
+
+ void encode(IPC::Encoder&) const;
+ static std::optional<WebFoundTextRange> decode(IPC::Decoder&);
+};
+
+} // namespace WebKit
+
+namespace WTF {
+
+struct WebFoundTextRangeHash {
+ static unsigned hash(const WebKit::WebFoundTextRange& range) { return pairIntHash(range.location, range.length); }
+ static bool equal(const WebKit::WebFoundTextRange& a, const WebKit::WebFoundTextRange& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+template<> struct HashTraits<WebKit::WebFoundTextRange> : GenericHashTraits<WebKit::WebFoundTextRange> {
+ static WebKit::WebFoundTextRange emptyValue() { return { }; }
+
+ static void constructDeletedValue(WebKit::WebFoundTextRange& range) { range = { }; }
+ static bool isDeletedValue(const WebKit::WebFoundTextRange& range) { return range == WebKit::WebFoundTextRange { }; }
+};
+
+template<> struct DefaultHash<WebKit::WebFoundTextRange> : WebFoundTextRangeHash { };
+
+}
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (288731 => 288732)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2022-01-28 07:31:41 UTC (rev 288732)
@@ -337,7 +337,7 @@
parameters.hasResourceLoadClient = WTFMove(*hasResourceLoadClient);
#if PLATFORM(MAC)
- std::optional<std::optional<DestinationColorSpace>> colorSpace;
+ std::optional<std::optional<WebCore::DestinationColorSpace>> colorSpace;
decoder >> colorSpace;
if (!colorSpace)
return std::nullopt;
Modified: trunk/Source/WebKit/Sources.txt (288731 => 288732)
--- trunk/Source/WebKit/Sources.txt 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/Sources.txt 2022-01-28 07:31:41 UTC (rev 288732)
@@ -255,6 +255,8 @@
Shared/WebErrors.cpp
Shared/WebEvent.cpp
Shared/WebEventConversion.cpp
+Shared/WebFindOptions.cpp
+Shared/WebFoundTextRange.cpp
Shared/WebGeolocationPosition.cpp
Shared/WebHitTestResultData.cpp
Shared/WebImage.cpp
@@ -828,6 +830,7 @@
WebProcess/WebPage/WebCookieCache.cpp
WebProcess/WebPage/WebCookieJar.cpp
WebProcess/WebPage/WebDocumentLoader.cpp
+WebProcess/WebPage/WebFoundTextRangeController.cpp
WebProcess/WebPage/WebFrame.cpp
WebProcess/WebPage/WebOpenPanelResultListener.cpp
WebProcess/WebPage/WebPage.cpp @no-unify
Modified: trunk/Source/WebKit/UnifiedSources-output.xcfilelist (288731 => 288732)
--- trunk/Source/WebKit/UnifiedSources-output.xcfilelist 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/UnifiedSources-output.xcfilelist 2022-01-28 07:31:41 UTC (rev 288732)
@@ -21,8 +21,13 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource113.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource114.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource115.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource116.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource117.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource118.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource119.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource12-mm.mm
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource12.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource120.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource13-mm.mm
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource13.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/unified-sources/UnifiedSource14-mm.mm
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (288731 => 288732)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2022-01-28 07:31:41 UTC (rev 288732)
@@ -1978,15 +1978,22 @@
E4D54D0421F1D72D007E3C36 /* ScrollingTreeFrameScrollingNodeRemoteIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E40C1F9321F0B96E00530718 /* ScrollingTreeFrameScrollingNodeRemoteIOS.h */; };
E4E57F6B21A83B1200345F3C /* RemoteLayerTreeNode.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E57F6A21A83B1100345F3C /* RemoteLayerTreeNode.h */; };
E50620922542102000C43091 /* ContactsUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E50620912542102000C43091 /* ContactsUISPI.h */; };
+ E5227D8427A11261008EAB57 /* WebFoundTextRange.h in Headers */ = {isa = PBXBuildFile; fileRef = E5227D8227A11231008EAB57 /* WebFoundTextRange.h */; };
E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */; };
E55CD1F524CF747D0042DB9C /* WebDateTimeChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD1F324CF747D0042DB9C /* WebDateTimeChooser.h */; };
E55CD20024D08D8F0042DB9C /* WebDateTimePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD1FC24D0880B0042DB9C /* WebDateTimePicker.h */; };
E55CD20324D09F1F0042DB9C /* WebDateTimePickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD20124D09F1F0042DB9C /* WebDateTimePickerMac.h */; };
+ E55CFD4E279D31E5002F1020 /* WebFoundTextRangeController.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CFD4C279D31C3002F1020 /* WebFoundTextRangeController.h */; };
E568B91F20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h in Headers */ = {isa = PBXBuildFile; fileRef = E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */; };
E568B92220A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */; };
E596DD6A251E71D400C275A7 /* WKContactPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E596DD68251E71D300C275A7 /* WKContactPicker.h */; };
E5BEF6822130C48000F31111 /* WebDataListSuggestionsDropdownIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BEF6802130C47F00F31111 /* WebDataListSuggestionsDropdownIOS.h */; };
E5CB07DC20E1678F0022C183 /* WKFormColorControl.h in Headers */ = {isa = PBXBuildFile; fileRef = E5CB07DA20E1678F0022C183 /* WKFormColorControl.h */; };
+ E5CBA76427A318E100DF7858 /* UnifiedSource120.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA75F27A3187800DF7858 /* UnifiedSource120.cpp */; };
+ E5CBA76527A318E100DF7858 /* UnifiedSource118.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA76127A3187900DF7858 /* UnifiedSource118.cpp */; };
+ E5CBA76627A318E100DF7858 /* UnifiedSource116.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA76327A3187B00DF7858 /* UnifiedSource116.cpp */; };
+ E5CBA76727A318E100DF7858 /* UnifiedSource119.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA76027A3187900DF7858 /* UnifiedSource119.cpp */; };
+ E5CBA76827A318E100DF7858 /* UnifiedSource117.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5CBA76227A3187900DF7858 /* UnifiedSource117.cpp */; };
E5DEFA6826F8F42600AB68DB /* PhotosUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E5DEFA6726F8F42600AB68DB /* PhotosUISPI.h */; };
ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */; settings = {ATTRIBUTES = (Private, ); }; };
F409BA181E6E64BC009DA28E /* WKDragDestinationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = F409BA171E6E64B3009DA28E /* WKDragDestinationAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6401,8 +6408,11 @@
E4E57F6821A83B0300345F3C /* RemoteLayerTreeNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeNode.mm; sourceTree = "<group>"; };
E4E57F6A21A83B1100345F3C /* RemoteLayerTreeNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeNode.h; sourceTree = "<group>"; };
E50620912542102000C43091 /* ContactsUISPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContactsUISPI.h; sourceTree = "<group>"; };
+ E5227D8227A11231008EAB57 /* WebFoundTextRange.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebFoundTextRange.h; sourceTree = "<group>"; };
+ E5227D8327A11231008EAB57 /* WebFoundTextRange.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebFoundTextRange.cpp; sourceTree = "<group>"; };
E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionPicker.h; sourceTree = "<group>"; };
E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionPicker.cpp; sourceTree = "<group>"; };
+ E5309B7D27A2872F00B10631 /* WebFindOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebFindOptions.cpp; sourceTree = "<group>"; };
E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionsDropdown.cpp; sourceTree = "<group>"; };
E55CD1F324CF747D0042DB9C /* WebDateTimeChooser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDateTimeChooser.h; sourceTree = "<group>"; };
E55CD1F424CF747D0042DB9C /* WebDateTimeChooser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDateTimeChooser.cpp; sourceTree = "<group>"; };
@@ -6410,6 +6420,8 @@
E55CD1FD24D0880B0042DB9C /* WebDateTimePicker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDateTimePicker.cpp; sourceTree = "<group>"; };
E55CD20124D09F1F0042DB9C /* WebDateTimePickerMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDateTimePickerMac.h; sourceTree = "<group>"; };
E55CD20224D09F1F0042DB9C /* WebDateTimePickerMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDateTimePickerMac.mm; sourceTree = "<group>"; };
+ E55CFD4C279D31C3002F1020 /* WebFoundTextRangeController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebFoundTextRangeController.h; sourceTree = "<group>"; };
+ E55CFD4D279D31C3002F1020 /* WebFoundTextRangeController.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebFoundTextRangeController.cpp; sourceTree = "<group>"; };
E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionsDropdown.h; sourceTree = "<group>"; };
E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionsDropdownMac.h; sourceTree = "<group>"; };
E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = WebDataListSuggestionsDropdownMac.mm; sourceTree = "<group>"; };
@@ -6419,6 +6431,11 @@
E5BEF6812130C47F00F31111 /* WebDataListSuggestionsDropdownIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebDataListSuggestionsDropdownIOS.mm; path = ios/WebDataListSuggestionsDropdownIOS.mm; sourceTree = "<group>"; };
E5CB07DA20E1678F0022C183 /* WKFormColorControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKFormColorControl.h; path = ios/forms/WKFormColorControl.h; sourceTree = "<group>"; };
E5CB07DB20E1678F0022C183 /* WKFormColorControl.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormColorControl.mm; path = ios/forms/WKFormColorControl.mm; sourceTree = "<group>"; };
+ E5CBA75F27A3187800DF7858 /* UnifiedSource120.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource120.cpp; path = "DerivedSources/WebKit/unified-sources/UnifiedSource120.cpp"; sourceTree = BUILT_PRODUCTS_DIR; };
+ E5CBA76027A3187900DF7858 /* UnifiedSource119.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource119.cpp; path = "DerivedSources/WebKit/unified-sources/UnifiedSource119.cpp"; sourceTree = BUILT_PRODUCTS_DIR; };
+ E5CBA76127A3187900DF7858 /* UnifiedSource118.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource118.cpp; path = "DerivedSources/WebKit/unified-sources/UnifiedSource118.cpp"; sourceTree = BUILT_PRODUCTS_DIR; };
+ E5CBA76227A3187900DF7858 /* UnifiedSource117.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource117.cpp; path = "DerivedSources/WebKit/unified-sources/UnifiedSource117.cpp"; sourceTree = BUILT_PRODUCTS_DIR; };
+ E5CBA76327A3187B00DF7858 /* UnifiedSource116.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource116.cpp; path = "DerivedSources/WebKit/unified-sources/UnifiedSource116.cpp"; sourceTree = BUILT_PRODUCTS_DIR; };
E5DEFA6726F8F42600AB68DB /* PhotosUISPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhotosUISPI.h; sourceTree = "<group>"; };
EB0D312D275AE13300863D8F /* com.apple.webkit.webpushd.mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.webkit.webpushd.mac.plist; sourceTree = "<group>"; };
EB0D312E275AE13300863D8F /* com.apple.webkit.webpushd.ios.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.webkit.webpushd.ios.plist; sourceTree = "<group>"; };
@@ -7261,7 +7278,10 @@
BC032DAF10F4380F0058C15A /* WebEvent.h */,
BC032DB010F4380F0058C15A /* WebEventConversion.cpp */,
BC032DB110F4380F0058C15A /* WebEventConversion.h */,
+ E5309B7D27A2872F00B10631 /* WebFindOptions.cpp */,
1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */,
+ E5227D8327A11231008EAB57 /* WebFoundTextRange.cpp */,
+ E5227D8227A11231008EAB57 /* WebFoundTextRange.h */,
BC0E607212D6BC200012A72A /* WebGeolocationPosition.cpp */,
BC0E607112D6BC200012A72A /* WebGeolocationPosition.h */,
93A88B341BC6EABA00ABA5C2 /* WebHitTestResultData.cpp */,
@@ -8270,6 +8290,11 @@
3CAECB5E27465AE300AB78D0 /* UnifiedSource113.cpp */,
4CAECB5E27465AE300AB78D0 /* UnifiedSource114.cpp */,
5CAECB5E27465AE300AB78D0 /* UnifiedSource115.cpp */,
+ E5CBA76327A3187B00DF7858 /* UnifiedSource116.cpp */,
+ E5CBA76227A3187900DF7858 /* UnifiedSource117.cpp */,
+ E5CBA76127A3187900DF7858 /* UnifiedSource118.cpp */,
+ E5CBA76027A3187900DF7858 /* UnifiedSource119.cpp */,
+ E5CBA75F27A3187800DF7858 /* UnifiedSource120.cpp */,
);
name = "unified-sources";
path = "DerivedSources/WebKit/unified-sources";
@@ -10802,6 +10827,8 @@
5C7FB46F21E97C0C009E3241 /* WebCookieJar.h */,
1A5B1C5218987EDF004FCF9B /* WebDocumentLoader.cpp */,
1A5B1C5318987EDF004FCF9B /* WebDocumentLoader.h */,
+ E55CFD4D279D31C3002F1020 /* WebFoundTextRangeController.cpp */,
+ E55CFD4C279D31C3002F1020 /* WebFoundTextRangeController.h */,
BC111ADC112F5B9300337BAB /* WebFrame.cpp */,
BC032D8910F437A00058C15A /* WebFrame.h */,
BC857F8412B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp */,
@@ -13452,6 +13479,8 @@
1A90C1EE1264FD50003E44D4 /* WebFindOptions.h in Headers */,
BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */,
BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */,
+ E5227D8427A11261008EAB57 /* WebFoundTextRange.h in Headers */,
+ E55CFD4E279D31E5002F1020 /* WebFoundTextRangeController.h in Headers */,
BC032D8D10F437A00058C15A /* WebFrame.h in Headers */,
BC032D7F10F4378D0058C15A /* WebFrameLoaderClient.h in Headers */,
9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */,
@@ -15662,6 +15691,11 @@
3CAECB6627465AE400AB78D0 /* UnifiedSource113.cpp in Sources */,
4CAECB6627465AE400AB78D0 /* UnifiedSource114.cpp in Sources */,
5CAECB6627465AE400AB78D0 /* UnifiedSource115.cpp in Sources */,
+ E5CBA76627A318E100DF7858 /* UnifiedSource116.cpp in Sources */,
+ E5CBA76827A318E100DF7858 /* UnifiedSource117.cpp in Sources */,
+ E5CBA76527A318E100DF7858 /* UnifiedSource118.cpp in Sources */,
+ E5CBA76727A318E100DF7858 /* UnifiedSource119.cpp in Sources */,
+ E5CBA76427A318E100DF7858 /* UnifiedSource120.cpp in Sources */,
E38A1FC023A551BF00D2374F /* UserInterfaceIdiom.mm in Sources */,
CD491B0D1E732E4D00009066 /* UserMediaCaptureManagerMessageReceiver.cpp in Sources */,
CD491B171E73525500009066 /* UserMediaCaptureManagerProxyMessageReceiver.cpp in Sources */,
Modified: trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp (288731 => 288732)
--- trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp 2022-01-28 07:31:41 UTC (rev 288732)
@@ -57,24 +57,6 @@
namespace WebKit {
using namespace WebCore;
-WebCore::FindOptions core(OptionSet<FindOptions> options)
-{
- WebCore::FindOptions result;
- if (options.contains(FindOptions::CaseInsensitive))
- result.add(WebCore::CaseInsensitive);
- if (options.contains(FindOptions::AtWordStarts))
- result.add(WebCore::AtWordStarts);
- if (options.contains(FindOptions::TreatMedialCapitalAsWordStart))
- result.add(WebCore::TreatMedialCapitalAsWordStart);
- if (options.contains(FindOptions::Backwards))
- result.add(WebCore::Backwards);
- if (options.contains(FindOptions::WrapAround))
- result.add(WebCore::WrapAround);
- if (options.contains(FindOptions::AtWordEnds))
- result.add(WebCore::AtWordEnds);
- return result;
-}
-
FindController::FindController(WebPage* webPage)
: m_webPage(webPage)
{
Modified: trunk/Source/WebKit/WebProcess/WebPage/FindController.h (288731 => 288732)
--- trunk/Source/WebKit/WebProcess/WebPage/FindController.h 2022-01-28 07:05:55 UTC (rev 288731)
+++ trunk/Source/WebKit/WebProcess/WebPage/FindController.h 2022-01-28 07:31:41 UTC (rev 288732)
@@ -118,6 +118,4 @@
#endif
};
-WebCore::FindOptions core(OptionSet<FindOptions>);
-
} // namespace WebKit
Added: trunk/Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp (0 => 288732)
--- trunk/Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp 2022-01-28 07:31:41 UTC (rev 288732)
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "config.h"
+#include "WebFoundTextRangeController.h"
+
+#include "WebPage.h"
+#include <WebCore/CharacterRange.h>
+#include <WebCore/Document.h>
+#include <WebCore/Editor.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/Page.h>
+#include <WebCore/PageOverlayController.h>
+#include <WebCore/PlatformMouseEvent.h>
+#include <WebCore/SimpleRange.h>
+#include <WebCore/TextIterator.h>
+
+namespace WebKit {
+
+WebFoundTextRangeController::WebFoundTextRangeController(WebPage& webPage)
+ : m_webPage(webPage)
+{
+}
+
+void WebFoundTextRangeController::findTextRangesForStringMatches(const String& string, OptionSet<FindOptions> options, uint32_t maxMatchCount, CompletionHandler<void(Vector<WebFoundTextRange>&&)>&& completionHandler)
+{
+ auto result = m_webPage->corePage()->findTextMatches(string, core(options), maxMatchCount, false);
+ Vector<WebCore::SimpleRange> findMatches = WTFMove(result.ranges);
+
+ String frameName;
+ uint64_t order = 0;
+ Vector<WebFoundTextRange> foundTextRanges;
+ for (auto& simpleRange : findMatches) {
+ auto& document = simpleRange.startContainer().document();
+
+ auto* element = document.documentElement();
+ if (!element)
+ return;
+
+ String currentFrameName = document.frame()->tree().uniqueName();
+ if (frameName != currentFrameName) {
+ frameName = currentFrameName;
+ order++;
+ }
+
+ // FIXME: We should get the character ranges at the same time as the SimpleRanges to avoid additional traversals.
+ auto range = characterRange(makeBoundaryPointBeforeNodeContents(*element), simpleRange, WebCore::findIteratorOptions());
+ auto foundTextRange = WebFoundTextRange { range.location, range.length, frameName.length() ? frameName : emptyString(), order };
+
+ foundTextRanges.append(foundTextRange);
+ }
+
+ completionHandler(WTFMove(foundTextRanges));
+}
+
+void WebFoundTextRangeController::decorateTextRangeWithStyle(const WebFoundTextRange& range, FindDecorationStyle style)
+{
+ UNUSED_PARAM(range);
+ UNUSED_PARAM(style);
+}
+
+void WebFoundTextRangeController::scrollTextRangeToVisible(const WebFoundTextRange& range)
+{
+ UNUSED_PARAM(range);
+}
+
+void WebFoundTextRangeController::clearAllDecoratedFoundText()
+{
+
+}
+
+void WebFoundTextRangeController::didBeginTextSearchOperation()
+{
+
+}
+
+void WebFoundTextRangeController::didEndTextSearchOperation()
+{
+
+}
+
+void WebFoundTextRangeController::willMoveToPage(WebCore::PageOverlay&, WebCore::Page* page)
+{
+ UNUSED_PARAM(page);
+}
+
+void WebFoundTextRangeController::didMoveToPage(WebCore::PageOverlay&, WebCore::Page*)
+{
+
+}
+
+bool WebFoundTextRangeController::mouseEvent(WebCore::PageOverlay&, const WebCore::PlatformMouseEvent&)
+{
+ return false;
+}
+
+void WebFoundTextRangeController::drawRect(WebCore::PageOverlay&, WebCore::GraphicsContext& graphicsContext, const WebCore::IntRect& dirtyRect)
+{
+ UNUSED_PARAM(graphicsContext);
+ UNUSED_PARAM(dirtyRect);
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.h (0 => 288732)
--- trunk/Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.h 2022-01-28 07:31:41 UTC (rev 288732)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2022 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
+
+#include "WebFindOptions.h"
+#include "WebFoundTextRange.h"
+#include <WebCore/FindOptions.h>
+#include <WebCore/IntRect.h>
+#include <WebCore/PageOverlay.h>
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+class Document;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class WebFoundTextRangeController : private WebCore::PageOverlay::Client {
+ WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(WebFoundTextRangeController);
+
+public:
+ explicit WebFoundTextRangeController(WebPage&);
+
+ void findTextRangesForStringMatches(const String&, OptionSet<FindOptions>, uint32_t maxMatchCount, CompletionHandler<void(Vector<WebKit::WebFoundTextRange>&&)>&&);
+
+ void decorateTextRangeWithStyle(const WebFoundTextRange&, FindDecorationStyle);
+ void scrollTextRangeToVisible(const WebFoundTextRange&);
+
+ void clearAllDecoratedFoundText();
+
+ void didBeginTextSearchOperation();
+ void didEndTextSearchOperation();
+
+private:
+ // PageOverlay::Client.
+ void willMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override;
+ void didMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override;
+ bool mouseEvent(WebCore::PageOverlay&, const WebCore::PlatformMouseEvent&) override;
+ void drawRect(WebCore::PageOverlay&, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) override;
+
+ WeakPtr<WebPage> m_webPage;
+};
+
+} // namespace WebKit