Bug 509155. Don't store outline structs in the rule tree if outline-color:inherit is set on the root element. r=dbaron
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 10 Aug 2009 10:54:22 -0400
changeset 31285 375b3e7328c7577ba2b3612a7fc9a49eb19682e7
parent 31284 64d9f32cf21e77d58b72db90d552fa4721c169e1
child 31286 2a3fd282e4725dd97763367b42365ad6fbf9dbfd
push id8476
push userbzbarsky@mozilla.com
push dateMon, 10 Aug 2009 16:00:21 +0000
treeherdermozilla-central@1ddf399b4c26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs509155
milestone1.9.2a2pre
Bug 509155. Don't store outline structs in the rule tree if outline-color:inherit is set on the root element. r=dbaron
layout/reftests/bugs/508919-1-ref.xhtml
layout/reftests/bugs/508919-1.xhtml
layout/reftests/bugs/509155-1-ref.xhtml
layout/reftests/bugs/509155-1.xhtml
layout/reftests/bugs/reftest.list
layout/style/crashtests/509155-1.html
layout/style/crashtests/crashtests.list
layout/style/nsRuleNode.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/508919-1-ref.xhtml
@@ -0,0 +1,10 @@
+<html xmlns="http://www.w3.org/1999/xhtml" style="border-color: black">
+  <head>
+    <style>
+      html { color: black; border-width: 10px; border-style: solid; }
+    </style>
+  </head>
+  <body>
+    <html style="border-color: green;">Test</html>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/508919-1.xhtml
@@ -0,0 +1,19 @@
+<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
+  <head>
+    <style>
+      html { color: black; border-color: inherit; border-width: 10px;
+             border-style: solid; }
+    </style>
+    <script>
+      window.addEventListener("load",
+        function() {
+          document.getElementById("x").removeAttribute("style");
+          document.documentElement.className = "";
+        },
+        false);
+    </script>
+  </head>
+  <body style="border-color: green;">
+    <html id="x" style="display:none">Test</html>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/509155-1-ref.xhtml
@@ -0,0 +1,10 @@
+<html xmlns="http://www.w3.org/1999/xhtml" style="outline-color: black;">
+  <head>
+    <style>
+      html { color: black; outline-width: 10px; outline-style: solid; }
+    </style>
+  </head>
+  <body>
+    <html style="outline-color: green;">Test</html>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/509155-1.xhtml
@@ -0,0 +1,19 @@
+<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
+  <head>
+    <style>
+      html { color: black; outline-color: inherit; outline-width: 10px;
+             outline-style: solid; }
+    </style>
+    <script>
+      window.addEventListener("MozReftestInvalidate",
+        function() {
+          document.getElementById("x").removeAttribute("style");
+          document.documentElement.className = "";
+        },
+        false);
+    </script>
+  </head>
+  <body style="outline-color: green;">
+    <html id="x" style="display: none">Test</html>
+  </body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1290,8 +1290,10 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") ==
 == 502447-1.html 502447-1-ref.html
 == 502795-1.html 502795-1-ref.html
 == 503364-1a.html 503364-1-ref.html
 == 503364-1b.html 503364-1-ref.html
 == 504032-1.html 504032-1-ref.html
 == 505743-1.html about:blank
 == 507487-1.html 507487-1-ref.html
 == 507487-2.xhtml 507487-2-ref.xhtml
+== 508919-1.xhtml 508919-1-ref.xhtml
+== 509155-1.xhtml 509155-1-ref.xhtml
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/509155-1.html
@@ -0,0 +1,4 @@
+<html style="outline-color: inherit;">
+<head></head>
+<body></body>
+</html>
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -35,9 +35,10 @@ load 472237-1.html # will fail, test for
 HTTP(..) load 472237-1.html
 load 473720-1.html
 load 473892-1.html
 load 473914-1.html
 load 478321-1.xhtml
 skip load long-url-list-stack-overflow.html # skipped due to being slow (bug 477490)
 load 495269-1.html
 load 495269-2.html
+load 509155-1.html
 load 509156-1.html
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -4658,18 +4658,18 @@ nsRuleNode::ComputeOutlineData(void* aSt
     NS_ASSERTION(marginData.mOutlineOffset.GetUnit() == eCSSUnit_Null,
                  "unexpected unit");
   }
 
   // outline-color: color, string, enum, inherit
   nscolor outlineColor;
   nscolor unused = NS_RGB(0,0,0);
   if (eCSSUnit_Inherit == marginData.mOutlineColor.GetUnit()) {
+    canStoreInRuleTree = PR_FALSE;
     if (parentContext) {
-      canStoreInRuleTree = PR_FALSE;
       if (parentOutline->GetOutlineColor(outlineColor))
         outline->SetOutlineColor(outlineColor);
       else {
 #ifdef GFX_HAS_INVERT
         outline->SetOutlineInitialColor();
 #else
         // We want to inherit the color from the parent, not use the
         // color on the element where this chunk of style data will be