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