1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/svg/SVGFEUnstyledLeafFrame.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +// Keep in (case-insensitive) order: 1.10 +#include "nsFrame.h" 1.11 +#include "nsGkAtoms.h" 1.12 +#include "nsSVGEffects.h" 1.13 +#include "nsSVGFilters.h" 1.14 + 1.15 +typedef nsFrame SVGFEUnstyledLeafFrameBase; 1.16 + 1.17 +class SVGFEUnstyledLeafFrame : public SVGFEUnstyledLeafFrameBase 1.18 +{ 1.19 + friend nsIFrame* 1.20 + NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); 1.21 +protected: 1.22 + SVGFEUnstyledLeafFrame(nsStyleContext* aContext) 1.23 + : SVGFEUnstyledLeafFrameBase(aContext) 1.24 + { 1.25 + AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); 1.26 + } 1.27 + 1.28 +public: 1.29 + NS_DECL_FRAMEARENA_HELPERS 1.30 + 1.31 + virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, 1.32 + const nsRect& aDirtyRect, 1.33 + const nsDisplayListSet& aLists) MOZ_OVERRIDE {} 1.34 + 1.35 + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE 1.36 + { 1.37 + return SVGFEUnstyledLeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); 1.38 + } 1.39 + 1.40 +#ifdef DEBUG_FRAME_DUMP 1.41 + virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE 1.42 + { 1.43 + return MakeFrameName(NS_LITERAL_STRING("SVGFEUnstyledLeaf"), aResult); 1.44 + } 1.45 +#endif 1.46 + 1.47 + /** 1.48 + * Get the "type" of the frame 1.49 + * 1.50 + * @see nsGkAtoms::svgFEUnstyledLeafFrame 1.51 + */ 1.52 + virtual nsIAtom* GetType() const MOZ_OVERRIDE; 1.53 + 1.54 + virtual nsresult AttributeChanged(int32_t aNameSpaceID, 1.55 + nsIAtom* aAttribute, 1.56 + int32_t aModType) MOZ_OVERRIDE; 1.57 + 1.58 + virtual bool UpdateOverflow() MOZ_OVERRIDE { 1.59 + // We don't maintain a visual overflow rect 1.60 + return false; 1.61 + } 1.62 +}; 1.63 + 1.64 +nsIFrame* 1.65 +NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) 1.66 +{ 1.67 + return new (aPresShell) SVGFEUnstyledLeafFrame(aContext); 1.68 +} 1.69 + 1.70 +NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame) 1.71 + 1.72 +nsIAtom * 1.73 +SVGFEUnstyledLeafFrame::GetType() const 1.74 +{ 1.75 + return nsGkAtoms::svgFEUnstyledLeafFrame; 1.76 +} 1.77 + 1.78 +nsresult 1.79 +SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID, 1.80 + nsIAtom* aAttribute, 1.81 + int32_t aModType) 1.82 +{ 1.83 + SVGFEUnstyledElement *element = static_cast<SVGFEUnstyledElement*>(mContent); 1.84 + if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) { 1.85 + nsSVGEffects::InvalidateRenderingObservers(this); 1.86 + } 1.87 + 1.88 + return SVGFEUnstyledLeafFrameBase::AttributeChanged(aNameSpaceID, 1.89 + aAttribute, aModType); 1.90 +}