Changeset 198864 in webkit


Ignore:
Timestamp:
Mar 30, 2016 4:09:41 PM (8 years ago)
Author:
enrica@apple.com
Message:

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:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r198859 r198864  
     12016-03-30  Enrica Casucci  <enrica@apple.com>
     2
     3        Add a style for Data Detectors links.
     4        https://bugs.webkit.org/show_bug.cgi?id=155996
     5        rdar://problem/25343514
     6
     7        Reviewed by Sam Weinig.
     8
     9        Based on indication from the data detection engine,
     10        we style some of the links differently.
     11
     12        * editing/cocoa/DataDetection.mm:
     13        (WebCore::DataDetection::detectContentInRange):
     14        * platform/cocoa/DataDetectorsCoreSoftLink.h:
     15        * platform/cocoa/DataDetectorsCoreSoftLink.mm:
     16
    1172016-03-30  Myles C. Maxfield  <mmaxfield@apple.com>
    218
  • trunk/Source/WebCore/editing/cocoa/DataDetection.mm

    r198684 r198864  
    5050#endif
    5151
    52 const char *dataDetectorsURLScheme = "x-apple-data-detectors";
    53 const char *dataDetectorsAttributeTypeKey = "x-apple-data-detectors-type";
    54 const char *dataDetectorsAttributeResultKey = "x-apple-data-detectors-result";
     52const char* dataDetectorsURLScheme = "x-apple-data-detectors";
     53const char* dataDetectorsAttributeTypeKey = "x-apple-data-detectors-type";
     54const char* dataDetectorsAttributeResultKey = "x-apple-data-detectors-result";
     55const char* dataDetectorsLinkStyle = "-webkit-text-decoration-color:rgb(199, 199, 204); color:initial;";
    5556
    5657namespace WebCore {
     
    576577       
    577578        lastModifiedQueryOffset = queryRange.end;
     579        BOOL shouldUseLightLinks = softLink_DataDetectorsCore_DDShouldUseLightLinksForResult(coreResult, [indexPaths[resultIndex] length] > 1);
    578580
    579581        for (auto& range : resultRanges) {
     
    606608            anchorElement->setHref(correspondingURL);
    607609            anchorElement->setDir("ltr");
    608             RefPtr<Attr> color = downcast<Element>(parentNode)->getAttributeNode("color");
    609             if (color)
    610                 anchorElement->setAttribute(HTMLNames::styleAttr, color->style()->cssText());
    611            
     610            if (shouldUseLightLinks)
     611                anchorElement->setAttribute(HTMLNames::styleAttr, dataDetectorsLinkStyle);
     612            else {
     613                RefPtr<Attr> color = downcast<Element>(parentNode)->getAttributeNode("color");
     614                if (color)
     615                    anchorElement->setAttribute(HTMLNames::styleAttr, color->style()->cssText());
     616            }
    612617            anchorElement->Node::appendChild(newNode, ASSERT_NO_EXCEPTION);
    613618            parentNode->insertBefore(anchorElement, &currentTextNode, ASSERT_NO_EXCEPTION);
  • trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h

    r198653 r198864  
    5252SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForURL, BOOL, (NSURL *url), (url))
    5353SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForResult, BOOL, (DDResultRef result), (result))
     54SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldUseLightLinksForResult, BOOL, (DDResultRef result, BOOL extractedFromSignature), (result, extractedFromSignature))
    5455SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)
    5556SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderWebURLKey, CFStringRef)
  • trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm

    r198653 r198864  
    5151SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForURL, BOOL, (NSURL *url), (url))
    5252SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForResult, BOOL, (DDResultRef result), (result))
     53SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldUseLightLinksForResult, BOOL, (DDResultRef result, BOOL extractedFromSignature), (result, extractedFromSignature))
    5354SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)
    5455SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderWebURLKey, CFStringRef)
Note: See TracChangeset for help on using the changeset viewer.