Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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 * a piece of state that is stored in session history when the document
8 * is not
9 */
11 #ifndef nsPresState_h_
12 #define nsPresState_h_
14 #include "nsPoint.h"
15 #include "gfxPoint.h"
16 #include "nsAutoPtr.h"
18 class nsPresState
19 {
20 public:
21 nsPresState()
22 : mContentData(nullptr)
23 , mScrollState(0, 0)
24 , mResolution(1.0, 1.0)
25 , mDisabledSet(false)
26 , mDisabled(false)
27 {}
29 void SetScrollState(const nsPoint& aState)
30 {
31 mScrollState = aState;
32 }
34 nsPoint GetScrollState() const
35 {
36 return mScrollState;
37 }
39 void SetResolution(const gfxSize& aSize)
40 {
41 mResolution = aSize;
42 }
44 gfxSize GetResolution() const
45 {
46 return mResolution;
47 }
49 void ClearNonScrollState()
50 {
51 mContentData = nullptr;
52 mDisabledSet = false;
53 }
55 bool GetDisabled() const
56 {
57 return mDisabled;
58 }
60 void SetDisabled(bool aDisabled)
61 {
62 mDisabled = aDisabled;
63 mDisabledSet = true;
64 }
66 bool IsDisabledSet() const
67 {
68 return mDisabledSet;
69 }
71 nsISupports* GetStateProperty() const
72 {
73 return mContentData;
74 }
76 void SetStateProperty(nsISupports *aProperty)
77 {
78 mContentData = aProperty;
79 }
81 // MEMBER VARIABLES
82 protected:
83 nsCOMPtr<nsISupports> mContentData;
84 nsPoint mScrollState;
85 gfxSize mResolution;
86 bool mDisabledSet;
87 bool mDisabled;
88 };
90 #endif /* nsPresState_h_ */