Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | // Keep in (case-insensitive) order: |
michael@0 | 7 | #include "nsFrame.h" |
michael@0 | 8 | #include "nsGkAtoms.h" |
michael@0 | 9 | #include "nsSVGEffects.h" |
michael@0 | 10 | #include "nsSVGFilters.h" |
michael@0 | 11 | |
michael@0 | 12 | typedef nsFrame SVGFELeafFrameBase; |
michael@0 | 13 | |
michael@0 | 14 | /* |
michael@0 | 15 | * This frame is used by filter primitive elements that don't |
michael@0 | 16 | * have special child elements that provide parameters. |
michael@0 | 17 | */ |
michael@0 | 18 | class SVGFELeafFrame : public SVGFELeafFrameBase |
michael@0 | 19 | { |
michael@0 | 20 | friend nsIFrame* |
michael@0 | 21 | NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
michael@0 | 22 | protected: |
michael@0 | 23 | SVGFELeafFrame(nsStyleContext* aContext) |
michael@0 | 24 | : SVGFELeafFrameBase(aContext) |
michael@0 | 25 | { |
michael@0 | 26 | AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | public: |
michael@0 | 30 | NS_DECL_FRAMEARENA_HELPERS |
michael@0 | 31 | |
michael@0 | 32 | #ifdef DEBUG |
michael@0 | 33 | virtual void Init(nsIContent* aContent, |
michael@0 | 34 | nsIFrame* aParent, |
michael@0 | 35 | nsIFrame* aPrevInFlow) MOZ_OVERRIDE; |
michael@0 | 36 | #endif |
michael@0 | 37 | |
michael@0 | 38 | virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE |
michael@0 | 39 | { |
michael@0 | 40 | return SVGFELeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | #ifdef DEBUG_FRAME_DUMP |
michael@0 | 44 | virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE |
michael@0 | 45 | { |
michael@0 | 46 | return MakeFrameName(NS_LITERAL_STRING("SVGFELeaf"), aResult); |
michael@0 | 47 | } |
michael@0 | 48 | #endif |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * Get the "type" of the frame |
michael@0 | 52 | * |
michael@0 | 53 | * @see nsGkAtoms::svgFELeafFrame |
michael@0 | 54 | */ |
michael@0 | 55 | virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
michael@0 | 56 | |
michael@0 | 57 | virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
michael@0 | 58 | nsIAtom* aAttribute, |
michael@0 | 59 | int32_t aModType) MOZ_OVERRIDE; |
michael@0 | 60 | |
michael@0 | 61 | virtual bool UpdateOverflow() MOZ_OVERRIDE { |
michael@0 | 62 | // We don't maintain a visual overflow rect |
michael@0 | 63 | return false; |
michael@0 | 64 | } |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | nsIFrame* |
michael@0 | 68 | NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) |
michael@0 | 69 | { |
michael@0 | 70 | return new (aPresShell) SVGFELeafFrame(aContext); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame) |
michael@0 | 74 | |
michael@0 | 75 | #ifdef DEBUG |
michael@0 | 76 | void |
michael@0 | 77 | SVGFELeafFrame::Init(nsIContent* aContent, |
michael@0 | 78 | nsIFrame* aParent, |
michael@0 | 79 | nsIFrame* aPrevInFlow) |
michael@0 | 80 | { |
michael@0 | 81 | NS_ASSERTION(aContent->IsNodeOfType(nsINode::eFILTER), |
michael@0 | 82 | "Trying to construct an SVGFELeafFrame for a " |
michael@0 | 83 | "content element that doesn't support the right interfaces"); |
michael@0 | 84 | |
michael@0 | 85 | SVGFELeafFrameBase::Init(aContent, aParent, aPrevInFlow); |
michael@0 | 86 | } |
michael@0 | 87 | #endif /* DEBUG */ |
michael@0 | 88 | |
michael@0 | 89 | nsIAtom * |
michael@0 | 90 | SVGFELeafFrame::GetType() const |
michael@0 | 91 | { |
michael@0 | 92 | return nsGkAtoms::svgFELeafFrame; |
michael@0 | 93 | } |
michael@0 | 94 | |
michael@0 | 95 | nsresult |
michael@0 | 96 | SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID, |
michael@0 | 97 | nsIAtom* aAttribute, |
michael@0 | 98 | int32_t aModType) |
michael@0 | 99 | { |
michael@0 | 100 | nsSVGFE *element = static_cast<nsSVGFE*>(mContent); |
michael@0 | 101 | if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) { |
michael@0 | 102 | nsSVGEffects::InvalidateRenderingObservers(this); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | return SVGFELeafFrameBase::AttributeChanged(aNameSpaceID, |
michael@0 | 106 | aAttribute, aModType); |
michael@0 | 107 | } |