Title: [200331] trunk/Source/WebCore
- Revision
- 200331
- Author
- wei...@apple.com
- Date
- 2016-05-02 12:33:28 -0700 (Mon, 02 May 2016)
Log Message
DataDetector underline color should be based on the text color
https://bugs.webkit.org/show_bug.cgi?id=157272
Fixes:
<rdar://problem/25663930> DataDetectors links should use the default text color for their parent nodes
<rdar://problem/25663983> DataDetectors links underline color update
Reviewed by Tim Horton.
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::detectContentInRange):
When using light links, use the color of the parent element as the text color, and that same color with
20% alpha as the underline color.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (200330 => 200331)
--- trunk/Source/WebCore/ChangeLog 2016-05-02 19:08:47 UTC (rev 200330)
+++ trunk/Source/WebCore/ChangeLog 2016-05-02 19:33:28 UTC (rev 200331)
@@ -1,3 +1,19 @@
+2016-05-02 Sam Weinig <s...@webkit.org>
+
+ DataDetector underline color should be based on the text color
+ https://bugs.webkit.org/show_bug.cgi?id=157272
+
+ Fixes:
+ <rdar://problem/25663930> DataDetectors links should use the default text color for their parent nodes
+ <rdar://problem/25663983> DataDetectors links underline color update
+
+ Reviewed by Tim Horton.
+
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::DataDetection::detectContentInRange):
+ When using light links, use the color of the parent element as the text color, and that same color with
+ 20% alpha as the underline color.
+
2016-05-01 Ryosuke Niwa <rn...@webkit.org>
document.currentScript must be null when we're executing a script inside a shadow tree
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (200330 => 200331)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-05-02 19:08:47 UTC (rev 200330)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-05-02 19:33:28 UTC (rev 200331)
@@ -53,8 +53,6 @@
#import <WebKitAdditions/DataDetectorsAdditions.h>
#endif
-const char* dataDetectorsLinkStyle = "-webkit-text-decoration-color:rgb(199, 199, 204); color:initial;";
-
namespace WebCore {
using namespace HTMLNames;
@@ -635,9 +633,19 @@
Ref<HTMLAnchorElement> anchorElement = HTMLAnchorElement::create(document);
anchorElement->setHref(correspondingURL);
anchorElement->setDir("ltr");
- if (shouldUseLightLinks)
- anchorElement->setAttribute(styleAttr, dataDetectorsLinkStyle);
- else if (is<StyledElement>(*parentNode)) {
+ if (shouldUseLightLinks) {
+ document.updateStyleIfNeeded();
+ auto* renderStyle = parentNode->computedStyle();
+ if (renderStyle) {
+ auto textColor = renderStyle->visitedDependentColor(CSSPropertyColor);
+ if (textColor.isValid()) {
+ auto underlineColor = Color(colorWithOverrideAlpha(textColor.rgb(), 0.2));
+
+ anchorElement->setInlineStyleProperty(CSSPropertyColor, textColor.cssText());
+ anchorElement->setInlineStyleProperty(CSSPropertyWebkitTextDecorationColor, underlineColor.cssText());
+ }
+ }
+ } else if (is<StyledElement>(*parentNode)) {
if (auto* style = downcast<StyledElement>(*parentNode).presentationAttributeStyle()) {
String color = style->getPropertyValue(CSSPropertyColor);
if (!color.isEmpty())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes