зеркало из https://github.com/mozilla/pjs.git
Bug 310436: Implement IsFrameOfType and use that to disable non-svg frames from being children of svg frames. r=bz sr=dbaron
This commit is contained in:
Родитель
1af1b10ad8
Коммит
80a8cf92b6
|
@ -8050,6 +8050,19 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsFrameConstructorState& aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
// Don't create frames for non-SVG children of SVG elements
|
||||
if (aNameSpaceID != kNameSpaceID_SVG &&
|
||||
aParentFrame &&
|
||||
aParentFrame->IsFrameOfType(nsIFrame::eSVG)
|
||||
#ifdef MOZ_SVG_FOREIGNOBJECT
|
||||
&& !aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)
|
||||
#endif
|
||||
) {
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsIFrame* adjParentFrame = aParentFrame;
|
||||
nsFrameItems* frameItems = &aFrameItems;
|
||||
PRBool pseudoParent = PR_FALSE;
|
||||
|
|
|
@ -1057,6 +1057,25 @@ public:
|
|||
*/
|
||||
virtual nsIAtom* GetType() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Bit-flags to pass to IsFrameOfType()
|
||||
*/
|
||||
enum {
|
||||
eMathML = 1 << 0,
|
||||
eSVG = 1 << 1,
|
||||
eSVGForeignObject = 1 << 2
|
||||
};
|
||||
|
||||
/**
|
||||
* API for doing a quick check if a frame is of a given
|
||||
* type. Returns true if the frame matches ALL flags passed in.
|
||||
*/
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !aFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this frame a containing block for non-positioned elements?
|
||||
*/
|
||||
|
|
|
@ -1177,6 +1177,12 @@ nsMathMLContainerFrame::GetType() const
|
|||
return nsMathMLAtoms::ordinaryMathMLFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsMathMLContainerFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eMathML);
|
||||
}
|
||||
|
||||
enum eMathMLFrameType {
|
||||
eMathMLFrameType_UNKNOWN = -1,
|
||||
eMathMLFrameType_Ordinary,
|
||||
|
|
|
@ -116,6 +116,7 @@ public:
|
|||
// Overloaded nsHTMLContainerFrame methods -- see documentation in nsIFrame.h
|
||||
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
NS_IMETHOD
|
||||
Init(nsPresContext* aPresContext,
|
||||
|
|
|
@ -571,6 +571,12 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsMathMLmtableOuterFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eMathML);
|
||||
}
|
||||
|
||||
// --------
|
||||
// implementation of nsMathMLmtdFrame
|
||||
|
||||
|
@ -622,6 +628,12 @@ nsMathMLmtdFrame::GetColSpan()
|
|||
return colspan;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsMathMLmtdFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eMathML);
|
||||
}
|
||||
|
||||
// --------
|
||||
// implementation of nsMathMLmtdInnerFrame
|
||||
|
||||
|
@ -676,3 +688,10 @@ nsMathMLmtdInnerFrame::Reflow(nsPresContext* aPresContext,
|
|||
// ...
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsMathMLmtdInnerFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eMathML);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@ public:
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
protected:
|
||||
nsMathMLmtableOuterFrame();
|
||||
virtual ~nsMathMLmtableOuterFrame();
|
||||
|
@ -116,6 +118,7 @@ public:
|
|||
// overloaded nsTableCellFrame methods
|
||||
virtual PRInt32 GetRowSpan();
|
||||
virtual PRInt32 GetColSpan();
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
protected:
|
||||
nsMathMLmtdFrame();
|
||||
|
@ -166,6 +169,7 @@ public:
|
|||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
protected:
|
||||
nsMathMLmtdInnerFrame();
|
||||
|
|
|
@ -188,6 +188,12 @@ nsSVGDefsFrame::GetType() const
|
|||
return nsLayoutAtoms::svgDefsFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGDefsFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods:
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgDefsFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
|
|
@ -116,6 +116,7 @@ public:
|
|||
// frametypes, particularly code looking at block and area
|
||||
// also handles foreignObject before we return our own frametype
|
||||
// virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
@ -419,6 +420,12 @@ nsSVGForeignObjectFrame::RemoveFrame(nsIAtom* aListName,
|
|||
// return nsLayoutAtoms::svgForeignObjectFrame;
|
||||
// }
|
||||
|
||||
PRBool
|
||||
nsSVGForeignObjectFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods:
|
||||
|
||||
|
|
|
@ -176,6 +176,11 @@ nsSVGGenericContainerFrame::GetType() const
|
|||
return nsLayoutAtoms::svgGenericContainerFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGGenericContainerFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGChildFrame methods
|
||||
|
|
|
@ -91,6 +91,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgGenericContainerFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
|
|
@ -117,6 +117,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgGlyphFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
@ -417,6 +418,12 @@ nsSVGGlyphFrame::GetType() const
|
|||
return nsLayoutAtoms::svgGlyphFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGGlyphFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods:
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgInnerSVGFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
@ -350,6 +351,12 @@ nsSVGInnerSVGFrame::GetType() const
|
|||
return nsLayoutAtoms::svgInnerSVGFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGInnerSVGFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGChildFrame methods
|
||||
|
||||
|
|
|
@ -217,6 +217,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgOuterSVGFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
@ -843,6 +844,12 @@ nsSVGOuterSVGFrame::GetType() const
|
|||
return nsLayoutAtoms::svgOuterSVGFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGOuterSVGFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods:
|
||||
|
||||
|
|
|
@ -205,6 +205,12 @@ nsSVGPathGeometryFrame::GetType() const
|
|||
return nsLayoutAtoms::svgPathGeometryFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGPathGeometryFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGChildFrame methods
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgPathGeometryFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
|
|
@ -141,6 +141,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgPatternFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
@ -274,6 +275,12 @@ nsSVGPatternFrame::GetType() const
|
|||
return nsLayoutAtoms::svgPatternFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGPatternFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGContainerFrame interface:
|
||||
nsISVGOuterSVGFrame*
|
||||
|
|
|
@ -68,6 +68,7 @@ class nsSVGStopFrame : public nsSVGStopFrameBase,
|
|||
* @see nsLayoutAtoms::svgStopFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
@ -133,6 +134,12 @@ nsSVGStopFrame::GetType() const
|
|||
return nsLayoutAtoms::svgStopFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGStopFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGStopFrame::Init(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
|
|
@ -159,6 +159,12 @@ nsSVGTSpanFrame::GetType() const
|
|||
return nsLayoutAtoms::svgTSpanFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGTSpanFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgTSpanFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
|
|
@ -124,6 +124,7 @@ public:
|
|||
* @see nsLayoutAtoms::svgTextFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
|
@ -368,6 +369,12 @@ nsSVGTextFrame::GetType() const
|
|||
return nsLayoutAtoms::svgTextFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSVGTextFrame::IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return !(aFlags & ~nsIFrame::eSVG);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextFrame::AppendFrames(nsIAtom* aListName,
|
||||
nsIFrame* aFrameList)
|
||||
|
|
Загрузка…
Ссылка в новой задаче