зеркало из https://github.com/mozilla/gecko-dev.git
Bug 693183 - Simplify class animation processing. r=jwatt
This commit is contained in:
Родитель
2d8544675a
Коммит
f2c48c50e8
|
@ -45,7 +45,6 @@
|
|||
#include "imgIContainer.h"
|
||||
#include "imgIDecoderObserver.h"
|
||||
#include "gfxContext.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -168,28 +167,6 @@ nsSVGImageElement::LoadSVGImage(bool aForce, bool aNotify)
|
|||
//----------------------------------------------------------------------
|
||||
// nsIContent methods:
|
||||
|
||||
nsresult
|
||||
nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, bool aNotify)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
||||
// If caller is not chrome and dom.disable_image_src_set is true,
|
||||
// prevent setting image.src by exiting early
|
||||
if (Preferences::GetBool("dom.disable_image_src_set") &&
|
||||
!nsContentUtils::IsCallerChrome()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aValue) {
|
||||
LoadSVGImage(true, aNotify);
|
||||
} else {
|
||||
CancelImageRequests(aNotify);
|
||||
}
|
||||
}
|
||||
return nsSVGImageElementBase::AfterSetAttr(aNamespaceID, aName,
|
||||
aValue, aNotify);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGImageElement::MaybeLoadSVGImage()
|
||||
{
|
||||
|
@ -281,17 +258,6 @@ nsSVGImageElement::GetStringInfo()
|
|||
ArrayLength(sStringInfo));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGImageElement::DidAnimateString(PRUint8 aAttrEnum)
|
||||
{
|
||||
if (aAttrEnum == HREF) {
|
||||
LoadSVGImage(true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
nsSVGImageElementBase::DidAnimateString(aAttrEnum);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGImageElement::CopyInnerTo(nsGenericElement* aDest) const
|
||||
{
|
||||
|
|
|
@ -77,8 +77,6 @@ public:
|
|||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGImageElementBase::)
|
||||
|
||||
// nsIContent interface
|
||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, bool aNotify);
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers);
|
||||
|
@ -103,7 +101,6 @@ protected:
|
|||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
virtual void DidAnimateString(PRUint8 aAttrEnum);
|
||||
|
||||
enum { X, Y, WIDTH, HEIGHT };
|
||||
nsSVGLength2 mLengthAttributes[4];
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "nsSVGSVGElement.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
class nsSVGImageFrame;
|
||||
|
||||
|
@ -72,14 +73,15 @@ private:
|
|||
nsSVGImageFrame *mFrame;
|
||||
};
|
||||
|
||||
typedef nsSVGPathGeometryFrame nsSVGImageFrameBase;
|
||||
|
||||
class nsSVGImageFrame : public nsSVGPathGeometryFrame
|
||||
class nsSVGImageFrame : public nsSVGImageFrameBase
|
||||
{
|
||||
friend nsIFrame*
|
||||
NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
|
||||
protected:
|
||||
nsSVGImageFrame(nsStyleContext* aContext) : nsSVGPathGeometryFrame(aContext) {}
|
||||
nsSVGImageFrame(nsStyleContext* aContext) : nsSVGImageFrameBase(aContext) {}
|
||||
virtual ~nsSVGImageFrame();
|
||||
|
||||
public:
|
||||
|
@ -168,7 +170,7 @@ nsSVGImageFrame::Init(nsIContent* aContent,
|
|||
NS_ASSERTION(image, "Content is not an SVG image!");
|
||||
#endif
|
||||
|
||||
nsresult rv = nsSVGPathGeometryFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
nsresult rv = nsSVGImageFrameBase::Init(aContent, aParent, aPrevInFlow);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mListener = new nsSVGImageListener(this);
|
||||
|
@ -195,18 +197,34 @@ nsSVGImageFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
if (aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::x ||
|
||||
aAttribute == nsGkAtoms::y ||
|
||||
aAttribute == nsGkAtoms::width ||
|
||||
aAttribute == nsGkAtoms::height ||
|
||||
aAttribute == nsGkAtoms::preserveAspectRatio)) {
|
||||
nsSVGUtils::UpdateGraphic(this);
|
||||
return NS_OK;
|
||||
}
|
||||
if (aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::x ||
|
||||
aAttribute == nsGkAtoms::y ||
|
||||
aAttribute == nsGkAtoms::width ||
|
||||
aAttribute == nsGkAtoms::height ||
|
||||
aAttribute == nsGkAtoms::preserveAspectRatio)) {
|
||||
nsSVGUtils::UpdateGraphic(this);
|
||||
return NS_OK;
|
||||
}
|
||||
if (aNameSpaceID == kNameSpaceID_XLink &&
|
||||
aAttribute == nsGkAtoms::href) {
|
||||
// If caller is not chrome and dom.disable_image_src_set is true,
|
||||
// prevent setting image.src by exiting early
|
||||
if (Preferences::GetBool("dom.disable_image_src_set") &&
|
||||
!nsContentUtils::IsCallerChrome()) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsSVGImageElement *element = static_cast<nsSVGImageElement*>(mContent);
|
||||
|
||||
return nsSVGPathGeometryFrame::AttributeChanged(aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
if (element->mStringAttributes[nsSVGImageElement::HREF].IsExplicitlySet()) {
|
||||
element->LoadSVGImage(true, true);
|
||||
} else {
|
||||
element->CancelImageRequests(true);
|
||||
}
|
||||
}
|
||||
|
||||
return nsSVGImageFrameBase::AttributeChanged(aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
}
|
||||
|
||||
gfxMatrix
|
||||
|
@ -426,7 +444,7 @@ nsSVGImageFrame::GetFrameForPoint(const nsPoint &aPoint)
|
|||
// just fall back on our <image> element's own bounds here.
|
||||
}
|
||||
|
||||
return nsSVGPathGeometryFrame::GetFrameForPoint(aPoint);
|
||||
return nsSVGImageFrameBase::GetFrameForPoint(aPoint);
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
|
|
Загрузка…
Ссылка в новой задаче