diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index e5e2601a58a5..67fb1b5845cf 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1136,12 +1136,18 @@ public: ~nsFrameConstructorState(); // Function to push the existing absolute containing block state and - // create a new scope. + // create a new scope. Code that uses this function should get matching + // logic in GetAbsoluteContainingBlock. void PushAbsoluteContainingBlock(nsIFrame* aNewAbsoluteContainingBlock, nsFrameConstructorSaveState& aSaveState); // Function to push the existing float containing block state and - // create a new scope + // create a new scope. Code that uses this function should get matching + // logic in GetFloatContainingBlock. + // Pushing a null float containing block forbids any frames from being + // floated until a new float containing block is pushed. + // XXX we should get rid of null float containing blocks and teach the + // various frame classes to deal with floats instead. void PushFloatContainingBlock(nsIFrame* aNewFloatContainingBlock, nsFrameConstructorSaveState& aSaveState, PRBool aFirstLetterStyle, @@ -7391,6 +7397,10 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsFrameConstructorState& aState, return rv; } + // Push a null float containing block to disable floating within mathml + nsFrameConstructorSaveState saveState; + aState.PushFloatContainingBlock(nsnull, saveState, PR_FALSE, PR_FALSE); + // MathML frames are inline frames, so just process their kids nsFrameItems childItems; if (!newFrame->IsLeaf()) { @@ -8345,7 +8355,7 @@ nsCSSFrameConstructor::GetFloatContainingBlock(nsIFrame* aFrame) // Starting with aFrame, look for a frame that is a float containing block for (nsIFrame* containingBlock = aFrame; - containingBlock; + containingBlock && !containingBlock->IsFrameOfType(nsIFrame::eMathML); containingBlock = containingBlock->GetParent()) { if (containingBlock->IsFloatContainingBlock()) { return containingBlock; diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index f718d9aa1f0f..e41bc4426e4e 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -686,8 +686,15 @@ private: nsIFrame* GetFrameFor(nsIContent* aContent); + /** + * These functions are used when we start frame creation from a non-root + * element. They should recreate the same state that we would have + * arrived at if we had built frames from the root frame to aFrame. + * Therefore, any calls to PushFloatContainingBlock and + * PushAbsoluteContainingBlock during frame construction should get + * corresponding logic in these functions. + */ nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame); - nsIFrame* GetFloatContainingBlock(nsIFrame* aFrame); nsIContent* PropagateScrollToViewport(); diff --git a/layout/mathml/content/src/mathml.css b/layout/mathml/content/src/mathml.css index 6e00af68585c..9fdaf2c63c6c 100644 --- a/layout/mathml/content/src/mathml.css +++ b/layout/mathml/content/src/mathml.css @@ -42,9 +42,8 @@ @namespace url(http://www.w3.org/1998/Math/MathML); -/* MathML doesn't permit floating and positioning */ +/* MathML doesn't permit positioning */ *, * > *|* { - float: none !important; position: static !important; }