2017-10-27 01:08:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2016-01-30 20:05:36 +03:00
|
|
|
/* 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/. */
|
|
|
|
|
2017-11-18 02:33:21 +03:00
|
|
|
bool
|
|
|
|
nsPIDOMWindowOuter::IsLoading() const
|
2016-01-30 20:05:36 +03:00
|
|
|
{
|
2017-11-18 02:33:21 +03:00
|
|
|
auto* win = GetCurrentInnerWindow();
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-18 02:33:21 +03:00
|
|
|
if (!win) {
|
|
|
|
NS_ERROR("No current inner window available!");
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-18 02:33:21 +03:00
|
|
|
return false;
|
|
|
|
}
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-18 02:33:21 +03:00
|
|
|
return win->IsLoading();
|
2016-01-30 20:05:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2017-11-18 02:33:21 +03:00
|
|
|
nsPIDOMWindowInner::IsLoading() const
|
2016-01-30 20:05:36 +03:00
|
|
|
{
|
|
|
|
if (!mOuterWindow) {
|
|
|
|
NS_ERROR("IsLoading() called on orphan inner window!");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return !mIsDocumentLoaded;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2017-11-18 02:33:21 +03:00
|
|
|
nsPIDOMWindowOuter::IsHandlingResizeEvent() const
|
2016-01-30 20:05:36 +03:00
|
|
|
{
|
2017-11-18 02:33:21 +03:00
|
|
|
auto* win = GetCurrentInnerWindow();
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-18 02:33:21 +03:00
|
|
|
if (!win) {
|
|
|
|
NS_ERROR("No current inner window available!");
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2017-11-18 02:33:21 +03:00
|
|
|
return false;
|
2016-01-30 20:05:36 +03:00
|
|
|
}
|
|
|
|
|
2017-11-18 02:33:21 +03:00
|
|
|
return win->IsHandlingResizeEvent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsPIDOMWindowInner::IsHandlingResizeEvent() const
|
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
if (!mOuterWindow) {
|
|
|
|
NS_ERROR("IsHandlingResizeEvent() called on orphan inner window!");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mIsHandlingResizeEvent;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsPIDOMWindowInner::IsCurrentInnerWindow() const
|
|
|
|
{
|
|
|
|
return mOuterWindow && mOuterWindow->GetCurrentInnerWindow() == AsInner();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsPIDOMWindowInner::HasActiveDocument()
|
|
|
|
{
|
|
|
|
return IsCurrentInnerWindow() ||
|
|
|
|
(mOuterWindow &&
|
|
|
|
mOuterWindow->GetCurrentInnerWindow() &&
|
|
|
|
mOuterWindow->GetCurrentInnerWindow()->GetDoc() == mDoc);
|
|
|
|
}
|
|
|
|
|
2017-09-06 16:10:01 +03:00
|
|
|
bool
|
|
|
|
nsPIDOMWindowInner::IsTopInnerWindow() const
|
|
|
|
{
|
|
|
|
return mTopInnerWindow == this;
|
|
|
|
}
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsIDocShell*
|
2017-11-21 21:25:27 +03:00
|
|
|
nsPIDOMWindowOuter::GetDocShell() const
|
2016-01-30 20:05:36 +03:00
|
|
|
{
|
|
|
|
return mDocShell;
|
|
|
|
}
|
|
|
|
|
2017-11-21 21:25:27 +03:00
|
|
|
nsIDocShell*
|
|
|
|
nsPIDOMWindowInner::GetDocShell() const
|
|
|
|
{
|
|
|
|
return mOuterWindow ? mOuterWindow->GetDocShell() : nullptr;
|
|
|
|
}
|
|
|
|
|
2018-04-26 17:37:47 +03:00
|
|
|
mozilla::dom::Element*
|
2018-04-26 22:28:30 +03:00
|
|
|
nsPIDOMWindowOuter::GetFocusedElement() const
|
2016-01-30 20:05:36 +03:00
|
|
|
{
|
2018-04-26 22:28:30 +03:00
|
|
|
return mInnerWindow ? mInnerWindow->GetFocusedElement() : nullptr;
|
2017-11-21 21:25:27 +03:00
|
|
|
}
|
2016-01-30 20:05:36 +03:00
|
|
|
|
2018-04-26 17:37:47 +03:00
|
|
|
mozilla::dom::Element*
|
2018-04-26 22:28:30 +03:00
|
|
|
nsPIDOMWindowInner::GetFocusedElement() const
|
2017-11-21 21:25:27 +03:00
|
|
|
{
|
2018-04-26 22:28:30 +03:00
|
|
|
return mFocusedElement;
|
2016-01-30 20:05:36 +03:00
|
|
|
}
|