Only override font properties when in quirks mode. (Bug 403524) r=dbaron
authorVitor Menezes <vmenezes@mozilla.com>
Wed, 03 Aug 2011 11:30:58 -0700
changeset 74547 88d8bfd7ef647fcdbac1fdf3d3f819d554599846
parent 74546 225a79ce27bcb6d379b4cd82ee05273ab22bf974
child 74548 5e774f69980eb2706deacd5ad3d065dfca2472b9
push id235
push userbzbarsky@mozilla.com
push dateTue, 27 Sep 2011 17:13:04 +0000
treeherdermozilla-beta@2d1e082d176a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs403524
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Only override font properties when in quirks mode. (Bug 403524) r=dbaron Font tags cause NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL in quirks mode only, so that standards mode (in which font tags don't cause the override) can use the same codepath in the near future.
content/html/content/src/nsHTMLFontElement.cpp
layout/reftests/text-decoration/decoration-color-override-quirks-ref.html
layout/reftests/text-decoration/decoration-color-override-quirks.html
layout/reftests/text-decoration/decoration-color-override-standards-ref.html
layout/reftests/text-decoration/decoration-color-override-standards.html
layout/reftests/text-decoration/reftest.list
--- a/content/html/content/src/nsHTMLFontElement.cpp
+++ b/content/html/content/src/nsHTMLFontElement.cpp
@@ -234,17 +234,18 @@ MapAttributesIntoRule(const nsMappedAttr
       // color: color
       const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
       nscolor color;
       if (value && value->GetColorValue(color)) {
         colorValue->SetColorValue(color);
       }
     }
   }
-  if (aData->mSIDs & NS_STYLE_INHERIT_BIT(TextReset)) {
+  if (aData->mSIDs & NS_STYLE_INHERIT_BIT(TextReset) &&
+      aData->mPresContext->CompatibilityMode() == eCompatibility_NavQuirks) {
     // Make <a><font color="red">text</font></a> give the text a red underline
     // in quirks mode.  The NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL flag only
     // affects quirks mode rendering.
     const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
     nscolor color;
     if (value && value->GetColorValue(color)) {
       nsCSSValue* decoration = aData->ValueForTextDecorationLine();
       PRInt32 newValue = NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL;
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-decoration/decoration-color-override-quirks-ref.html
@@ -0,0 +1,5 @@
+<html>
+	<body>
+		<u>hello</u><img src="http://www.mozilla.org/images/livemarks16.png"><font color="purple"><u>hello</u></font>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-decoration/decoration-color-override-quirks.html
@@ -0,0 +1,5 @@
+<html>
+	<body>
+		<u>hello<img src="http://www.mozilla.org/images/livemarks16.png"><font color="purple">hello</font></u>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-decoration/decoration-color-override-standards-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+	<body>
+		<u>hello<img src="http://www.mozilla.org/images/livemarks16.png"><span style="color: purple;">hello</span></u>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-decoration/decoration-color-override-standards.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+	<body>
+		<u>hello<img src="http://www.mozilla.org/images/livemarks16.png"><font color="purple">hello</font></u>
+	</body>
+</html>
--- a/layout/reftests/text-decoration/reftest.list
+++ b/layout/reftests/text-decoration/reftest.list
@@ -85,9 +85,12 @@ fails-if(Android) fails-if(d2d) == under
 == text-decoration-zorder-1-standards.html text-decoration-zorder-1-ref.html
 fails == text-decoration-zorder-1-quirks.html text-decoration-zorder-1-ref.html # bug 403524
 == table-quirk-1.html table-quirk-1-ref.html
 == table-quirk-2.html table-quirk-2-ref.html
 == text-decoration-propagation-1-quirks.html text-decoration-propagation-1-quirks-ref.html
 fails == text-decoration-propagation-1-standards.html text-decoration-propagation-1-standards-ref.html
 == 641444-1.html 641444-1-ref.html
 == decoration-css21.html decoration-css21-ref.html # bug 403524
+== decoration-color-override-quirks.html decoration-color-override-quirks-ref.html
+== decoration-color-override-standards.html decoration-color-override-standards-ref.html
+!= decoration-color-override-standards-ref.html decoration-color-override-quirks-ref.html
 == decoration-css21-block.html decoration-css21-block-ref.html # bug 403524