Diff
Modified: trunk/Source/WebCore/ChangeLog (198863 => 198864)
--- trunk/Source/WebCore/ChangeLog 2016-03-30 23:06:44 UTC (rev 198863)
+++ trunk/Source/WebCore/ChangeLog 2016-03-30 23:09:41 UTC (rev 198864)
@@ -1,3 +1,19 @@
+2016-03-30 Enrica Casucci <[email protected]>
+
+ Add a style for Data Detectors links.
+ https://bugs.webkit.org/show_bug.cgi?id=155996
+ rdar://problem/25343514
+
+ Reviewed by Sam Weinig.
+
+ Based on indication from the data detection engine,
+ we style some of the links differently.
+
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::DataDetection::detectContentInRange):
+ * platform/cocoa/DataDetectorsCoreSoftLink.h:
+ * platform/cocoa/DataDetectorsCoreSoftLink.mm:
+
2016-03-30 Myles C. Maxfield <[email protected]>
[OS X] [RTL Scrollbars] Overlay RTL scrollbars animate in from the wrong side
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (198863 => 198864)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-03-30 23:06:44 UTC (rev 198863)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-03-30 23:09:41 UTC (rev 198864)
@@ -49,9 +49,10 @@
#import <WebKitAdditions/DataDetectorsAdditions.h>
#endif
-const char *dataDetectorsURLScheme = "x-apple-data-detectors";
-const char *dataDetectorsAttributeTypeKey = "x-apple-data-detectors-type";
-const char *dataDetectorsAttributeResultKey = "x-apple-data-detectors-result";
+const char* dataDetectorsURLScheme = "x-apple-data-detectors";
+const char* dataDetectorsAttributeTypeKey = "x-apple-data-detectors-type";
+const char* dataDetectorsAttributeResultKey = "x-apple-data-detectors-result";
+const char* dataDetectorsLinkStyle = "-webkit-text-decoration-color:rgb(199, 199, 204); color:initial;";
namespace WebCore {
@@ -575,6 +576,7 @@
}
lastModifiedQueryOffset = queryRange.end;
+ BOOL shouldUseLightLinks = softLink_DataDetectorsCore_DDShouldUseLightLinksForResult(coreResult, [indexPaths[resultIndex] length] > 1);
for (auto& range : resultRanges) {
Node* parentNode = range->startContainer().parentNode();
@@ -605,10 +607,13 @@
RefPtr<HTMLAnchorElement> anchorElement = HTMLAnchorElement::create(document);
anchorElement->setHref(correspondingURL);
anchorElement->setDir("ltr");
- RefPtr<Attr> color = downcast<Element>(parentNode)->getAttributeNode("color");
- if (color)
- anchorElement->setAttribute(HTMLNames::styleAttr, color->style()->cssText());
-
+ if (shouldUseLightLinks)
+ anchorElement->setAttribute(HTMLNames::styleAttr, dataDetectorsLinkStyle);
+ else {
+ RefPtr<Attr> color = downcast<Element>(parentNode)->getAttributeNode("color");
+ if (color)
+ anchorElement->setAttribute(HTMLNames::styleAttr, color->style()->cssText());
+ }
anchorElement->Node::appendChild(newNode, ASSERT_NO_EXCEPTION);
parentNode->insertBefore(anchorElement, ¤tTextNode, ASSERT_NO_EXCEPTION);
// Add a special attribute to mark this URLification as the result of data detectors.
Modified: trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h (198863 => 198864)
--- trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h 2016-03-30 23:06:44 UTC (rev 198863)
+++ trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h 2016-03-30 23:09:41 UTC (rev 198864)
@@ -51,6 +51,7 @@
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDURLTapAndHoldSchemes, NSArray *, (), ())
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForURL, BOOL, (NSURL *url), (url))
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForResult, BOOL, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldUseLightLinksForResult, BOOL, (DDResultRef result, BOOL extractedFromSignature), (result, extractedFromSignature))
SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)
SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderWebURLKey, CFStringRef)
SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderMailURLKey, CFStringRef)
Modified: trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm (198863 => 198864)
--- trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm 2016-03-30 23:06:44 UTC (rev 198863)
+++ trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm 2016-03-30 23:09:41 UTC (rev 198864)
@@ -50,6 +50,7 @@
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDURLTapAndHoldSchemes, NSArray *, (), ())
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForURL, BOOL, (NSURL *url), (url))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForResult, BOOL, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldUseLightLinksForResult, BOOL, (DDResultRef result, BOOL extractedFromSignature), (result, extractedFromSignature))
SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)
SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderWebURLKey, CFStringRef)
SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderMailURLKey, CFStringRef)