1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/nsPresState.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,90 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 + * a piece of state that is stored in session history when the document 1.11 + * is not 1.12 + */ 1.13 + 1.14 +#ifndef nsPresState_h_ 1.15 +#define nsPresState_h_ 1.16 + 1.17 +#include "nsPoint.h" 1.18 +#include "gfxPoint.h" 1.19 +#include "nsAutoPtr.h" 1.20 + 1.21 +class nsPresState 1.22 +{ 1.23 +public: 1.24 + nsPresState() 1.25 + : mContentData(nullptr) 1.26 + , mScrollState(0, 0) 1.27 + , mResolution(1.0, 1.0) 1.28 + , mDisabledSet(false) 1.29 + , mDisabled(false) 1.30 + {} 1.31 + 1.32 + void SetScrollState(const nsPoint& aState) 1.33 + { 1.34 + mScrollState = aState; 1.35 + } 1.36 + 1.37 + nsPoint GetScrollState() const 1.38 + { 1.39 + return mScrollState; 1.40 + } 1.41 + 1.42 + void SetResolution(const gfxSize& aSize) 1.43 + { 1.44 + mResolution = aSize; 1.45 + } 1.46 + 1.47 + gfxSize GetResolution() const 1.48 + { 1.49 + return mResolution; 1.50 + } 1.51 + 1.52 + void ClearNonScrollState() 1.53 + { 1.54 + mContentData = nullptr; 1.55 + mDisabledSet = false; 1.56 + } 1.57 + 1.58 + bool GetDisabled() const 1.59 + { 1.60 + return mDisabled; 1.61 + } 1.62 + 1.63 + void SetDisabled(bool aDisabled) 1.64 + { 1.65 + mDisabled = aDisabled; 1.66 + mDisabledSet = true; 1.67 + } 1.68 + 1.69 + bool IsDisabledSet() const 1.70 + { 1.71 + return mDisabledSet; 1.72 + } 1.73 + 1.74 + nsISupports* GetStateProperty() const 1.75 + { 1.76 + return mContentData; 1.77 + } 1.78 + 1.79 + void SetStateProperty(nsISupports *aProperty) 1.80 + { 1.81 + mContentData = aProperty; 1.82 + } 1.83 + 1.84 +// MEMBER VARIABLES 1.85 +protected: 1.86 + nsCOMPtr<nsISupports> mContentData; 1.87 + nsPoint mScrollState; 1.88 + gfxSize mResolution; 1.89 + bool mDisabledSet; 1.90 + bool mDisabled; 1.91 +}; 1.92 + 1.93 +#endif /* nsPresState_h_ */