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