layout/forms/nsMeterFrame.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 nsMeterFrame_h___
michael@0 7 #define nsMeterFrame_h___
michael@0 8
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10 #include "nsContainerFrame.h"
michael@0 11 #include "nsIAnonymousContentCreator.h"
michael@0 12 #include "nsCOMPtr.h"
michael@0 13
michael@0 14 class nsMeterFrame : public nsContainerFrame,
michael@0 15 public nsIAnonymousContentCreator
michael@0 16
michael@0 17 {
michael@0 18 typedef mozilla::dom::Element Element;
michael@0 19
michael@0 20 public:
michael@0 21 NS_DECL_QUERYFRAME_TARGET(nsMeterFrame)
michael@0 22 NS_DECL_QUERYFRAME
michael@0 23 NS_DECL_FRAMEARENA_HELPERS
michael@0 24
michael@0 25 nsMeterFrame(nsStyleContext* aContext);
michael@0 26 virtual ~nsMeterFrame();
michael@0 27
michael@0 28 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
michael@0 29
michael@0 30 virtual nsresult Reflow(nsPresContext* aCX,
michael@0 31 nsHTMLReflowMetrics& aDesiredSize,
michael@0 32 const nsHTMLReflowState& aReflowState,
michael@0 33 nsReflowStatus& aStatus) MOZ_OVERRIDE;
michael@0 34
michael@0 35 #ifdef DEBUG_FRAME_DUMP
michael@0 36 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
michael@0 37 return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
michael@0 38 }
michael@0 39 #endif
michael@0 40
michael@0 41 virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
michael@0 42
michael@0 43 // nsIAnonymousContentCreator
michael@0 44 virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
michael@0 45 virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
michael@0 46 uint32_t aFilter) MOZ_OVERRIDE;
michael@0 47
michael@0 48 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
michael@0 49 nsIAtom* aAttribute,
michael@0 50 int32_t aModType) MOZ_OVERRIDE;
michael@0 51
michael@0 52 virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
michael@0 53 nsSize aCBSize, nscoord aAvailableWidth,
michael@0 54 nsSize aMargin, nsSize aBorder,
michael@0 55 nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
michael@0 56
michael@0 57 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
michael@0 58 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
michael@0 59
michael@0 60 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
michael@0 61 {
michael@0 62 return nsContainerFrame::IsFrameOfType(aFlags &
michael@0 63 ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
michael@0 64 }
michael@0 65
michael@0 66 /**
michael@0 67 * Returns whether the frame and its child should use the native style.
michael@0 68 */
michael@0 69 bool ShouldUseNativeStyle() const;
michael@0 70
michael@0 71 virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
michael@0 72
michael@0 73 protected:
michael@0 74 // Helper function which reflow the anonymous div frame.
michael@0 75 void ReflowBarFrame(nsIFrame* aBarFrame,
michael@0 76 nsPresContext* aPresContext,
michael@0 77 const nsHTMLReflowState& aReflowState,
michael@0 78 nsReflowStatus& aStatus);
michael@0 79 /**
michael@0 80 * The div used to show the meter bar.
michael@0 81 * @see nsMeterFrame::CreateAnonymousContent
michael@0 82 */
michael@0 83 nsCOMPtr<Element> mBarDiv;
michael@0 84 };
michael@0 85
michael@0 86 #endif

mercurial