layout/base/nsILayoutHistoryState.idl
author Mike Hommey <mh+mozilla@glandium.org>
Wed, 16 Jan 2019 21:44:54 +0000
changeset 514172 e0fd6ca971ae522dd9398d49f564fe3f7263112b
parent 509721 fd2587f34b52775d4f6b8816a4310485bef78575
child 535538 b0c2b45643a2be2ea68e114630cad0c546f23e8b
permissions -rw-r--r--
Bug 1520377 - Replace/Inline subconfigure.{prefix_lines,execute_and_prefix}. r=nalexander Use an I/O wrapper on the configure output handler to add the "js/src>" prefix. Depends on D16643 Differential Revision: https://phabricator.services.mozilla.com/D16644

/* -*- 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<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<typename> struct already_AddRefed;
%}

[scriptable, 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.
  */
  void getKeys([optional] out uint32_t aCount,
               [array, size_is(aCount), retval] out string aKeys);

  /*
  * 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();
};

%{C++
/* Defined in nsLayoutHistoryState.cpp */
already_AddRefed<nsILayoutHistoryState>
NS_NewLayoutHistoryState();

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