tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsPIDOMWindowInlines.h (2235B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef dom_base_nsPIDOMWindowInlines_h___
      8 #define dom_base_nsPIDOMWindowInlines_h___
      9 
     10 inline bool nsPIDOMWindowOuter::IsLoading() const {
     11  auto* win = GetCurrentInnerWindow();
     12 
     13  if (!win) {
     14    NS_ERROR("No current inner window available!");
     15 
     16    return false;
     17  }
     18 
     19  return win->IsLoading();
     20 }
     21 
     22 inline bool nsPIDOMWindowInner::IsLoading() const {
     23  if (!mOuterWindow) {
     24    NS_ERROR("IsLoading() called on orphan inner window!");
     25 
     26    return false;
     27  }
     28 
     29  return !mIsDocumentLoaded;
     30 }
     31 
     32 inline bool nsPIDOMWindowOuter::IsHandlingResizeEvent() const {
     33  auto* win = GetCurrentInnerWindow();
     34 
     35  if (!win) {
     36    NS_ERROR("No current inner window available!");
     37 
     38    return false;
     39  }
     40 
     41  return win->IsHandlingResizeEvent();
     42 }
     43 
     44 inline bool nsPIDOMWindowInner::IsHandlingResizeEvent() const {
     45  if (!mOuterWindow) {
     46    NS_ERROR("IsHandlingResizeEvent() called on orphan inner window!");
     47 
     48    return false;
     49  }
     50 
     51  return mIsHandlingResizeEvent;
     52 }
     53 
     54 inline bool nsPIDOMWindowInner::HasActiveDocument() const {
     55  return IsCurrentInnerWindow();
     56 }
     57 
     58 inline bool nsPIDOMWindowInner::IsTopInnerWindow() const {
     59  return mTopInnerWindow == this;
     60 }
     61 
     62 inline nsIDocShell* nsPIDOMWindowOuter::GetDocShell() const {
     63  return mDocShell;
     64 }
     65 
     66 inline nsIDocShell* nsPIDOMWindowInner::GetDocShell() const {
     67  return mOuterWindow ? mOuterWindow->GetDocShell() : nullptr;
     68 }
     69 
     70 inline mozilla::dom::BrowsingContext* nsPIDOMWindowOuter::GetBrowsingContext()
     71    const {
     72  return mBrowsingContext;
     73 }
     74 
     75 inline mozilla::dom::BrowsingContext* nsPIDOMWindowInner::GetBrowsingContext()
     76    const {
     77  return mBrowsingContext;
     78 }
     79 
     80 inline mozilla::dom::Element* nsPIDOMWindowOuter::GetFocusedElement() const {
     81  return mInnerWindow ? mInnerWindow->GetFocusedElement() : nullptr;
     82 }
     83 
     84 inline bool nsPIDOMWindowOuter::UnknownFocusMethodShouldShowOutline() const {
     85  return mInnerWindow && mInnerWindow->UnknownFocusMethodShouldShowOutline();
     86 }
     87 
     88 #endif