Title: [230713] trunk/Source/WebCore
- Revision
- 230713
- Author
- ddkil...@apple.com
- Date
- 2018-04-17 09:28:33 -0700 (Tue, 17 Apr 2018)
Log Message
Implement checked cast for DDResultRef once DDResultGetTypeID() is available
<https://webkit.org/b/184554>
<rdar://problem/36241894>
Reviewed by Brent Fulgham.
* editing/cocoa/DataDetection.mm:
(WebCore::detectItemAtPositionWithRange): Implement checked cast
for DDResultRef.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (230712 => 230713)
--- trunk/Source/WebCore/ChangeLog 2018-04-17 16:22:49 UTC (rev 230712)
+++ trunk/Source/WebCore/ChangeLog 2018-04-17 16:28:33 UTC (rev 230713)
@@ -1,3 +1,15 @@
+2018-04-17 David Kilzer <ddkil...@apple.com>
+
+ Implement checked cast for DDResultRef once DDResultGetTypeID() is available
+ <https://webkit.org/b/184554>
+ <rdar://problem/36241894>
+
+ Reviewed by Brent Fulgham.
+
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::detectItemAtPositionWithRange): Implement checked cast
+ for DDResultRef.
+
2018-04-17 Said Abou-Hallawa <sabouhall...@apple.com>
Animated GIF imagery with finite looping are falling one loop short
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (230712 => 230713)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2018-04-17 16:22:49 UTC (rev 230712)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2018-04-17 16:28:33 UTC (rev 230713)
@@ -50,10 +50,15 @@
#import "VisibleUnits.h"
#import <pal/spi/ios/DataDetectorsUISPI.h>
#import <pal/spi/mac/DataDetectorsSPI.h>
+#import <wtf/cf/TypeCastsCF.h>
#import <wtf/text/StringBuilder.h>
#import "DataDetectorsCoreSoftLink.h"
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+WTF_DECLARE_CF_TYPE_TRAIT(DDResult);
+#endif
+
namespace WebCore {
using namespace HTMLNames;
@@ -78,8 +83,11 @@
RefPtr<Range> mainResultRange;
CFIndex resultCount = CFArrayGetCount(results.get());
for (CFIndex i = 0; i < resultCount; i++) {
- // FIXME: <rdar://problem/36241894> Implement checked cast for DDResultRef once DDResultGetTypeID() is available
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+ DDResultRef result = checked_cf_cast<DDResultRef>(CFArrayGetValueAtIndex(results.get(), i));
+#else
DDResultRef result = static_cast<DDResultRef>(const_cast<CF_BRIDGED_TYPE(id) void*>(CFArrayGetValueAtIndex(results.get(), i)));
+#endif
CFRange resultRangeInContext = DDResultGetRange(result);
if (hitLocation >= resultRangeInContext.location && (hitLocation - resultRangeInContext.location) < resultRangeInContext.length) {
mainResult = result;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes