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

/*
 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All
 * Rights Reserved.
 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
 * (http://www.torchmobile.com/)
 *
 * 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/page/page.h"

#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/feature_list.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/page/color_provider_color_maps.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/partitioned_popins/partitioned_popin_params.mojom.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/css/media_feature_overrides.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/css/vision_deficiency.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/dom/node_rare_data.h"
#include "third_party/blink/renderer/core/dom/visited_link_state.h"
#include "third_party/blink/renderer/core/editing/drag_caret.h"
#include "third_party/blink/renderer/core/editing/markers/document_marker_controller.h"
#include "third_party/blink/renderer/core/frame/browser_controls.h"
#include "third_party/blink/renderer/core/frame/display_cutout_client_impl.h"
#include "third_party/blink/renderer/core/frame/event_handler_registry.h"
#include "third_party/blink/renderer/core/frame/frame_console.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_client.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/navigator.h"
#include "third_party/blink/renderer/core/frame/page_scale_constraints.h"
#include "third_party/blink/renderer/core/frame/page_scale_constraints_set.h"
#include "third_party/blink/renderer/core/frame/remote_frame.h"
#include "third_party/blink/renderer/core/frame/remote_frame_view.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/viewport_data.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/fullscreen/fullscreen.h"
#include "third_party/blink/renderer/core/html/fenced_frame/document_fenced_frames.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/inspector/console_message_storage.h"
#include "third_party/blink/renderer/core/inspector/inspector_issue_storage.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/layout/text_autosizer.h"
#include "third_party/blink/renderer/core/loader/idleness_detector.h"
#include "third_party/blink/renderer/core/page/autoscroll_controller.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/context_menu_controller.h"
#include "third_party/blink/renderer/core/page/drag_controller.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/link_highlight.h"
#include "third_party/blink/renderer/core/page/page_animator.h"
#include "third_party/blink/renderer/core/page/page_hidden_state.h"
#include "third_party/blink/renderer/core/page/plugin_data.h"
#include "third_party/blink/renderer/core/page/plugins_changed_observer.h"
#include "third_party/blink/renderer/core/page/pointer_lock_controller.h"
#include "third_party/blink/renderer/core/page/scoped_browsing_context_group_pauser.h"
#include "third_party/blink/renderer/core/page/scoped_page_pauser.h"
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h"
#include "third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h"
#include "third_party/blink/renderer/core/page/spatial_navigation_controller.h"
#include "third_party/blink/renderer/core/page/validation_message_client_impl.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/preferences/navigator_preferences.h"
#include "third_party/blink/renderer/core/preferences/preference_manager.h"
#include "third_party/blink/renderer/core/preferences/preference_overrides.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.h"
#include "third_party/blink/renderer/core/scroll/smooth_scroll_sequencer.h"
#include "third_party/blink/renderer/core/svg/graphics/isolated_svg_document_host.h"
#include "third_party/blink/renderer/core/svg/graphics/svg_image_chrome_client.h"
#include "third_party/blink/renderer/core/svg/svg_resource_document_cache.h"
#include "third_party/blink/renderer/platform/bindings/source_location.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/scheduler/public/agent_group_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h"
#include "third_party/blink/renderer/platform/web_test_support.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_provider_utils.h"

namespace blink {

namespace {
// This seems like a reasonable upper bound, and otherwise mutually
// recursive frameset pages can quickly bring the program to its knees
// with exponential growth in the number of frames.
const int kMaxNumberOfFrames =;

// It is possible to use a reduced frame limit for testing, but only two values
// are permitted, the default or reduced limit.
const int kTenFrames =;

bool g_limit_max_frames_to_ten_for_testing =;

// static
void SetSafeAreaEnvVariables(LocalFrame* frame, const gfx::Insets& safe_area) {}

}  // namespace

// Function defined in third_party/blink/public/web/blink.h.
void ResetPluginCache(bool reload_pages) {}

// Set of all live pages; includes internal Page objects that are
// not observable from scripts.
static Page::PageSet& AllPages() {}

Page::PageSet& Page::OrdinaryPages() {}

void Page::InsertOrdinaryPageForTesting(Page* page) {}

HeapVector<Member<Page>> Page::RelatedPages() {}

Page* Page::CreateNonOrdinary(
    ChromeClient& chrome_client,
    AgentGroupScheduler& agent_group_scheduler,
    const ColorProviderColorMaps* color_provider_colors) {}

Page* Page::CreateOrdinary(
    ChromeClient& chrome_client,
    Page* opener,
    AgentGroupScheduler& agent_group_scheduler,
    const BrowsingContextGroupInfo& browsing_context_group_info,
    const ColorProviderColorMaps* color_provider_colors,
    blink::mojom::PartitionedPopinParamsPtr partitioned_popin_params) {}

Page::Page(base::PassKey<Page>,
           ChromeClient& chrome_client,
           AgentGroupScheduler& agent_group_scheduler,
           const BrowsingContextGroupInfo& browsing_context_group_info,
           const ColorProviderColorMaps* color_provider_colors,
           blink::mojom::PartitionedPopinParamsPtr partitioned_popin_params,
           bool is_ordinary)
    :{}

Page::~Page() {}

// Closing a window/FrameTree happens asynchronously. It's important to keep
// track of the "current" Page because it might change, e.g. if a navigation
// committed in between the time the task gets posted but before the task runs.
// This class keeps track of the "current" Page and ensures that the window
// close happens on the correct Page.
class Page::CloseTaskHandler : public GarbageCollected<Page::CloseTaskHandler> {};

void Page::CloseSoon() {}

ViewportDescription Page::GetViewportDescription() const {}

ScrollingCoordinator* Page::GetScrollingCoordinator() {}

PageScaleConstraintsSet& Page::GetPageScaleConstraintsSet() {}

const PageScaleConstraintsSet& Page::GetPageScaleConstraintsSet() const {}

BrowserControls& Page::GetBrowserControls() {}

const BrowserControls& Page::GetBrowserControls() const {}

ConsoleMessageStorage& Page::GetConsoleMessageStorage() {}

const ConsoleMessageStorage& Page::GetConsoleMessageStorage() const {}

InspectorIssueStorage& Page::GetInspectorIssueStorage() {}

const InspectorIssueStorage& Page::GetInspectorIssueStorage() const {}

TopDocumentRootScrollerController& Page::GlobalRootScrollerController() const {}

VisualViewport& Page::GetVisualViewport() {}

const VisualViewport& Page::GetVisualViewport() const {}

LinkHighlight& Page::GetLinkHighlight() {}

void Page::SetMainFrame(Frame* main_frame) {}

void Page::LinkRelatedPagesIfNeeded() {}

void Page::TakePropertiesForLocalMainFrameSwap(Page* old_page) {}

const SecurityOrigin* Page::GetPartitionedPopinOpenerTopFrameOrigin() const {}

const std::optional<net::SiteForCookies>
Page::GetPartitionedPopinOpenerSiteForCookies() const {}

bool Page::IsPartitionedPopin() const {}

LocalFrame* Page::DeprecatedLocalMainFrame() const {}

void Page::DocumentDetached(Document* document) {}

bool Page::OpenedByDOM() const {}

void Page::SetOpenedByDOM() {}

SpatialNavigationController& Page::GetSpatialNavigationController() {}

SVGResourceDocumentCache& Page::GetSVGResourceDocumentCache() {}

void Page::UsesOverlayScrollbarsChanged() {}

void Page::ForcedColorsChanged() {}

void Page::PlatformColorsChanged() {}

void Page::ColorSchemeChanged() {}

void Page::EmulateForcedColors(bool is_dark_theme) {}

void Page::DisableEmulatedForcedColors() {}

bool Page::UpdateColorProviders(
    const ColorProviderColorMaps& color_provider_colors) {}

void Page::UpdateColorProvidersForTest() {}

const ui::ColorProvider* Page::GetColorProviderForPainting(
    mojom::blink::ColorScheme color_scheme,
    bool in_forced_colors) const {}

void Page::InitialStyleChanged() {}

PluginData* Page::GetPluginData() {}

void Page::ResetPluginData() {}

static void RestoreSVGImageAnimations() {}

void Page::SetValidationMessageClientForTesting(
    ValidationMessageClient* client) {}

void Page::SetPaused(bool paused) {}

void Page::SetShowPausedHudOverlay(bool show_overlay) {}

void Page::SetDefaultPageScaleLimits(float min_scale, float max_scale) {}

void Page::SetUserAgentPageScaleConstraints(
    const PageScaleConstraints& new_constraints) {}

void Page::SetPageScaleFactor(float scale) {}

float Page::PageScaleFactor() const {}

void Page::AllVisitedStateChanged(bool invalidate_visited_link_hashes) {}

void Page::VisitedStateChanged(LinkHash link_hash) {}

void Page::SetVisibilityState(
    mojom::blink::PageVisibilityState visibility_state,
    bool is_initial_state) {}

mojom::blink::PageVisibilityState Page::GetVisibilityState() const {}

bool Page::IsPageVisible() const {}

bool Page::DispatchedPagehideAndStillHidden() {}

bool Page::DispatchedPagehidePersistedAndStillHidden() {}

void Page::OnSetPageFrozen(bool frozen) {}

bool Page::IsCursorVisible() const {}

// static
int Page::MaxNumberOfFrames() {}

// static
void Page::SetMaxNumberOfFramesToTenForTesting(bool enabled) {}

#if DCHECK_IS_ON()
void CheckFrameCountConsistency(int expected_frame_count, Frame* frame) {}
#endif

int Page::SubframeCount() const {}

void Page::UpdateSafeAreaInsetWithBrowserControls(
    const BrowserControls& browser_controls,
    bool force_update) {}

void Page::SetMaxSafeAreaInsets(LocalFrame* setter, gfx::Insets max_safe_area) {}

void Page::SettingsChanged(ChangeType change_type) {}

void Page::InvalidateColorScheme() {}

void Page::InvalidatePaint() {}

void Page::NotifyPluginsChanged() const {}

void Page::UpdateAcceleratedCompositingSettings() {}

void Page::DidCommitLoad(LocalFrame* frame) {}

void Page::AcceptLanguagesChanged() {}

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

void Page::DidInitializeCompositing(cc::AnimationHost& host) {}

void Page::WillStopCompositing() {}

void Page::WillBeDestroyed() {}

void Page::RegisterPluginsChangedObserver(PluginsChangedObserver* observer) {}

ScrollbarTheme& Page::GetScrollbarTheme() const {}

AgentGroupScheduler& Page::GetAgentGroupScheduler() const {}

PageScheduler* Page::GetPageScheduler() const {}

bool Page::IsOrdinary() const {}

bool Page::RequestBeginMainFrameNotExpected(bool new_state) {}

void Page::AddAutoplayFlags(int32_t value) {}

void Page::ClearAutoplayFlags() {}

int32_t Page::AutoplayFlags() const {}

void Page::SetIsMainFrameFencedFrameRoot() {}

bool Page::IsMainFrameFencedFrameRoot() const {}

void Page::SetMediaFeatureOverride(const AtomicString& media_feature,
                                   const String& value) {}

void Page::ClearMediaFeatureOverrides() {}

void Page::SetPreferenceOverride(const AtomicString& media_feature,
                                 const String& value) {}

void Page::ClearPreferenceOverrides() {}

void Page::SetVisionDeficiency(VisionDeficiency new_vision_deficiency) {}

void Page::Animate(base::TimeTicks monotonic_frame_begin_time) {}

void Page::UpdateLifecycle(LocalFrame& root,
                           WebLifecycleUpdate requested_update,
                           DocumentUpdateReason reason) {}

const base::UnguessableToken& Page::BrowsingContextGroupToken() {}

const base::UnguessableToken& Page::CoopRelatedGroupToken() {}

void Page::UpdateBrowsingContextGroup(
    const blink::BrowsingContextGroupInfo& browsing_context_group_info) {}

void Page::SetAttributionSupport(
    network::mojom::AttributionSupport attribution_support) {}

template class CORE_TEMPLATE_EXPORT Supplement<Page>;

const char InternalSettingsPageSupplementBase::kSupplementName[] =;

// static
void Page::PrepareForLeakDetection() {}

// Ensure the 10 bits reserved for connected frame count in NodeRareData are
// sufficient.
static_assert;
static_assert;

}  // namespace blink