1 /* -*- Mode: IDL; 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/. */
7 * interface for container for information saved in session history when
11 #include
"nsISupports.idl"
14 [ptr] native PresStatePtr
(mozilla
::PresState
);
15 native PresStateUnique
(mozilla
::UniquePtr
<mozilla
::PresState
>);
16 native PresState
(mozilla
::PresState
);
17 [ref] native nsCString
(const nsCString
);
18 native constBool
(const bool
);
21 #include
"nsStringFwd.h"
22 #include
"mozilla/UniquePtr.h"
26 } // namespace mozilla
28 template
<typename
> struct already_AddRefed
;
31 [scriptable
, builtinclass
, uuid(aef27cb3
-4df9
-4eeb
-b0b0
-ac56cf861d04
)]
32 interface nsILayoutHistoryState
: nsISupports
35 * Whether this LayoutHistoryState contains any PresStates.
37 readonly attribute
boolean hasStates
;
40 * Get the keys of all PresStates held by this LayoutHistoryState.
41 * Note: Check hasStates first.
43 Array
<ACString
> getKeys
();
46 * Attempts to get the data of the PresState corresponding to
47 * the passed key. Throws if no data could be found.
49 void getPresState
(in ACString aKey
,
50 out float aScrollX
, out float aScrollY
,
51 out boolean aAllowScrollOriginDowngrade
,
55 * Constructs a new PresState object based on the supplied data
56 * and adds it to the LayoutHistoryState.
58 void addNewPresState
(in ACString aKey
,
59 in float aScrollX
, in float aScrollY
,
60 in boolean aAllowScrollOriginDowngrade
,
63 // Native only interface, converted from the original nsILayoutHistoryState.h
66 * Set |aState| as the state object for |aKey|.
67 * This _transfers_ownership_ of |aState| to the LayoutHistoryState.
68 * It will be freed when RemoveState() is called or when the
69 * LayoutHistoryState is destroyed.
71 [noscript
, notxpcom
, nostdcall
] void AddState
(in nsCString aKey
, in PresStateUnique aState
);
74 * Look up the state object for |aKey|.
76 [noscript
, notxpcom
, nostdcall
] PresStatePtr GetState
(in nsCString aKey
);
79 * Remove the state object for |aKey|.
81 [noscript
, notxpcom
, nostdcall
] void RemoveState
(in nsCString aKey
);
84 * Check whether this history has any states in it
86 [noscript
, notxpcom
, nostdcall
] boolean HasStates
();
89 * Sets whether this history can contain only scroll position history
90 * or all possible history
92 [noscript
, notxpcom
, nostdcall
] void SetScrollPositionOnly
(in constBool aFlag
);
95 * Resets PresState::GetScrollState of all PresState objects to 0,0.
97 [noscript
, notxpcom
, nostdcall
] void ResetScrollState
();
100 * Get the contents of the layout history.
102 [noscript
, notxpcom
, nostdcall
] void GetContents
(out boolean aScrollPositionOnly
,
103 out Array
<ACString
> aKeys
,
104 out Array
<PresState
> aStates
);
107 * Remove all the states and clear the scroll position only flag.
109 [noscript
, notxpcom
, nostdcall
] void Reset
();
113 /* Defined in nsLayoutHistoryState.cpp */
114 already_AddRefed
<nsILayoutHistoryState
>
115 NS_NewLayoutHistoryState
();
118 mozilla
::UniquePtr
<mozilla
::PresState
> NewPresState
();
119 } // namespace mozilla