layout/svg/SVGFEContainerFrame.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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.

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 "nsContainerFrame.h"
michael@0 8 #include "nsGkAtoms.h"
michael@0 9 #include "nsIFrame.h"
michael@0 10 #include "nsLiteralString.h"
michael@0 11 #include "nsSVGEffects.h"
michael@0 12 #include "nsSVGFilters.h"
michael@0 13
michael@0 14 typedef nsContainerFrame SVGFEContainerFrameBase;
michael@0 15
michael@0 16 /*
michael@0 17 * This frame is used by filter primitive elements that
michael@0 18 * have special child elements that provide parameters.
michael@0 19 */
michael@0 20 class SVGFEContainerFrame : public SVGFEContainerFrameBase
michael@0 21 {
michael@0 22 friend nsIFrame*
michael@0 23 NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
michael@0 24 protected:
michael@0 25 SVGFEContainerFrame(nsStyleContext* aContext)
michael@0 26 : SVGFEContainerFrameBase(aContext)
michael@0 27 {
michael@0 28 AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
michael@0 29 }
michael@0 30
michael@0 31 public:
michael@0 32 NS_DECL_FRAMEARENA_HELPERS
michael@0 33
michael@0 34 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
michael@0 35 {
michael@0 36 return SVGFEContainerFrameBase::IsFrameOfType(
michael@0 37 aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGContainer));
michael@0 38 }
michael@0 39
michael@0 40 #ifdef DEBUG_FRAME_DUMP
michael@0 41 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
michael@0 42 {
michael@0 43 return MakeFrameName(NS_LITERAL_STRING("SVGFEContainer"), aResult);
michael@0 44 }
michael@0 45 #endif
michael@0 46
michael@0 47 #ifdef DEBUG
michael@0 48 virtual void Init(nsIContent* aContent,
michael@0 49 nsIFrame* aParent,
michael@0 50 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
michael@0 51 #endif
michael@0 52 /**
michael@0 53 * Get the "type" of the frame
michael@0 54 *
michael@0 55 * @see nsGkAtoms::svgFEContainerFrame
michael@0 56 */
michael@0 57 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
michael@0 58
michael@0 59 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
michael@0 60 nsIAtom* aAttribute,
michael@0 61 int32_t aModType) MOZ_OVERRIDE;
michael@0 62
michael@0 63 virtual bool UpdateOverflow() MOZ_OVERRIDE {
michael@0 64 // We don't maintain a visual overflow rect
michael@0 65 return false;
michael@0 66 }
michael@0 67 };
michael@0 68
michael@0 69 nsIFrame*
michael@0 70 NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
michael@0 71 {
michael@0 72 return new (aPresShell) SVGFEContainerFrame(aContext);
michael@0 73 }
michael@0 74
michael@0 75 NS_IMPL_FRAMEARENA_HELPERS(SVGFEContainerFrame)
michael@0 76
michael@0 77 #ifdef DEBUG
michael@0 78 void
michael@0 79 SVGFEContainerFrame::Init(nsIContent* aContent,
michael@0 80 nsIFrame* aParent,
michael@0 81 nsIFrame* aPrevInFlow)
michael@0 82 {
michael@0 83 NS_ASSERTION(aContent->IsNodeOfType(nsINode::eFILTER),
michael@0 84 "Trying to construct an SVGFEContainerFrame for a "
michael@0 85 "content element that doesn't support the right interfaces");
michael@0 86
michael@0 87 SVGFEContainerFrameBase::Init(aContent, aParent, aPrevInFlow);
michael@0 88 }
michael@0 89 #endif /* DEBUG */
michael@0 90
michael@0 91 nsIAtom *
michael@0 92 SVGFEContainerFrame::GetType() const
michael@0 93 {
michael@0 94 return nsGkAtoms::svgFEContainerFrame;
michael@0 95 }
michael@0 96
michael@0 97 nsresult
michael@0 98 SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID,
michael@0 99 nsIAtom* aAttribute,
michael@0 100 int32_t aModType)
michael@0 101 {
michael@0 102 nsSVGFE *element = static_cast<nsSVGFE*>(mContent);
michael@0 103 if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
michael@0 104 nsSVGEffects::InvalidateRenderingObservers(this);
michael@0 105 }
michael@0 106
michael@0 107 return SVGFEContainerFrameBase::AttributeChanged(aNameSpaceID,
michael@0 108 aAttribute, aModType);
michael@0 109 }

mercurial