Bug 1266948 - text-decoration-color: currentcolor should not use value from -webkit-text-fill-color; draft
authorCJKu <cku@mozilla.com>
Tue, 26 Apr 2016 23:56:44 +0800
changeset 356563 14f533ae64110812db0c794a90aafa1f7bb2c2a5
parent 356464 9ce31e9f90cb0e534611b0f617c5bbc232ffe748
child 519431 dddbe119cc4021e932c78212989c42a5c38c3385
push id16546
push usercku@mozilla.com
push dateTue, 26 Apr 2016 17:06:20 +0000
bugs1266948
milestone49.0a1
Bug 1266948 - text-decoration-color: currentcolor should not use value from -webkit-text-fill-color; MozReview-Commit-ID: 2SfENZieSzQ
accessible/base/TextAttrs.cpp
layout/generic/nsTextFrame.cpp
layout/style/StyleAnimationValue.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsRuleNode.cpp
layout/xul/nsTextBoxFrame.cpp
testing/web-platform/tests/compat/webkit-text-fill-color-property-005-ref.html
testing/web-platform/tests/compat/webkit-text-fill-color-property-005.html
--- a/accessible/base/TextAttrs.cpp
+++ b/accessible/base/TextAttrs.cpp
@@ -697,17 +697,17 @@ TextAttrsMgr::TextDecorValue::
   TextDecorValue(nsIFrame* aFrame)
 {
   const nsStyleTextReset* textReset = aFrame->StyleTextReset();
   mStyle = textReset->GetDecorationStyle();
 
   bool isForegroundColor = false;
   textReset->GetDecorationColor(mColor, isForegroundColor);
   if (isForegroundColor)
-    mColor = aFrame->StyleContext()->GetTextFillColor();
+    mColor = aFrame->StyleColor()->mColor;
 
   mLine = textReset->mTextDecorationLine &
     (NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE |
      NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH);
 }
 
 TextAttrsMgr::TextDecorTextAttr::
   TextDecorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame) :
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -425,28 +425,16 @@ static void
 DestroyUserData(void* aUserData)
 {
   TextRunUserData* userData = static_cast<TextRunUserData*>(aUserData);
   if (userData) {
     free(userData);
   }
 }
 
-static nsCSSProperty
-GetTextDecorationColorProp(nsStyleContext* aCtx)
-{
-  nscolor textColor;
-  bool foreground;
-  aCtx->StyleTextReset()->GetDecorationColor(textColor, foreground);
-
-  return (foreground && !aCtx->StyleText()->mWebkitTextFillColorForeground)
-         ? eCSSProperty__webkit_text_fill_color
-         : eCSSProperty_text_decoration_color;
-}
-
 /**
  * Remove |aTextRun| from the frame continuation chain starting at
  * |aStartContinuation| if non-null, otherwise starting at |aFrame|.
  * Unmark |aFrame| as a text run owner if it's the frame we start at.
  * Return true if |aStartContinuation| is non-null and was found
  * in the next-continuation chain of |aFrame|.
  */
 static bool
@@ -5004,17 +4992,17 @@ nsTextFrame::GetTextDecorations(
     const uint8_t textDecorations = styleText->mTextDecorationLine;
 
     if (!useOverride &&
         (NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL & textDecorations)) {
       // This handles the <a href="blah.html"><font color="green">La 
       // la la</font></a> case. The link underline should be green.
       useOverride = true;
       overrideColor =
-        nsLayoutUtils::GetColor(f, GetTextDecorationColorProp(context));
+        nsLayoutUtils::GetColor(f, eCSSProperty_text_decoration_color);
     }
 
     nsBlockFrame* fBlock = nsLayoutUtils::GetAsBlock(f);
     const bool firstBlock = !nearestBlockFound && fBlock;
 
     // Not updating positions once we hit a parent block is equivalent to
     // the CSS 2.1 spec that blocks should propagate decorations down to their
     // children (albeit the style should be preserved)
@@ -5061,17 +5049,17 @@ nsTextFrame::GetTextDecorations(
         //     text-decoration-color has its initial value currentColor.
         //     We could choose to interpret currentColor as "currentFill"
         //     for SVG text, and have e.g. text-decoration-color:red to
         //     override the fill paint of the decoration.
         color = aColorResolution == eResolvedColors ?
                   nsLayoutUtils::GetColor(f, eCSSProperty_fill) :
                   NS_SAME_AS_FOREGROUND_COLOR;
       } else {
-        color = nsLayoutUtils::GetColor(f, GetTextDecorationColorProp(context));
+        color = nsLayoutUtils::GetColor(f, eCSSProperty_text_decoration_color);
       }
 
       bool swapUnderlineAndOverline = vertical && IsUnderlineRight(f);
       const uint8_t kUnderline =
         swapUnderlineAndOverline ? NS_STYLE_TEXT_DECORATION_LINE_OVERLINE :
                                    NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
       const uint8_t kOverline =
         swapUnderlineAndOverline ? NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE :
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -3600,17 +3600,17 @@ StyleAnimationValue::ExtractComputedValu
 
         case eCSSProperty_text_decoration_color: {
           const nsStyleTextReset *styleTextReset =
             static_cast<const nsStyleTextReset*>(styleStruct);
           nscolor color;
           bool isForeground;
           styleTextReset->GetDecorationColor(color, isForeground);
           if (isForeground) {
-            color = aStyleContext->GetTextFillColor();
+            color = aStyleContext->StyleColor()->mColor;
           }
           aComputedValue.SetColorValue(color);
           break;
         }
 
         case eCSSProperty_text_decoration_style: {
           uint8_t decorationStyle =
             static_cast<const nsStyleTextReset*>(styleStruct)->
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -3622,17 +3622,17 @@ already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetTextDecorationColor()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   nscolor color;
   bool isForeground;
   StyleTextReset()->GetDecorationColor(color, isForeground);
   if (isForeground) {
-    color = mStyleContext->GetTextFillColor();
+    color = StyleColor()->mColor;
   }
 
   SetToRGBAColor(val, color);
 
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -4808,17 +4808,17 @@ nsRuleNode::ComputeTextResetData(void* a
     aRuleData->ValueForTextDecorationColor();
   nscolor decorationColor;
   if (eCSSUnit_Inherit == decorationColorValue->GetUnit()) {
     conditions.SetUncacheable();
     if (parentContext) {
       bool isForeground;
       parentText->GetDecorationColor(decorationColor, isForeground);
       if (isForeground) {
-        text->SetDecorationColor(parentContext->GetTextFillColor());
+        text->SetDecorationColor(parentContext->StyleColor()->mColor);
       } else {
         text->SetDecorationColor(decorationColor);
       }
     } else {
       text->SetDecorationColorToForeground();
     }
   }
   else if (eCSSUnit_EnumColor == decorationColorValue->GetUnit() &&
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -423,17 +423,17 @@ nsTextBoxFrame::DrawText(nsRenderingCont
       if (decorMask & styleText->mTextDecorationLine) {  // a decoration defined here
         nscolor color;
         if (aOverrideColor) {
           color = *aOverrideColor;
         } else {
           bool isForeground;
           styleText->GetDecorationColor(color, isForeground);
           if (isForeground) {
-            color = nsLayoutUtils::GetColor(f, context->GetTextFillColorProp());
+            color = nsLayoutUtils::GetColor(f, eCSSProperty_color);
           }
         }
         uint8_t style = styleText->GetDecorationStyle();
 
         if (NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE & decorMask &
               styleText->mTextDecorationLine) {
           underColor = color;
           underStyle = style;
--- a/testing/web-platform/tests/compat/webkit-text-fill-color-property-005-ref.html
+++ b/testing/web-platform/tests/compat/webkit-text-fill-color-property-005-ref.html
@@ -1,13 +1,15 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
 <title>webkit-text-fill-color on text-decoration underline reference</title>
 <link rel="author" title="Jeremy Chen" href="jeremychen@mozilla.com">
 <link rel="author" title="Mozilla" href="https://www.mozilla.org">
 <style type="text/css">
 p {
-  font-size: 50px;
+  color: green;
+}
+p.underline {
   text-decoration: underline;
-  color: green;
 }
 </style>
 <div><p>Pass if text underline is green!!!</p></div>
+<div><p class="underline">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></div>
--- a/testing/web-platform/tests/compat/webkit-text-fill-color-property-005.html
+++ b/testing/web-platform/tests/compat/webkit-text-fill-color-property-005.html
@@ -1,17 +1,19 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
-<title>webkit-text-fill-color should take effect while rendering text-decoration underline</title>
+<title>webkit-text-fill-color should not take effect while rendering text-decoration underline</title>
 <link rel="author" title="Jeremy Chen" href="jeremychen@mozilla.com">
 <link rel="author" title="Mozilla" href="https://www.mozilla.org">
 <link rel="help" href="https://compat.spec.whatwg.org/#the-webkit-text-fill-color">
 <meta name="assert" content="The color of text-decoration underline should be green">
 <link rel="match" href="webkit-text-fill-color-property-005-ref.html">
 <style type="text/css">
 p {
-  font-size: 50px;
+  color: green;
+}
+p.underline {
   text-decoration: underline;
-  color: red;
-  -webkit-text-fill-color: green;
+  -webkit-text-fill-color: red
 }
 </style>
 <div><p>Pass if text underline is green!!!</p></div>
+<div><p class="underline">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></div>