layout/xul/nsBoxLayout.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.

     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 #ifndef nsBoxLayout_h___
     7 #define nsBoxLayout_h___
     9 #include "nsISupports.h"
    10 #include "nsCoord.h"
    11 #include "nsFrameList.h"
    13 class nsIFrame;
    14 class nsBoxLayoutState;
    15 struct nsSize;
    16 struct nsMargin;
    18 #define NS_BOX_LAYOUT_IID \
    19 { 0x09d522a7, 0x304c, 0x4137, \
    20  { 0xaf, 0xc9, 0xe0, 0x80, 0x2e, 0x89, 0xb7, 0xe8 } }
    22 class nsIGridPart;
    24 class nsBoxLayout : public nsISupports {
    26 public:
    28   nsBoxLayout() {}
    29   virtual ~nsBoxLayout() {}
    31   NS_DECL_ISUPPORTS
    33   NS_DECLARE_STATIC_IID_ACCESSOR(NS_BOX_LAYOUT_IID)
    35   NS_IMETHOD Layout(nsIFrame* aBox, nsBoxLayoutState& aState);
    37   virtual nsSize GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
    38   virtual nsSize GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
    39   virtual nsSize GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
    40   virtual nscoord GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
    41   virtual void ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState,
    42                                 nsIFrame* aPrevBox,
    43                                 const nsFrameList::Slice& aNewChildren) {}
    44   virtual void ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState,
    45                                 const nsFrameList::Slice& aNewChildren) {}
    46   virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aChildList) {}
    47   virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aChildList) {}
    48   virtual void IntrinsicWidthsDirty(nsIFrame* aBox, nsBoxLayoutState& aState) {}
    50   virtual void AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
    51   virtual void AddMargin(nsIFrame* aChild, nsSize& aSize);
    52   virtual void AddMargin(nsSize& aSize, const nsMargin& aMargin);
    54   virtual nsIGridPart* AsGridPart() { return nullptr; }
    56   static void AddLargestSize(nsSize& aSize, const nsSize& aToAdd);
    57   static void AddSmallestSize(nsSize& aSize, const nsSize& aToAdd);
    58 };
    60 NS_DEFINE_STATIC_IID_ACCESSOR(nsBoxLayout, NS_BOX_LAYOUT_IID)
    62 #endif

mercurial