Bug 452964. Don't flag pseudo-frames wrapping generated content as themselves being generated content, since they might be shared with non-generated content. r+sr=roc.
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 07 Oct 2008 14:53:22 -0400
changeset 20108 305cbf365db22702c7c22fc5b4e6553acea1b139
parent 20107 d28eb3aa049df458ea1c77fa6778624adcd36b1f
child 20109 97d43a4491acb065ec7e7659198c9053946e4caf
push idunknown
push userunknown
push dateunknown
bugs452964
milestone1.9.1b2pre
Bug 452964. Don't flag pseudo-frames wrapping generated content as themselves being generated content, since they might be shared with non-generated content. r+sr=roc.
layout/base/nsCSSFrameConstructor.cpp
layout/reftests/bugs/452964-1-ref.html
layout/reftests/bugs/452964-1.html
layout/reftests/bugs/reftest.list
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3153,16 +3153,19 @@ nsCSSFrameConstructor::GetParentFrame(PR
   nsresult rv = NS_OK;
 
   nsIAtom* parentFrameType = aParentFrameIn.GetType();
   nsIFrame* pseudoParentFrame = nsnull;
   nsPseudoFrames& pseudoFrames = aState.mPseudoFrames;
   aParentFrame = &aParentFrameIn;
   aIsPseudoParent = PR_FALSE;
 
+  nsFrameState savedStateBits  = aState.mAdditionalStateBits;
+  aState.mAdditionalStateBits &= ~NS_FRAME_GENERATED_CONTENT;
+
   if (nsGkAtoms::tableOuterFrame == aChildFrameType) { // table child
     if (IsTableRelated(parentFrameType, PR_TRUE) &&
         (nsGkAtoms::tableCaptionFrame != parentFrameType) ) { // need pseudo cell parent
       rv = GetPseudoCellFrame(aNameSpaceID, aState, aParentFrameIn);
       if (NS_FAILED(rv)) return rv;
       pseudoParentFrame = pseudoFrames.mCellInner.mFrame;
     }
   } 
@@ -3221,16 +3224,17 @@ nsCSSFrameConstructor::GetParentFrame(PR
     }
   }
   
   if (pseudoParentFrame) {
     aParentFrame = pseudoParentFrame;
     aIsPseudoParent = PR_TRUE;
   }
 
+  aState.mAdditionalStateBits = savedStateBits;
   return rv;
 }
 
 static PRBool
 IsSpecialContent(nsIContent*     aContent,
                  nsIAtom*        aTag,
                  PRInt32         aNameSpaceID,
                  nsStyleContext* aStyleContext)
@@ -3407,20 +3411,23 @@ nsCSSFrameConstructor::AdjustParentFrame
   // we're not table-related in any way, we have to create table
   // pseudo-frames so that we have a table cell to live in.
   if (IsTableRelated(aParentFrame->GetType(), PR_FALSE) &&
       (!IsTableRelated(aChildStyle->GetStyleDisplay()->mDisplay, PR_TRUE) ||
        // Also need to create a pseudo-parent if the child is going to end up
        // with a frame based on something other than display.
        childIsSpecialContent || // looked it up before
        IsSpecialContent(aChildContent, aTag, aNameSpaceID, aChildStyle))) {
+    nsFrameState savedStateBits  = aState.mAdditionalStateBits;
+    aState.mAdditionalStateBits &= ~NS_FRAME_GENERATED_CONTENT;
     nsresult rv = GetPseudoCellFrame(aNameSpaceID, aState, *aParentFrame);
     if (NS_FAILED(rv)) {
       return rv;
     }
+    aState.mAdditionalStateBits = savedStateBits;
 
     NS_ASSERTION(aState.mPseudoFrames.mCellInner.mFrame,
                  "Must have inner cell frame now!");
 
     aParentFrame = aState.mPseudoFrames.mCellInner.mFrame;
     aFrameItems = &aState.mPseudoFrames.mCellInner.mChildList;
     // We pushed an anonymous table cell.  The inner block of this
     // needs to become the float containing block.
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/452964-1-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <style>
+      div { display: table; }
+      p { display: table-row; }
+      span { display: table-cell; }
+    </style>
+  </head>
+  <body>
+    <div>
+      <p>
+        <span>Test</span>
+      </p>
+      <p>
+        <span>Col 1</span>
+        <span>Col 2</span>
+      </p>
+    </div>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/452964-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <style>
+      div::before { content: "Test"; }
+      div { display: table; }
+      p { display: table-row; }
+      span { display: table-cell; }
+    </style>
+  </head>
+  <body>
+    <div>
+      <p>
+        <span>Col 1</span>
+        <span>Col 2</span>
+      </p>
+    </div>
+  </body>
+</html>
+        
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -912,12 +912,13 @@ fails == 441259-2.html 441259-2-ref.html
 == 444928-2.html 444928-2-ref.html
 != 444928-3.html 444928-3-notref.html
 # == 448987.html 448987-ref.html  # Disabled for now - it needs privileges
 == 449171-1.html 449171-ref.html
 == 449519-1.html 449519-1-ref.html
 # == 449653-1.html 449653-1-ref.html # Disabled for now - it needs privileges
 == 450670-1.html 450670-1-ref.html
 == 451168-1.html 451168-1-ref.html
+== 452964-1.html 452964-1-ref.html
 == 454361.html about:blank
 == 455280-1.xhtml 455280-1-ref.xhtml
 fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 456147.xul 456147-ref.html # bug 456147, but not caused by it
 == 456484-1.html 456484-1-ref.html