chromium/third_party/blink/renderer/core/fullscreen/fullscreen.cc

/*
 * Copyright (C) 1999 Lars Knoll ([email protected])
 *           (C) 1999 Antti Koivisto ([email protected])
 *           (C) 2001 Dirk Mueller ([email protected])
 *           (C) 2006 Alexey Proskuryakov ([email protected])
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All
 * rights reserved.
 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
 * (http://www.torchmobile.com/)
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
 * Copyright (C) 2013 Google Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#include "third_party/blink/renderer/core/fullscreen/fullscreen.h"

#include "base/containers/adapters.h"
#include "base/metrics/histogram_macros.h"
#include "base/time/time.h"
#include "third_party/blink/public/mojom/permissions/permission.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_fullscreen_options.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/fullscreen/fullscreen_request_type.h"
#include "third_party/blink/renderer/core/fullscreen/scoped_allow_fullscreen.h"
#include "third_party/blink/renderer/core/html/html_body_element.h"
#include "third_party/blink/renderer/core/html/html_dialog_element.h"
#include "third_party/blink/renderer/core/html/html_iframe_element.h"
#include "third_party/blink/renderer/core/html_element_type_helpers.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/svg/svg_svg_element.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/scheduler/public/event_loop.h"

namespace blink {

namespace {

// UMA key for tracking the duration of a fullscreen request.
static constexpr char kFullscreenDurationMetricKeyRequestFullscreen[] =;

void FullscreenElementChanged(Document& document,
                              Element* old_element,
                              Element* new_element,
                              FullscreenRequestType new_request_type,
                              const FullscreenOptions* new_options) {}

class MetaParams : public GarbageCollected<MetaParams> {};

ElementMetaParamsMap;

ElementMetaParamsMap& FullscreenParamsMap() {}

bool HasFullscreenFlag(const Element& element) {}

void SetFullscreenFlag(const Element& element,
                       FullscreenRequestType request_type,
                       const FullscreenOptions* options) {}

void UnsetFullscreenFlag(const Element& element) {}

FullscreenRequestType GetRequestType(const Element& element) {}

const MetaParams* GetParams(Element& element) {}

// https://fullscreen.spec.whatwg.org/#fullscreen-an-element
void GoFullscreen(Element& element,
                  FullscreenRequestType request_type,
                  const FullscreenOptions* options) {}

// https://fullscreen.spec.whatwg.org/#unfullscreen-an-element
void Unfullscreen(Element& element) {}

// https://fullscreen.spec.whatwg.org/#unfullscreen-a-document
void Unfullscreen(Document& document) {}

// https://html.spec.whatwg.org/C/#allowed-to-use
bool AllowedToUseFullscreen(const Document& document,
                            ReportOptions report_on_failure) {}

// https://fullscreen.spec.whatwg.org/#fullscreen-is-supported
bool FullscreenIsSupported(const Document& document) {}

// https://fullscreen.spec.whatwg.org/#fullscreen-element-ready-check
RequestFullscreenError FullscreenElementReadyCheck(
    const Element& element,
    ReportOptions report_on_failure) {}

// RequestFullscreenScope is allocated at the top of |RequestFullscreen()| and
// used to avoid synchronously changing any state within that method, by
// deferring changes in |DidEnterFullscreen()|.
class RequestFullscreenScope {};

bool RequestFullscreenScope::running_request_fullscreen_ =;

// Walks the frame tree and returns the first local ancestor frame, if any.
LocalFrame* NextLocalAncestor(Frame& frame) {}

// Walks the document's frame tree and returns the document of the first local
// ancestor frame, if any.
Document* NextLocalAncestor(Document& document) {}

// Helper to walk the ancestor chain and return the Document of the topmost
// local ancestor frame. Note that this is not the same as the topmost frame's
// Document, which might be unavailable in OOPIF scenarios. For example, with
// OOPIFs, when called on the bottom frame's Document in a A-B-C-B hierarchy in
// process B, this will skip remote frame C and return this frame: A-[B]-C-B.
Document& TopmostLocalAncestor(Document& document) {}

size_t CountFullscreenInTopLayer(const Document& document) {}

// https://fullscreen.spec.whatwg.org/#simple-fullscreen-document
bool IsSimpleFullscreenDocument(const Document& document) {}

// https://fullscreen.spec.whatwg.org/#collect-documents-to-unfullscreen
HeapVector<Member<Document>> CollectDocumentsToUnfullscreen(Document& doc) {}

// https://fullscreen.spec.whatwg.org/#run-the-fullscreen-rendering-steps
void FireEvent(const AtomicString& type, Element* element, Document* document) {}

const AtomicString& AdjustEventType(const AtomicString& type,
                                    FullscreenRequestType request_type) {}

void EnqueueEvent(const AtomicString& type,
                  Element& element,
                  Document& document,
                  FullscreenRequestType request_type) {}

const char* GetErrorString(RequestFullscreenError error) {}

}  // anonymous namespace

const char Fullscreen::kSupplementName[] =;

Fullscreen& Fullscreen::From(LocalDOMWindow& window) {}

// static
bool Fullscreen::HasFullscreenElements() {}

Element* Fullscreen::FullscreenElementFrom(Document& document) {}

// https://fullscreen.spec.whatwg.org/#fullscreen-element
Element* Fullscreen::FullscreenElementForBindingFrom(TreeScope& scope) {}

bool Fullscreen::IsInFullscreenElementStack(const Element& element) {}

Fullscreen::Fullscreen(LocalDOMWindow& window)
    :{}

Fullscreen::~Fullscreen() = default;

void Fullscreen::ContextDestroyed() {}

// https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen
void Fullscreen::RequestFullscreen(Element& pending) {}

ScriptPromise<IDLUndefined> Fullscreen::RequestFullscreen(
    Element& pending,
    const FullscreenOptions* options,
    FullscreenRequestType request_type,
    ScriptState* script_state,
    ExceptionState* exception_state) {}

void Fullscreen::EnforceRequestFullscreenConditions(
    Element& pending,
    Document& document,
    base::OnceCallback<void(RequestFullscreenError)> callback) {}

void Fullscreen::ContinueRequestFullscreenAfterConditionsEnforcement(
    Element* pending,
    FullscreenRequestType request_type,
    const FullscreenOptions* options,
    ScriptPromiseResolver<IDLUndefined>* resolver,
    RequestFullscreenError error) {}

void Fullscreen::DidResolveEnterFullscreenRequest(Document& document,
                                                  bool granted) {}

void Fullscreen::ContinueRequestFullscreen(
    Document& document,
    Element& pending,
    FullscreenRequestType request_type,
    const FullscreenOptions* options,
    ScriptPromiseResolver<IDLUndefined>* resolver,
    RequestFullscreenError error) {}

// https://fullscreen.spec.whatwg.org/#fully-exit-fullscreen
void Fullscreen::FullyExitFullscreen(Document& document, bool ua_originated) {}

// https://fullscreen.spec.whatwg.org/#exit-fullscreen
ScriptPromise<IDLUndefined> Fullscreen::ExitFullscreen(
    Document& doc,
    ScriptState* script_state,
    ExceptionState* exception_state,
    bool ua_originated) {}

void Fullscreen::DidExitFullscreen(Document& document) {}

void Fullscreen::ContinueExitFullscreen(
    Document* doc,
    ScriptPromiseResolver<IDLUndefined>* resolver,
    bool resize) {}

// https://fullscreen.spec.whatwg.org/#dom-document-fullscreenenabled
bool Fullscreen::FullscreenEnabled(Document& document,
                                   ReportOptions report_on_failure) {}

void Fullscreen::DidUpdateSize(Element& element) {}

void Fullscreen::ElementRemoved(Element& node) {}

bool Fullscreen::IsFullscreenFlagSetFor(const Element& element) {}

void Fullscreen::Trace(Visitor* visitor) const {}

Fullscreen::PendingRequest::PendingRequest(
    Element* element,
    FullscreenRequestType type,
    const FullscreenOptions* options,
    ScriptPromiseResolver<IDLUndefined>* resolver)
    :{}

Fullscreen::PendingRequest::~PendingRequest() = default;

void Fullscreen::PendingRequest::Trace(Visitor* visitor) const {}

}  // namespace blink