layout/svg/SVGFEUnstyledLeafFrame.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.

     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 SVGFEUnstyledLeafFrameBase;
    14 class SVGFEUnstyledLeafFrame : public SVGFEUnstyledLeafFrameBase
    15 {
    16   friend nsIFrame*
    17   NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
    18 protected:
    19   SVGFEUnstyledLeafFrame(nsStyleContext* aContext)
    20     : SVGFEUnstyledLeafFrameBase(aContext)
    21   {
    22     AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
    23   }
    25 public:
    26   NS_DECL_FRAMEARENA_HELPERS
    28   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
    29                               const nsRect&           aDirtyRect,
    30                               const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
    32   virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
    33   {
    34     return SVGFEUnstyledLeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
    35   }
    37 #ifdef DEBUG_FRAME_DUMP
    38   virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
    39   {
    40     return MakeFrameName(NS_LITERAL_STRING("SVGFEUnstyledLeaf"), aResult);
    41   }
    42 #endif
    44   /**
    45    * Get the "type" of the frame
    46    *
    47    * @see nsGkAtoms::svgFEUnstyledLeafFrame
    48    */
    49   virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    51   virtual nsresult AttributeChanged(int32_t  aNameSpaceID,
    52                                     nsIAtom* aAttribute,
    53                                     int32_t  aModType) MOZ_OVERRIDE;
    55   virtual bool UpdateOverflow() MOZ_OVERRIDE {
    56     // We don't maintain a visual overflow rect
    57     return false;
    58   }
    59 };
    61 nsIFrame*
    62 NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
    63 {
    64   return new (aPresShell) SVGFEUnstyledLeafFrame(aContext);
    65 }
    67 NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
    69 nsIAtom *
    70 SVGFEUnstyledLeafFrame::GetType() const
    71 {
    72   return nsGkAtoms::svgFEUnstyledLeafFrame;
    73 }
    75 nsresult
    76 SVGFEUnstyledLeafFrame::AttributeChanged(int32_t  aNameSpaceID,
    77                                          nsIAtom* aAttribute,
    78                                          int32_t  aModType)
    79 {
    80   SVGFEUnstyledElement *element = static_cast<SVGFEUnstyledElement*>(mContent);
    81   if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
    82     nsSVGEffects::InvalidateRenderingObservers(this);
    83   }
    85   return SVGFEUnstyledLeafFrameBase::AttributeChanged(aNameSpaceID,
    86                                                         aAttribute, aModType);
    87 }

mercurial