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

mercurial