From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- layout/base/nsILayoutHistoryState.idl | 122 ++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 layout/base/nsILayoutHistoryState.idl (limited to 'layout/base/nsILayoutHistoryState.idl') diff --git a/layout/base/nsILayoutHistoryState.idl b/layout/base/nsILayoutHistoryState.idl new file mode 100644 index 0000000000..a9844332dd --- /dev/null +++ b/layout/base/nsILayoutHistoryState.idl @@ -0,0 +1,122 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +/* + * interface for container for information saved in session history when + * the document is not + */ + +#include "nsISupports.idl" + + +[ptr] native PresStatePtr(mozilla::PresState); +native PresStateUnique(mozilla::UniquePtr); +native PresState(mozilla::PresState); +[ref] native nsCString(const nsCString); +native constBool(const bool); + +%{C++ +#include "nsStringFwd.h" +#include "mozilla/UniquePtr.h" + +namespace mozilla { +class PresState; +} // namespace mozilla + +template struct already_AddRefed; +%} + +[scriptable, builtinclass, uuid(aef27cb3-4df9-4eeb-b0b0-ac56cf861d04)] +interface nsILayoutHistoryState : nsISupports +{ + /** + * Whether this LayoutHistoryState contains any PresStates. + */ + readonly attribute boolean hasStates; + + /** + * Get the keys of all PresStates held by this LayoutHistoryState. + * Note: Check hasStates first. + */ + Array getKeys(); + + /* + * 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, + out float aRes); + + /** + * Constructs a new PresState object based on the supplied data + * and adds it to the LayoutHistoryState. + */ + void addNewPresState(in ACString aKey, + in float aScrollX, in float aScrollY, + in boolean aAllowScrollOriginDowngrade, + in float aRes); + + // Native only interface, converted from the original nsILayoutHistoryState.h + + /** + * 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. + */ + [noscript, notxpcom, nostdcall] void AddState(in nsCString aKey, in PresStateUnique aState); + + /** + * Look up the state object for |aKey|. + */ + [noscript, notxpcom, nostdcall] PresStatePtr GetState(in nsCString aKey); + + /** + * Remove the state object for |aKey|. + */ + [noscript, notxpcom, nostdcall] void RemoveState(in nsCString aKey); + + /** + * Check whether this history has any states in it + */ + [noscript, notxpcom, nostdcall] boolean HasStates(); + + /** + * Sets whether this history can contain only scroll position history + * or all possible history + */ + [noscript, notxpcom, nostdcall] void SetScrollPositionOnly(in constBool aFlag); + + /** + * Resets PresState::GetScrollState of all PresState objects to 0,0. + */ + [noscript, notxpcom, nostdcall] void ResetScrollState(); + + /** + * Get the contents of the layout history. + */ + [noscript, notxpcom, nostdcall] void GetContents(out boolean aScrollPositionOnly, + out Array aKeys, + out Array aStates); + + /** + * Remove all the states and clear the scroll position only flag. + */ + [noscript, notxpcom, nostdcall] void Reset(); +}; + +%{C++ +/* Defined in nsLayoutHistoryState.cpp */ +already_AddRefed +NS_NewLayoutHistoryState(); + +namespace mozilla { +mozilla::UniquePtr NewPresState(); +} // namespace mozilla +%} + + -- cgit v1.2.3