nsILayoutHistoryState.idl 3.52 KB
Newer Older
1
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
3
4
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5

6
7
8
9
10
/*
 * interface for container for information saved in session history when
 * the document is not
 */

11
#include "nsISupports.idl"
12

13

14
15
[ptr] native PresStatePtr(mozilla::PresState);
native PresStateUnique(mozilla::UniquePtr<mozilla::PresState>);
16
native PresState(mozilla::PresState);
17
18
19
20
[ref] native nsCString(const nsCString);
native constBool(const bool);

%{C++
21
#include "nsStringFwd.h"
22
23
24
25
26
#include "mozilla/UniquePtr.h"

namespace mozilla {
class PresState;
} // namespace mozilla
27

28
template<typename> struct already_AddRefed;
29
%}
30

31
[scriptable, builtinclass, uuid(aef27cb3-4df9-4eeb-b0b0-ac56cf861d04)]
32
33
interface nsILayoutHistoryState : nsISupports
{
34
35
36
37
38
39
40
41
42
  /**
  * Whether this LayoutHistoryState contains any PresStates.
  */
  readonly attribute boolean hasStates;

  /**
  * Get the keys of all PresStates held by this LayoutHistoryState.
  * Note: Check hasStates first.
  */
43
  Array<ACString> getKeys();
44
45
46
47
48
49
50
51

  /*
  * Attempts to get the data of the PresState corresponding to
  * the passed key. Throws if no data could be found.
  */
  void getPresState(in ACString aKey,
                    out float aScrollX, out float aScrollY,
                    out boolean aAllowScrollOriginDowngrade,
52
                    out float aRes);
53
54

  /**
55
   * Constructs a new PresState object based on the supplied data
56
57
58
59
60
   * and adds it to the LayoutHistoryState.
   */
  void addNewPresState(in ACString aKey,
                   in float aScrollX, in float aScrollY,
                   in boolean aAllowScrollOriginDowngrade,
61
                   in float aRes);
62

63
  // Native only interface, converted from the original nsILayoutHistoryState.h
64

65
66
67
68
69
70
  /**
   * Set |aState| as the state object for |aKey|.
   * This _transfers_ownership_ of |aState| to the LayoutHistoryState.
   * It will be freed when RemoveState() is called or when the
   * LayoutHistoryState is destroyed.
   */
71
  [noscript, notxpcom, nostdcall] void AddState(in nsCString aKey, in PresStateUnique aState);
72
73
74
75

  /**
   * Look up the state object for |aKey|.
   */
76
  [noscript, notxpcom, nostdcall] PresStatePtr GetState(in nsCString aKey);
77
78
79
80

  /**
   * Remove the state object for |aKey|.
   */
81
  [noscript, notxpcom, nostdcall] void RemoveState(in nsCString aKey);
82
83
84
85

  /**
   * Check whether this history has any states in it
   */
86
  [noscript, notxpcom, nostdcall] boolean HasStates();
87
88
89
90
91

  /**
   * Sets whether this history can contain only scroll position history
   * or all possible history
   */
92
  [noscript, notxpcom, nostdcall] void SetScrollPositionOnly(in constBool aFlag);
93
94

  /**
95
   * Resets PresState::GetScrollState of all PresState objects to 0,0.
96
   */
97
  [noscript, notxpcom, nostdcall] void ResetScrollState();
98
99
100
101
102
103
104
105
106
107
108
109

  /**
   * Get the contents of the layout history.
   */
  [noscript, notxpcom, nostdcall] void GetContents(out boolean aScrollPositionOnly,
                                                   out Array<ACString> aKeys,
                                                   out Array<PresState> aStates);

  /**
   * Remove all the states and clear the scroll position only flag.
   */
  [noscript, notxpcom, nostdcall] void Reset();
110
111
};

112
%{C++
113
/* Defined in nsLayoutHistoryState.cpp */
114
115
already_AddRefed<nsILayoutHistoryState>
NS_NewLayoutHistoryState();
116
117
118
119

namespace mozilla {
mozilla::UniquePtr<mozilla::PresState> NewPresState();
} // namespace mozilla
120
%}
121

jdunn%netscape.com's avatar
   
jdunn%netscape.com committed
122