Title: [214697] trunk
- Revision
- 214697
- Author
- [email protected]
- Date
- 2017-03-31 16:33:24 -0700 (Fri, 31 Mar 2017)
Log Message
REGRESSION (r202472): Data Detection overwrites existing links in detected ranges
https://bugs.webkit.org/show_bug.cgi?id=170365
<rdar://problem/29205721>
Reviewed by Tim Horton.
Source/WebCore:
r202472 changed the node traversal in searchForLinkRemovingExistingDDLinks() to only
consider nodes that are descendants of startNode, but we need to traverse all nodes between
startNode and endNode to find existing non-DD links.
As a result, we'd add a Data Detector link to the following snippet and make the original
links un-clickable:
<a href=''>tomorrow</a> <a href=''>night</a>
Fix this by not specifying a stayWithin node when calling NodeTraversal::next(). The loop
will terminate when we reach endNode.
Updated WebKit2.DataDetectionReferenceDate API test.
* editing/cocoa/DataDetection.mm:
(WebCore::searchForLinkRemovingExistingDDLinks):
Tools:
* TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm:
(expectLinkCount): Changed to only query links with the x-apple-data-detectors attribute.
(TEST): Re-enabled the test, which now passes.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (214696 => 214697)
--- trunk/Source/WebCore/ChangeLog 2017-03-31 23:19:11 UTC (rev 214696)
+++ trunk/Source/WebCore/ChangeLog 2017-03-31 23:33:24 UTC (rev 214697)
@@ -1,3 +1,28 @@
+2017-03-31 Andy Estes <[email protected]>
+
+ REGRESSION (r202472): Data Detection overwrites existing links in detected ranges
+ https://bugs.webkit.org/show_bug.cgi?id=170365
+ <rdar://problem/29205721>
+
+ Reviewed by Tim Horton.
+
+ r202472 changed the node traversal in searchForLinkRemovingExistingDDLinks() to only
+ consider nodes that are descendants of startNode, but we need to traverse all nodes between
+ startNode and endNode to find existing non-DD links.
+
+ As a result, we'd add a Data Detector link to the following snippet and make the original
+ links un-clickable:
+
+ <a href=''>tomorrow</a> <a href=''>night</a>
+
+ Fix this by not specifying a stayWithin node when calling NodeTraversal::next(). The loop
+ will terminate when we reach endNode.
+
+ Updated WebKit2.DataDetectionReferenceDate API test.
+
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::searchForLinkRemovingExistingDDLinks):
+
2017-03-31 Eric Carlson <[email protected]>
Incoming video source doesn't propogate frame rotation
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (214696 => 214697)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2017-03-31 23:19:11 UTC (rev 214696)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2017-03-31 23:33:24 UTC (rev 214697)
@@ -274,7 +274,7 @@
static bool searchForLinkRemovingExistingDDLinks(Node& startNode, Node& endNode, bool& didModifyDOM)
{
didModifyDOM = false;
- for (Node* node = &startNode; node; node = NodeTraversal::next(*node, &startNode)) {
+ for (Node* node = &startNode; node; node = NodeTraversal::next(*node)) {
if (is<HTMLAnchorElement>(*node)) {
auto& anchor = downcast<HTMLAnchorElement>(*node);
if (!equalIgnoringASCIICase(anchor.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true"))
Modified: trunk/Tools/ChangeLog (214696 => 214697)
--- trunk/Tools/ChangeLog 2017-03-31 23:19:11 UTC (rev 214696)
+++ trunk/Tools/ChangeLog 2017-03-31 23:33:24 UTC (rev 214697)
@@ -1,3 +1,15 @@
+2017-03-31 Andy Estes <[email protected]>
+
+ REGRESSION (r202472): Data Detection overwrites existing links in detected ranges
+ https://bugs.webkit.org/show_bug.cgi?id=170365
+ <rdar://problem/29205721>
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm:
+ (expectLinkCount): Changed to only query links with the x-apple-data-detectors attribute.
+ (TEST): Re-enabled the test, which now passes.
+
2017-03-31 Tim Horton <[email protected]>
Mail can get stuck underneath FindController::findStringMatches after searching in a long message
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm (214696 => 214697)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm 2017-03-31 23:19:11 UTC (rev 214696)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm 2017-03-31 23:33:24 UTC (rev 214697)
@@ -60,7 +60,7 @@
[webView loadHTMLString:HTMLString baseURL:nil];
[webView _test_waitForDidFinishNavigation];
- [webView evaluateJavaScript:@"document.getElementsByTagName('a').length" completionHandler:^(id value, NSError *error) {
+ [webView evaluateJavaScript:@"document.querySelectorAll('a[x-apple-data-detectors=true]').length" completionHandler:^(id value, NSError *error) {
EXPECT_EQ(linkCount, [value unsignedIntValue]);
ranScript = true;
}];
@@ -69,7 +69,7 @@
ranScript = false;
}
-TEST(WebKit2, DISABLED_DataDetectionReferenceDate)
+TEST(WebKit2, DataDetectionReferenceDate)
{
RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
[configuration setDataDetectorTypes:WKDataDetectorTypeCalendarEvent];
@@ -81,7 +81,10 @@
expectLinkCount(webView.get(), @"tomorrow at 6PM", 1);
expectLinkCount(webView.get(), @"yesterday at 6PM", 0);
+ expectLinkCount(webView.get(), @"<a href=''>tomorrow at 6PM</a>", 0);
+ expectLinkCount(webView.get(), @"<a href=''>tomorrow</a> at <a href=''>6PM</a>", 0);
+
NSTimeInterval week = 60 * 60 * 24 * 7;
[UIDelegate setReferenceDate:[NSDate dateWithTimeIntervalSinceNow:-week]];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes