Bug 577450. Replicated fixed-pos frames should have the right style. r=roc, a=roc
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 14 Jan 2011 10:34:39 -0500
changeset 60510 14ef222c8a3948feebdffbffba96ece120752396
parent 60509 99f9134a3439fdbed0fcf42ec40170c2f1ef384a
child 60511 5aebaa05234c714af26c4b282ca057094d6bde8c
push id18029
push userbzbarsky@mozilla.com
push dateFri, 14 Jan 2011 15:36:19 +0000
treeherdermozilla-central@14ef222c8a39 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, roc
bugs577450
milestone2.0b10pre
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
Bug 577450. Replicated fixed-pos frames should have the right style. r=roc, a=roc
layout/base/nsCSSFrameConstructor.cpp
layout/reftests/printing/577450-1-ref.html
layout/reftests/printing/577450-1.html
layout/reftests/printing/reftest.list
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8786,19 +8786,39 @@ nsCSSFrameConstructor::ReplicateFixedFra
   // Iterate across fixed frames and replicate each whose placeholder is a
   // descendant of aFrame. (We don't want to explicitly copy placeholders that
   // are within fixed frames, because that would cause duplicates on the new
   // page - bug 389619)
   for (nsIFrame* fixed = firstFixed; fixed; fixed = fixed->GetNextSibling()) {
     nsIFrame* prevPlaceholder = mPresShell->FrameManager()->GetPlaceholderFrameFor(fixed);
     if (prevPlaceholder &&
         nsLayoutUtils::IsProperAncestorFrame(prevCanvasFrame, prevPlaceholder)) {
-      nsresult rv = ConstructFrame(state, fixed->GetContent(),
-                                   canvasFrame, fixedPlaceholders);
-      NS_ENSURE_SUCCESS(rv, rv);
+      // We want to use the same style as the primary style frame for
+      // our content
+      nsIContent* content = fixed->GetContent();
+      nsStyleContext* styleContext =
+        nsLayoutUtils::GetStyleFrame(content->GetPrimaryFrame())->
+          GetStyleContext();
+      FrameConstructionItemList items;
+      AddFrameConstructionItemsInternal(state, content, canvasFrame,
+                                        content->Tag(),
+                                        content->GetNameSpaceID(),
+                                        PR_TRUE,
+                                        styleContext,
+                                        ITEM_ALLOW_XBL_BASE |
+                                          ITEM_ALLOW_PAGE_BREAK,
+                                        items);
+      for (FCItemIterator iter(items); !iter.IsDone(); iter.Next()) {
+        NS_ASSERTION(iter.item().DesiredParentType() ==
+                       GetParentType(canvasFrame),
+                     "This is not going to work");
+        nsresult rv =
+          ConstructFramesFromItem(state, iter, canvasFrame, fixedPlaceholders);
+        NS_ENSURE_SUCCESS(rv, rv);
+      }
     }
   }
 
   // Add the placeholders to our primary child list.
   // XXXbz this is a little screwed up, since the fixed frames will have 
   // broken auto-positioning. Oh, well.
   NS_ASSERTION(!canvasFrame->GetFirstChild(nsnull),
                "leaking frames; doc root continuation must be empty");
new file mode 100644
--- /dev/null
+++ b/layout/reftests/printing/577450-1-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html class="reftest-print">
+  <body>
+    <div style="position: fixed; color: green; font-size: 2em">Big green text</div>
+    <!-- force two pages -->
+    <div style="height: 3in; width: 2in"></div>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/printing/577450-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html class="reftest-print">
+  <body style="color: green; font-size: 2em">
+    <div style="position: fixed">Big green text</div>
+    <!-- force two pages -->
+    <div style="height: 3in; width: 2in"></div>
+  </body>
+</html>
--- a/layout/reftests/printing/reftest.list
+++ b/layout/reftests/printing/reftest.list
@@ -4,8 +4,9 @@
 # Bugs
 == 272830-1.html 272830-1-ref.html
 == 318022-1.html 318022-1-ref.html
 == 403669-1.html 403669-1-ref.html
 == 381497-n.html 381497-f.html
 == test-async-print.html 272830-1-ref.html
 == 129941-1a.html 129941-1-ref.html
 == 129941-1b.html 129941-1-ref.html
+== 577450-1.html 577450-1-ref.html