layout/mathml/nsMathMLmfencedFrame.h

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 #ifndef nsMathMLmfencedFrame_h
michael@0 7 #define nsMathMLmfencedFrame_h
michael@0 8
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10 #include "nsMathMLContainerFrame.h"
michael@0 11
michael@0 12 //
michael@0 13 // <mfenced> -- surround content with a pair of fences
michael@0 14 //
michael@0 15
michael@0 16 class nsMathMLmfencedFrame : public nsMathMLContainerFrame {
michael@0 17 public:
michael@0 18 NS_DECL_FRAMEARENA_HELPERS
michael@0 19
michael@0 20 friend nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
michael@0 21
michael@0 22 virtual void
michael@0 23 SetAdditionalStyleContext(int32_t aIndex,
michael@0 24 nsStyleContext* aStyleContext) MOZ_OVERRIDE;
michael@0 25 virtual nsStyleContext*
michael@0 26 GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
michael@0 27
michael@0 28 NS_IMETHOD
michael@0 29 InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE;
michael@0 30
michael@0 31 virtual nsresult
michael@0 32 SetInitialChildList(ChildListID aListID,
michael@0 33 nsFrameList& aChildList) MOZ_OVERRIDE;
michael@0 34
michael@0 35 virtual nsresult
michael@0 36 Reflow(nsPresContext* aPresContext,
michael@0 37 nsHTMLReflowMetrics& aDesiredSize,
michael@0 38 const nsHTMLReflowState& aReflowState,
michael@0 39 nsReflowStatus& aStatus) MOZ_OVERRIDE;
michael@0 40
michael@0 41 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
michael@0 42 const nsRect& aDirtyRect,
michael@0 43 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
michael@0 44
michael@0 45 virtual void
michael@0 46 GetIntrinsicWidthMetrics(nsRenderingContext* aRenderingContext,
michael@0 47 nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
michael@0 48
michael@0 49 virtual nsresult
michael@0 50 AttributeChanged(int32_t aNameSpaceID,
michael@0 51 nsIAtom* aAttribute,
michael@0 52 int32_t aModType) MOZ_OVERRIDE;
michael@0 53
michael@0 54 // override the base method because we must keep separators in sync
michael@0 55 virtual nsresult
michael@0 56 ChildListChanged(int32_t aModType) MOZ_OVERRIDE;
michael@0 57
michael@0 58 // override the base method so that we can deal with fences and separators
michael@0 59 virtual nscoord
michael@0 60 FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
michael@0 61
michael@0 62 // helper routines to format the MathMLChars involved here
michael@0 63 static nsresult
michael@0 64 ReflowChar(nsPresContext* aPresContext,
michael@0 65 nsRenderingContext& aRenderingContext,
michael@0 66 nsMathMLChar* aMathMLChar,
michael@0 67 nsOperatorFlags aForm,
michael@0 68 int32_t aScriptLevel,
michael@0 69 nscoord axisHeight,
michael@0 70 nscoord leading,
michael@0 71 nscoord em,
michael@0 72 nsBoundingMetrics& aContainerSize,
michael@0 73 nscoord& aAscent,
michael@0 74 nscoord& aDescent,
michael@0 75 bool aRTL);
michael@0 76
michael@0 77 static void
michael@0 78 PlaceChar(nsMathMLChar* aMathMLChar,
michael@0 79 nscoord aDesiredSize,
michael@0 80 nsBoundingMetrics& bm,
michael@0 81 nscoord& dx);
michael@0 82
michael@0 83 virtual bool
michael@0 84 IsMrowLike() MOZ_OVERRIDE
michael@0 85 {
michael@0 86 // Always treated as an mrow with > 1 child as
michael@0 87 // <mfenced> <mo>%</mo> </mfenced>
michael@0 88 // renders equivalently to
michael@0 89 // <mrow> <mo> ( </mo> <mo>%</mo> <mo> ) </mo> </mrow>
michael@0 90 // This also holds with multiple children. (MathML3 3.3.8.1)
michael@0 91 return true;
michael@0 92 }
michael@0 93
michael@0 94 protected:
michael@0 95 nsMathMLmfencedFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {}
michael@0 96 virtual ~nsMathMLmfencedFrame();
michael@0 97
michael@0 98 nsMathMLChar* mOpenChar;
michael@0 99 nsMathMLChar* mCloseChar;
michael@0 100 nsMathMLChar* mSeparatorsChar;
michael@0 101 int32_t mSeparatorsCount;
michael@0 102
michael@0 103 // clean up
michael@0 104 void
michael@0 105 RemoveFencesAndSeparators();
michael@0 106
michael@0 107 // add fences and separators when all child frames are known
michael@0 108 void
michael@0 109 CreateFencesAndSeparators(nsPresContext* aPresContext);
michael@0 110 };
michael@0 111
michael@0 112 #endif /* nsMathMLmfencedFrame_h */

mercurial