Diff
Modified: trunk/Source/WebKit/ChangeLog (281331 => 281332)
--- trunk/Source/WebKit/ChangeLog 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/ChangeLog 2021-08-20 19:44:41 UTC (rev 281332)
@@ -1,3 +1,26 @@
+2021-08-20 Simon Fraser <[email protected]>
+
+ Change the mysterious uint64_t argument to detectDataInAllFrames() to OptionSet<WebCore::DataDetectorType>
+ https://bugs.webkit.org/show_bug.cgi?id=229304
+
+ Reviewed by Tim Horton.
+
+ We can encode a OptionSet<WebCore::DataDetectorType> in IPC messages now, so do so for DetectDataInAllFrames().
+ Also use OptionSet<WebCore::DataDetectorType> in some cases where WebCore::DataDetectorType was being used
+ to hold a bit set.
+
+ * Shared/API/Cocoa/WKDataDetectorTypesInternal.h:
+ (fromWKDataDetectorTypes):
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _setupPageConfiguration:]):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::detectDataInAllFrames):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::detectDataInAllFrames):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2021-08-19 Simon Fraser <[email protected]>
Use an ObjectIdentifier<> for text checker requests
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (281331 => 281332)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2021-08-20 19:44:41 UTC (rev 281332)
@@ -358,6 +358,7 @@
'"LayerHostingContext.h"': ["PLATFORM(COCOA)", ],
'"GestureTypes.h"': ["PLATFORM(IOS_FAMILY)"],
'<WebCore/MediaPlaybackTargetContext.h>': ["ENABLE(WIRELESS_PLAYBACK_TARGET)"],
+ '<WebCore/DataDetectorType.h>': ["ENABLE(DATA_DETECTION)"],
}
if not header in conditions:
return None
Modified: trunk/Source/WebKit/Shared/API/Cocoa/WKDataDetectorTypesInternal.h (281331 => 281332)
--- trunk/Source/WebKit/Shared/API/Cocoa/WKDataDetectorTypesInternal.h 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/Shared/API/Cocoa/WKDataDetectorTypesInternal.h 2021-08-20 19:44:41 UTC (rev 281332)
@@ -29,24 +29,25 @@
#import <WebCore/DataDetectorType.h>
-static inline WebCore::DataDetectorType fromWKDataDetectorTypes(uint64_t types)
+static inline OptionSet<WebCore::DataDetectorType> fromWKDataDetectorTypes(WKDataDetectorTypes types)
{
- uint32_t value = 0;
+ OptionSet<WebCore::DataDetectorType> result;
if (types & WKDataDetectorTypePhoneNumber)
- value |= static_cast<uint32_t>(WebCore::DataDetectorType::PhoneNumber);
+ result.add(WebCore::DataDetectorType::PhoneNumber);
if (types & WKDataDetectorTypeLink)
- value |= static_cast<uint32_t>(WebCore::DataDetectorType::Link);
+ result.add(WebCore::DataDetectorType::Link);
if (types & WKDataDetectorTypeAddress)
- value |= static_cast<uint32_t>(WebCore::DataDetectorType::Address);
+ result.add(WebCore::DataDetectorType::Address);
if (types & WKDataDetectorTypeCalendarEvent)
- value |= static_cast<uint32_t>(WebCore::DataDetectorType::CalendarEvent);
+ result.add(WebCore::DataDetectorType::CalendarEvent);
if (types & WKDataDetectorTypeTrackingNumber)
- value |= static_cast<uint32_t>(WebCore::DataDetectorType::TrackingNumber);
+ result.add(WebCore::DataDetectorType::TrackingNumber);
if (types & WKDataDetectorTypeFlightNumber)
- value |= static_cast<uint32_t>(WebCore::DataDetectorType::FlightNumber);
+ result.add(WebCore::DataDetectorType::FlightNumber);
if (types & WKDataDetectorTypeLookupSuggestion)
- value |= static_cast<uint32_t>(WebCore::DataDetectorType::LookupSuggestion);
- return static_cast<WebCore::DataDetectorType>(value);
+ result.add(WebCore::DataDetectorType::LookupSuggestion);
+
+ return result;
}
#endif
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (281331 => 281332)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-08-20 19:44:41 UTC (rev 281332)
@@ -526,7 +526,7 @@
pageConfiguration->preferences()->setAttachmentElementEnabled(!![_configuration _attachmentElementEnabled]);
#if ENABLE(DATA_DETECTION) && PLATFORM(IOS_FAMILY)
- pageConfiguration->preferences()->setDataDetectorTypes(static_cast<uint32_t>(fromWKDataDetectorTypes([_configuration dataDetectorTypes])));
+ pageConfiguration->preferences()->setDataDetectorTypes(fromWKDataDetectorTypes([_configuration dataDetectorTypes]).toRaw());
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
pageConfiguration->preferences()->setAllowsAirPlayForMediaPlayback(!![_configuration allowsAirPlayForMediaPlayback]);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (281331 => 281332)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-08-20 19:44:41 UTC (rev 281332)
@@ -10357,13 +10357,13 @@
#if ENABLE(DATA_DETECTION)
-void WebPageProxy::detectDataInAllFrames(WebCore::DataDetectorType types, CompletionHandler<void(const DataDetectionResult&)>&& completionHandler)
+void WebPageProxy::detectDataInAllFrames(OptionSet<WebCore::DataDetectorType> types, CompletionHandler<void(const DataDetectionResult&)>&& completionHandler)
{
if (!hasRunningProcess()) {
completionHandler({ });
return;
}
- sendWithAsyncReply(Messages::WebPage::DetectDataInAllFrames(static_cast<uint64_t>(types)), WTFMove(completionHandler));
+ sendWithAsyncReply(Messages::WebPage::DetectDataInAllFrames(types), WTFMove(completionHandler));
}
void WebPageProxy::removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&& completionHandler)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (281331 => 281332)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-08-20 19:44:41 UTC (rev 281332)
@@ -490,7 +490,7 @@
#if ENABLE(DATA_DETECTION)
NSArray *dataDetectionResults() { return m_dataDetectionResults.get(); }
- void detectDataInAllFrames(WebCore::DataDetectorType, CompletionHandler<void(const DataDetectionResult&)>&&);
+ void detectDataInAllFrames(OptionSet<WebCore::DataDetectorType>, CompletionHandler<void(const DataDetectionResult&)>&&);
void removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&&);
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (281331 => 281332)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-08-20 19:44:41 UTC (rev 281332)
@@ -4062,10 +4062,9 @@
completionHandler({ });
}
-void WebPage::detectDataInAllFrames(uint64_t types, CompletionHandler<void(const DataDetectionResult&)>&& completionHandler)
+void WebPage::detectDataInAllFrames(OptionSet<WebCore::DataDetectorType> dataDetectorTypes, CompletionHandler<void(const DataDetectionResult&)>&& completionHandler)
{
DataDetectionResult mainFrameResult;
- auto dataDetectorTypes = OptionSet<DataDetectorType>::fromRaw(types);
for (auto frame = makeRefPtr(&m_page->mainFrame()); frame; frame = frame->tree().traverseNext()) {
auto document = makeRefPtr(frame->document());
if (!document)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (281331 => 281332)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-08-20 19:44:41 UTC (rev 281332)
@@ -1160,7 +1160,7 @@
#if ENABLE(DATA_DETECTION)
void setDataDetectionResults(NSArray *);
- void detectDataInAllFrames(uint64_t, CompletionHandler<void(const DataDetectionResult&)>&&);
+ void detectDataInAllFrames(OptionSet<WebCore::DataDetectorType>, CompletionHandler<void(const DataDetectionResult&)>&&);
void removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&&);
void handleClickForDataDetectionResult(const WebCore::DataDetectorElementInfo&, const WebCore::IntPoint&);
static std::optional<std::pair<Ref<WebCore::HTMLElement>, WebCore::IntRect>> findDataDetectionResultElementInImageOverlay(const WebCore::FloatPoint& locationInRootView, const WebCore::HTMLElement& host);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (281331 => 281332)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2021-08-20 19:41:33 UTC (rev 281331)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2021-08-20 19:44:41 UTC (rev 281332)
@@ -231,7 +231,7 @@
#endif
#if ENABLE(DATA_DETECTION)
- DetectDataInAllFrames(uint64_t types) -> (struct WebKit::DataDetectionResult result) Async
+ DetectDataInAllFrames(OptionSet<WebCore::DataDetectorType> types) -> (struct WebKit::DataDetectionResult result) Async
RemoveDataDetectedLinks() -> (struct WebKit::DataDetectionResult result) Async
#endif