Bug 495274. Fix broken selector cloning. r+sr=dbaron
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 28 May 2009 20:41:27 -0400
changeset 28822 da44a9ed6ab25d7424044a0185e1f3e33f4b7565
parent 28821 6b5508397a29a68a8563ad5c514dbbd122420a1b
child 28823 4414591c887fa7483b078a94ea1c9204035927b7
push id7277
push userbzbarsky@mozilla.com
push dateFri, 29 May 2009 00:42:22 +0000
treeherdermozilla-central@da44a9ed6ab2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs495274
milestone1.9.2a1pre
Bug 495274. Fix broken selector cloning. r+sr=dbaron
layout/reftests/bugs/495274-1-ref.html
layout/reftests/bugs/495274-1.html
layout/reftests/bugs/reftest.list
layout/style/nsCSSStyleRule.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/495274-1-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <style>body { color: green; }</style>
+  </head>
+  <body>
+    This text should be green
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/495274-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <style>body { color: green; }</style>
+    <link rel="stylesheet" href='data:text/css,body > span { color: red }' type="text/css"/>
+    <link rel="stylesheet" href='data:text/css,body > span { color: red }' type="text/css"/>
+    <script>
+      // Force cloning of the second linked sheet
+      document.styleSheets[2].cssRules[0];
+    </script>
+  </head>
+  <body>
+    <div><span>This text should be green</span></div>
+  </body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1237,8 +1237,9 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") ==
 == 490182-1a.html 490182-1-ref.html
 == 490182-1b.html 490182-1-ref.html
 == 490173-1.html 490173-1-ref.html
 == 490173-2.html 490173-2-ref.html
 == 491323-1.xul 491323-1-ref.xul
 == 493968-1.html 493968-1-ref.html
 == 494667-1.html 494667-1-ref.html
 == 494667-2.html 494667-2-ref.html
+== 495274-1.html 495274-1-ref.html
--- a/layout/style/nsCSSStyleRule.cpp
+++ b/layout/style/nsCSSStyleRule.cpp
@@ -275,16 +275,17 @@ nsCSSSelector*
 nsCSSSelector::Clone(PRBool aDeepNext, PRBool aDeepNegations) const
 {
   nsCSSSelector *result = new nsCSSSelector();
   if (!result)
     return nsnull;
 
   result->mNameSpace = mNameSpace;
   result->mTag = mTag;
+  result->mOperator = mOperator;
   
   NS_IF_CLONE(mIDList);
   NS_IF_CLONE(mClassList);
   NS_IF_CLONE(mPseudoClassList);
   NS_IF_CLONE(mAttrList);
 
   // No need to worry about multiple levels of recursion since an
   // mNegations can't have an mNext.