Bug 328527 - make all SVG content special for frame constructor, use

leaf frame for filter leaves.  r=bzbarsky, sr=dbaron
This commit is contained in:
tor%cs.brown.edu 2006-03-20 17:39:08 +00:00
parent 45c9e57899
commit e74933beab
3 changed files with 93 additions and 28 deletions

View File

@ -235,6 +235,8 @@ nsIFrame*
NS_NewSVGPatternFrame(nsIPresShell* aPresShell, nsIContent* aContent);
nsIFrame*
NS_NewSVGMaskFrame(nsIPresShell* aPresShell, nsIContent* aContent);
nsIFrame*
NS_NewSVGLeafFrame(nsIPresShell* aPresShell);
#endif
#include "nsIDocument.h"
@ -3458,34 +3460,10 @@ IsSpecialContent(nsIContent* aContent,
#ifdef MOZ_SVG
if (aNameSpaceID == kNameSpaceID_SVG &&
nsSVGUtils::SVGEnabled())
return
aTag == nsSVGAtoms::svg ||
aTag == nsSVGAtoms::g ||
aTag == nsSVGAtoms::polygon ||
aTag == nsSVGAtoms::polyline ||
aTag == nsSVGAtoms::circle ||
aTag == nsSVGAtoms::defs ||
aTag == nsSVGAtoms::ellipse ||
aTag == nsSVGAtoms::line ||
aTag == nsSVGAtoms::rect ||
#ifdef MOZ_SVG_FOREIGNOBJECT
aTag == nsSVGAtoms::foreignObject ||
#endif
aTag == nsSVGAtoms::path ||
aTag == nsSVGAtoms::text ||
aTag == nsSVGAtoms::tspan ||
aTag == nsSVGAtoms::linearGradient ||
aTag == nsSVGAtoms::radialGradient ||
aTag == nsSVGAtoms::stop ||
aTag == nsSVGAtoms::use ||
aTag == nsSVGAtoms::marker ||
aTag == nsSVGAtoms::image ||
aTag == nsSVGAtoms::clipPath ||
aTag == nsSVGAtoms::textPath ||
aTag == nsSVGAtoms::filter ||
aTag == nsSVGAtoms::pattern ||
aTag == nsSVGAtoms::mask;
nsSVGUtils::SVGEnabled()) {
// All SVG content is special...
return PR_TRUE;
}
#endif
#ifdef MOZ_MATHML
@ -7841,6 +7819,30 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
else if (aTag == nsSVGAtoms::mask) {
newFrame = NS_NewSVGMaskFrame(mPresShell, aContent);
}
else if (aTag == nsGkAtoms::feDistantLight ||
aTag == nsGkAtoms::fePointLight ||
aTag == nsGkAtoms::feSpotLight ||
aTag == nsGkAtoms::feBlend ||
aTag == nsGkAtoms::feColorMatrix ||
aTag == nsGkAtoms::feFuncR ||
aTag == nsGkAtoms::feFuncG ||
aTag == nsGkAtoms::feFuncB ||
aTag == nsGkAtoms::feFuncA ||
aTag == nsGkAtoms::feComposite ||
aTag == nsGkAtoms::feConvolveMatrix ||
aTag == nsGkAtoms::feDisplacementMap ||
aTag == nsGkAtoms::feFlood ||
aTag == nsGkAtoms::feGaussianBlur ||
aTag == nsGkAtoms::feImage ||
aTag == nsGkAtoms::feMergeNode ||
aTag == nsGkAtoms::feMorphology ||
aTag == nsGkAtoms::feOffset ||
aTag == nsGkAtoms::feTile ||
aTag == nsGkAtoms::feTurbulence) {
// We don't really use the frame, just need it for the style
// information, so create the simplest possible frame.
newFrame = NS_NewSVGLeafFrame(mPresShell);
}
if (newFrame == nsnull) {
// Either we have an unknown tag, or construction of a frame

View File

@ -78,6 +78,7 @@ CPPSRCS = \
nsSVGGradientFrame.cpp \
nsSVGImageFrame.cpp \
nsSVGInnerSVGFrame.cpp \
nsSVGLeafFrame.cpp \
nsSVGLineFrame.cpp \
nsSVGMarkerFrame.cpp \
nsSVGMaskFrame.cpp \

View File

@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla SVG project.
*
* The Initial Developer of the Original Code is IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsFrame.h"
#include "nsLayoutAtoms.h"
class nsSVGLeafFrame : public nsFrame
{
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("SVGLeaf"), aResult);
}
#endif
};
nsIFrame*
NS_NewSVGLeafFrame(nsIPresShell* aPresShell)
{
return new (aPresShell) nsSVGLeafFrame;
}
PRBool
nsSVGLeafFrame::IsFrameOfType(PRUint32 aFlags) const
{
return !(aFlags & ~nsIFrame::eSVG);
}