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