fune/dom/base/nsPIDOMWindowInlines.h
Emilio Cobos Álvarez 52e3823a9c Bug 1699154 - Tweak focusring heuristics for script focus. r=edgar
What we implemented before this patch was basically what the heuristics
in the spec said, which used to be normative:

  https://drafts.csswg.org/selectors/#the-focus-visible-pseudo

That has become non-normative and there's ongoing discussion on what
should happen for cases like this in:

  https://github.com/w3c/csswg-drafts/issues/5885
  https://github.com/web-platform-tests/wpt/pull/27806

There seems to be agreement on that WPT issue on cases like this one, so
let's make it work.

Differential Revision: https://phabricator.services.mozilla.com/D108805
2021-03-18 19:53:38 +00:00

88 lines
2.2 KiB
C

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef dom_base_nsPIDOMWindowInlines_h___
#define dom_base_nsPIDOMWindowInlines_h___
inline bool nsPIDOMWindowOuter::IsLoading() const {
auto* win = GetCurrentInnerWindow();
if (!win) {
NS_ERROR("No current inner window available!");
return false;
}
return win->IsLoading();
}
inline bool nsPIDOMWindowInner::IsLoading() const {
if (!mOuterWindow) {
NS_ERROR("IsLoading() called on orphan inner window!");
return false;
}
return !mIsDocumentLoaded;
}
inline bool nsPIDOMWindowOuter::IsHandlingResizeEvent() const {
auto* win = GetCurrentInnerWindow();
if (!win) {
NS_ERROR("No current inner window available!");
return false;
}
return win->IsHandlingResizeEvent();
}
inline bool nsPIDOMWindowInner::IsHandlingResizeEvent() const {
if (!mOuterWindow) {
NS_ERROR("IsHandlingResizeEvent() called on orphan inner window!");
return false;
}
return mIsHandlingResizeEvent;
}
inline bool nsPIDOMWindowInner::HasActiveDocument() {
return IsCurrentInnerWindow();
}
inline bool nsPIDOMWindowInner::IsTopInnerWindow() const {
return mTopInnerWindow == this;
}
inline nsIDocShell* nsPIDOMWindowOuter::GetDocShell() const {
return mDocShell;
}
inline nsIDocShell* nsPIDOMWindowInner::GetDocShell() const {
return mOuterWindow ? mOuterWindow->GetDocShell() : nullptr;
}
inline mozilla::dom::BrowsingContext* nsPIDOMWindowOuter::GetBrowsingContext()
const {
return mBrowsingContext;
}
inline mozilla::dom::BrowsingContext* nsPIDOMWindowInner::GetBrowsingContext()
const {
return mBrowsingContext;
}
inline mozilla::dom::Element* nsPIDOMWindowOuter::GetFocusedElement() const {
return mInnerWindow ? mInnerWindow->GetFocusedElement() : nullptr;
}
inline bool nsPIDOMWindowOuter::UnknownFocusMethodShouldShowOutline() const {
return mInnerWindow && mInnerWindow->UnknownFocusMethodShouldShowOutline();
}
#endif