Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
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 | // |
michael@0 | 7 | // Eric Vaughan |
michael@0 | 8 | // Netscape Communications |
michael@0 | 9 | // |
michael@0 | 10 | // See documentation in associated header file |
michael@0 | 11 | // |
michael@0 | 12 | |
michael@0 | 13 | #include "nsBox.h" |
michael@0 | 14 | #include "nsCOMPtr.h" |
michael@0 | 15 | #include "nsContainerFrame.h" |
michael@0 | 16 | #include "nsBoxLayout.h" |
michael@0 | 17 | |
michael@0 | 18 | void |
michael@0 | 19 | nsBoxLayout::AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize) |
michael@0 | 20 | { |
michael@0 | 21 | nsBox::AddBorderAndPadding(aBox, aSize); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | void |
michael@0 | 25 | nsBoxLayout::AddMargin(nsIFrame* aBox, nsSize& aSize) |
michael@0 | 26 | { |
michael@0 | 27 | nsBox::AddMargin(aBox, aSize); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | void |
michael@0 | 31 | nsBoxLayout::AddMargin(nsSize& aSize, const nsMargin& aMargin) |
michael@0 | 32 | { |
michael@0 | 33 | nsBox::AddMargin(aSize, aMargin); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | nsSize |
michael@0 | 37 | nsBoxLayout::GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
michael@0 | 38 | { |
michael@0 | 39 | nsSize pref (0, 0); |
michael@0 | 40 | AddBorderAndPadding(aBox, pref); |
michael@0 | 41 | |
michael@0 | 42 | return pref; |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | nsSize |
michael@0 | 46 | nsBoxLayout::GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
michael@0 | 47 | { |
michael@0 | 48 | nsSize minSize (0,0); |
michael@0 | 49 | AddBorderAndPadding(aBox, minSize); |
michael@0 | 50 | return minSize; |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | nsSize |
michael@0 | 54 | nsBoxLayout::GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
michael@0 | 55 | { |
michael@0 | 56 | //AddBorderAndPadding () never changes maxSize (NS_INTRINSICSIZE) |
michael@0 | 57 | //AddBorderAndPadding(aBox, maxSize); |
michael@0 | 58 | return nsSize (NS_INTRINSICSIZE,NS_INTRINSICSIZE); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | |
michael@0 | 62 | nscoord |
michael@0 | 63 | nsBoxLayout::GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
michael@0 | 64 | { |
michael@0 | 65 | return 0; |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | NS_IMETHODIMP |
michael@0 | 69 | nsBoxLayout::Layout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) |
michael@0 | 70 | { |
michael@0 | 71 | return NS_OK; |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | void |
michael@0 | 75 | nsBoxLayout::AddLargestSize(nsSize& aSize, const nsSize& aSize2) |
michael@0 | 76 | { |
michael@0 | 77 | if (aSize2.width > aSize.width) |
michael@0 | 78 | aSize.width = aSize2.width; |
michael@0 | 79 | |
michael@0 | 80 | if (aSize2.height > aSize.height) |
michael@0 | 81 | aSize.height = aSize2.height; |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | void |
michael@0 | 85 | nsBoxLayout::AddSmallestSize(nsSize& aSize, const nsSize& aSize2) |
michael@0 | 86 | { |
michael@0 | 87 | if (aSize2.width < aSize.width) |
michael@0 | 88 | aSize.width = aSize2.width; |
michael@0 | 89 | |
michael@0 | 90 | if (aSize2.height < aSize.height) |
michael@0 | 91 | aSize.height = aSize2.height; |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | NS_IMPL_ISUPPORTS(nsBoxLayout, nsBoxLayout) |