summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/Page.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/page/Page.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/page/Page.h')
-rw-r--r--Source/WebCore/page/Page.h573
1 files changed, 400 insertions, 173 deletions
diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h
index f0b331737..9bcf98a6b 100644
--- a/Source/WebCore/page/Page.h
+++ b/Source/WebCore/page/Page.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2010, 2013, 2015 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
@@ -18,38 +18,49 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef Page_h
-#define Page_h
+#pragma once
-#include "FeatureObserver.h"
+#include "ActivityState.h"
#include "FindOptions.h"
#include "FrameLoaderTypes.h"
#include "LayoutMilestones.h"
#include "LayoutRect.h"
+#include "MediaProducer.h"
#include "PageVisibilityState.h"
#include "Pagination.h"
#include "PlatformScreen.h"
#include "Region.h"
+#include "ScrollTypes.h"
+#include "SessionID.h"
#include "Supplementable.h"
+#include "Timer.h"
+#include "UserInterfaceLayoutDirection.h"
#include "ViewportArguments.h"
+#include "WheelEventTestTrigger.h"
+#include <memory>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
+#include <wtf/UniqueRef.h>
#include <wtf/text/WTFString.h>
#if OS(SOLARIS)
#include <sys/time.h> // For time_t structure.
#endif
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA)
#include <wtf/SchedulePair.h>
#endif
-#if PLATFORM(IOS)
-#include "Settings.h"
+#if ENABLE(MEDIA_SESSION)
+#include "MediaSessionEvents.h"
+#endif
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+#include "MediaPlaybackTargetContext.h"
#endif
namespace JSC {
@@ -58,15 +69,22 @@ class Debugger;
namespace WebCore {
+namespace IDBClient {
+class IDBConnectionToServer;
+}
+
class AlternativeTextClient;
+class ApplicationCacheStorage;
class BackForwardController;
class BackForwardClient;
class Chrome;
class ChromeClient;
class ClientRectList;
+class Color;
class ContextMenuClient;
class ContextMenuController;
-class Document;
+class DatabaseProvider;
+class DiagnosticLoggingClient;
class DragCaretController;
class DragClient;
class DragController;
@@ -74,21 +92,23 @@ class EditorClient;
class FocusController;
class Frame;
class FrameLoaderClient;
-class FrameSelection;
-class HaltablePlugin;
class HistoryItem;
+class HTMLMediaElement;
+class UserInputBridge;
class InspectorClient;
class InspectorController;
+class LibWebRTCProvider;
class MainFrame;
class MediaCanStartListener;
-class Node;
-class PageActivityAssertionToken;
-class PageConsole;
+class MediaPlaybackTarget;
+class PageConfiguration;
+class PageConsoleClient;
class PageDebuggable;
class PageGroup;
-class PageThrottler;
+class PerformanceMonitor;
class PlugInClient;
class PluginData;
+class PluginInfoProvider;
class PluginViewBase;
class PointerLockController;
class ProgressTracker;
@@ -96,92 +116,92 @@ class ProgressTrackerClient;
class Range;
class RenderObject;
class RenderTheme;
+class ReplayController;
+class ResourceUsageOverlay;
class VisibleSelection;
class ScrollableArea;
class ScrollingCoordinator;
class Settings;
+class SocketProvider;
class StorageNamespace;
-class UserContentController;
+class StorageNamespaceProvider;
+class UserContentProvider;
class ValidationMessageClient;
+class ActivityStateChangeObserver;
+class VisitedLinkStore;
+class WebGLStateTracker;
typedef uint64_t LinkHash;
-enum FindDirection { FindDirectionForward, FindDirectionBackward };
+enum FindDirection {
+ FindDirectionForward,
+ FindDirectionBackward
+};
-float deviceScaleFactor(Frame*);
+enum class EventThrottlingBehavior {
+ Responsive,
+ Unresponsive
+};
class Page : public Supplementable<Page> {
WTF_MAKE_NONCOPYABLE(Page);
+ WTF_MAKE_FAST_ALLOCATED;
friend class Settings;
- friend class PageThrottler;
public:
- static void updateStyleForAllPagesAfterGlobalChangeInEnvironment();
- static void jettisonStyleResolversInAllDocuments();
-
- // It is up to the platform to ensure that non-null clients are provided where required.
- struct PageClients {
- WTF_MAKE_NONCOPYABLE(PageClients); WTF_MAKE_FAST_ALLOCATED;
- public:
- PageClients();
- ~PageClients();
-
- AlternativeTextClient* alternativeTextClient;
- ChromeClient* chromeClient;
-#if ENABLE(CONTEXT_MENUS)
- ContextMenuClient* contextMenuClient;
-#endif
- EditorClient* editorClient;
- DragClient* dragClient;
- InspectorClient* inspectorClient;
- PlugInClient* plugInClient;
- ProgressTrackerClient* progressTrackerClient;
- RefPtr<BackForwardClient> backForwardClient;
- ValidationMessageClient* validationMessageClient;
- FrameLoaderClient* loaderClientForMainFrame;
- };
+ WEBCORE_EXPORT static void updateStyleForAllPagesAfterGlobalChangeInEnvironment();
+ WEBCORE_EXPORT static void clearPreviousItemFromAllPages(HistoryItem*);
- explicit Page(PageClients&);
- ~Page();
+ WEBCORE_EXPORT explicit Page(PageConfiguration&&);
+ WEBCORE_EXPORT ~Page();
- uint64_t renderTreeSize() const;
+ WEBCORE_EXPORT uint64_t renderTreeSize() const;
void setNeedsRecalcStyleInAllFrames();
RenderTheme& theme() const { return *m_theme; }
- ViewportArguments viewportArguments() const;
+ WEBCORE_EXPORT ViewportArguments viewportArguments() const;
static void refreshPlugins(bool reload);
- PluginData& pluginData() const;
+ WEBCORE_EXPORT PluginData& pluginData();
+ void clearPluginData();
- void setCanStartMedia(bool);
+ WEBCORE_EXPORT void setCanStartMedia(bool);
bool canStartMedia() const { return m_canStartMedia; }
- EditorClient* editorClient() const { return m_editorClient; }
+ EditorClient& editorClient() { return m_editorClient.get(); }
PlugInClient* plugInClient() const { return m_plugInClient; }
- MainFrame& mainFrame() { ASSERT(m_mainFrame); return *m_mainFrame; }
- const MainFrame& mainFrame() const { ASSERT(m_mainFrame); return *m_mainFrame; }
+ MainFrame& mainFrame() { return m_mainFrame.get(); }
+ const MainFrame& mainFrame() const { return m_mainFrame.get(); }
bool openedByDOM() const;
void setOpenedByDOM();
- void goToItem(HistoryItem*, FrameLoadType);
+ WEBCORE_EXPORT void goToItem(HistoryItem&, FrameLoadType);
- void setGroupName(const String&);
- const String& groupName() const;
+ WEBCORE_EXPORT void setGroupName(const String&);
+ WEBCORE_EXPORT const String& groupName() const;
PageGroup& group();
- PageGroup* groupPtr() { return m_group; } // can return 0
+
+ static void forEachPage(std::function<void(Page&)>);
void incrementSubframeCount() { ++m_subframeCount; }
void decrementSubframeCount() { ASSERT(m_subframeCount); --m_subframeCount; }
int subframeCount() const { checkSubframeCountConsistency(); return m_subframeCount; }
+ void incrementNestedRunLoopCount();
+ void decrementNestedRunLoopCount();
+ bool insideNestedRunLoop() const { return m_nestedRunLoopCount > 0; }
+ WEBCORE_EXPORT void whenUnnested(std::function<void()>);
+
#if ENABLE(REMOTE_INSPECTOR)
- bool remoteInspectionAllowed() const;
- void setRemoteInspectionAllowed(bool);
+ WEBCORE_EXPORT bool remoteInspectionAllowed() const;
+ WEBCORE_EXPORT void setRemoteInspectionAllowed(bool);
+ WEBCORE_EXPORT String remoteInspectionNameOverride() const;
+ WEBCORE_EXPORT void setRemoteInspectionNameOverride(const String&);
void remoteInspectorInformationDidChange() const;
#endif
@@ -194,25 +214,30 @@ public:
#if ENABLE(CONTEXT_MENUS)
ContextMenuController& contextMenuController() const { return *m_contextMenuController; }
#endif
-#if ENABLE(INSPECTOR)
- InspectorController& inspectorController() const { return *m_inspectorController; }
+ UserInputBridge& userInputBridge() const { return *m_userInputBridge; }
+#if ENABLE(WEB_REPLAY)
+ ReplayController& replayController() const { return *m_replayController; }
#endif
+ InspectorController& inspectorController() const { return *m_inspectorController; }
#if ENABLE(POINTER_LOCK)
- PointerLockController* pointerLockController() const { return m_pointerLockController.get(); }
+ PointerLockController& pointerLockController() const { return *m_pointerLockController; }
#endif
- ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient; }
+ LibWebRTCProvider& libWebRTCProvider() { return m_libWebRTCProvider.get(); }
- ScrollingCoordinator* scrollingCoordinator();
+ ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient.get(); }
+ void updateValidationBubbleStateIfNeeded();
- String scrollingStateTreeAsText();
- String synchronousScrollingReasonsAsText();
- PassRefPtr<ClientRectList> nonFastScrollableRects(const Frame*);
+ WEBCORE_EXPORT ScrollingCoordinator* scrollingCoordinator();
+
+ WEBCORE_EXPORT String scrollingStateTreeAsText();
+ WEBCORE_EXPORT String synchronousScrollingReasonsAsText();
+ WEBCORE_EXPORT Ref<ClientRectList> nonFastScrollableRects();
Settings& settings() const { return *m_settings; }
ProgressTracker& progress() const { return *m_progress; }
BackForwardController& backForward() const { return *m_backForwardController; }
- FeatureObserver* featureObserver() { return &m_featureObserver; }
+ std::chrono::milliseconds domTimerAlignmentInterval() const { return m_timerAlignmentInterval; }
#if ENABLE(VIEW_MODE_CSS_MEDIA)
enum ViewMode {
@@ -226,20 +251,20 @@ public:
static ViewMode stringToViewMode(const String&);
ViewMode viewMode() const { return m_viewMode; }
- void setViewMode(ViewMode);
+ WEBCORE_EXPORT void setViewMode(ViewMode);
#endif // ENABLE(VIEW_MODE_CSS_MEDIA)
void setTabKeyCyclesThroughElements(bool b) { m_tabKeyCyclesThroughElements = b; }
bool tabKeyCyclesThroughElements() const { return m_tabKeyCyclesThroughElements; }
- bool findString(const String&, FindOptions);
+ WEBCORE_EXPORT bool findString(const String&, FindOptions);
- PassRefPtr<Range> rangeOfString(const String&, Range*, FindOptions);
+ WEBCORE_EXPORT RefPtr<Range> rangeOfString(const String&, Range*, FindOptions);
- unsigned countFindMatches(const String&, FindOptions, unsigned maxMatchCount);
- unsigned markAllMatchesForText(const String&, FindOptions, bool shouldHighlight, unsigned maxMatchCount);
+ WEBCORE_EXPORT unsigned countFindMatches(const String&, FindOptions, unsigned maxMatchCount);
+ WEBCORE_EXPORT unsigned markAllMatchesForText(const String&, FindOptions, bool shouldHighlight, unsigned maxMatchCount);
- void unmarkAllTextMatches();
+ WEBCORE_EXPORT void unmarkAllTextMatches();
// find all the Ranges for the matching text.
// Upon return, indexForSelection will be one of the following:
@@ -247,95 +272,145 @@ public:
// the index of the first range after the user selection
// NoMatchAfterUserSelection if there is no matching text after the user selection.
enum { NoMatchAfterUserSelection = -1 };
- void findStringMatchingRanges(const String&, FindOptions, int maxCount, Vector<RefPtr<Range>>*, int& indexForSelection);
-#if PLATFORM(MAC)
- void addSchedulePair(PassRefPtr<SchedulePair>);
- void removeSchedulePair(PassRefPtr<SchedulePair>);
+ WEBCORE_EXPORT void findStringMatchingRanges(const String&, FindOptions, int maxCount, Vector<RefPtr<Range>>&, int& indexForSelection);
+#if PLATFORM(COCOA)
+ void platformInitialize();
+ WEBCORE_EXPORT void addSchedulePair(Ref<SchedulePair>&&);
+ WEBCORE_EXPORT void removeSchedulePair(Ref<SchedulePair>&&);
SchedulePairHashSet* scheduledRunLoopPairs() { return m_scheduledRunLoopPairs.get(); }
- OwnPtr<SchedulePairHashSet> m_scheduledRunLoopPairs;
+ std::unique_ptr<SchedulePairHashSet> m_scheduledRunLoopPairs;
#endif
- const VisibleSelection& selection() const;
+ WEBCORE_EXPORT const VisibleSelection& selection() const;
- void setDefersLoading(bool);
+ WEBCORE_EXPORT void setDefersLoading(bool);
bool defersLoading() const { return m_defersLoading; }
- void clearUndoRedoOperations();
+ WEBCORE_EXPORT void clearUndoRedoOperations();
- bool inLowQualityImageInterpolationMode() const;
- void setInLowQualityImageInterpolationMode(bool = true);
+ WEBCORE_EXPORT bool inLowQualityImageInterpolationMode() const;
+ WEBCORE_EXPORT void setInLowQualityImageInterpolationMode(bool = true);
float mediaVolume() const { return m_mediaVolume; }
- void setMediaVolume(float);
+ WEBCORE_EXPORT void setMediaVolume(float);
- void setPageScaleFactor(float scale, const IntPoint& origin);
+ WEBCORE_EXPORT void setPageScaleFactor(float scale, const IntPoint& origin, bool inStableState = true);
float pageScaleFactor() const { return m_pageScaleFactor; }
+ UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
+ WEBCORE_EXPORT void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection);
+
+ void didStartProvisionalLoad();
+ void didFinishLoad(); // Called when the load has been committed in the main frame.
+
+ // The view scale factor is multiplied into the page scale factor by all
+ // callers of setPageScaleFactor.
+ WEBCORE_EXPORT void setViewScaleFactor(float);
+ float viewScaleFactor() const { return m_viewScaleFactor; }
+
+ WEBCORE_EXPORT void setZoomedOutPageScaleFactor(float);
+ float zoomedOutPageScaleFactor() const { return m_zoomedOutPageScaleFactor; }
+
float deviceScaleFactor() const { return m_deviceScaleFactor; }
- void setDeviceScaleFactor(float);
+ WEBCORE_EXPORT void setDeviceScaleFactor(float);
+
+ float topContentInset() const { return m_topContentInset; }
+ WEBCORE_EXPORT void setTopContentInset(float);
+#if PLATFORM(IOS)
+ FloatSize obscuredInset() const { return m_obscuredInset; }
+ void setObscuredInset(FloatSize inset) { m_obscuredInset = inset; }
+
+ bool enclosedInScrollableAncestorView() const { return m_enclosedInScrollableAncestorView; }
+ void setEnclosedInScrollableAncestorView(bool f) { m_enclosedInScrollableAncestorView = f; }
+#endif
+
+#if ENABLE(TEXT_AUTOSIZING)
+ float textAutosizingWidth() const { return m_textAutosizingWidth; }
+ void setTextAutosizingWidth(float textAutosizingWidth) { m_textAutosizingWidth = textAutosizingWidth; }
+#endif
+
bool shouldSuppressScrollbarAnimations() const { return m_suppressScrollbarAnimations; }
- void setShouldSuppressScrollbarAnimations(bool suppressAnimations);
+ WEBCORE_EXPORT void setShouldSuppressScrollbarAnimations(bool suppressAnimations);
void lockAllOverlayScrollbarsToHidden(bool lockOverlayScrollbars);
+
+ WEBCORE_EXPORT void setVerticalScrollElasticity(ScrollElasticity);
+ ScrollElasticity verticalScrollElasticity() const { return static_cast<ScrollElasticity>(m_verticalScrollElasticity); }
+
+ WEBCORE_EXPORT void setHorizontalScrollElasticity(ScrollElasticity);
+ ScrollElasticity horizontalScrollElasticity() const { return static_cast<ScrollElasticity>(m_horizontalScrollElasticity); }
+
+ WEBCORE_EXPORT void accessibilitySettingsDidChange();
// Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
// and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
// FrameViews in the page cache, but FrameView::pagination() only affects the current
// FrameView.
const Pagination& pagination() const { return m_pagination; }
- void setPagination(const Pagination&);
+ WEBCORE_EXPORT void setPagination(const Pagination&);
+ bool paginationLineGridEnabled() const { return m_paginationLineGridEnabled; }
+ WEBCORE_EXPORT void setPaginationLineGridEnabled(bool flag);
- unsigned pageCount() const;
+ WEBCORE_EXPORT unsigned pageCount() const;
+
+ WEBCORE_EXPORT DiagnosticLoggingClient& diagnosticLoggingClient() const;
// Notifications when the Page starts and stops being presented via a native window.
- void setIsVisible(bool isVisible, bool isInitial);
- void setIsPrerender();
- bool isVisible() const { return m_isVisible; }
+ WEBCORE_EXPORT void setActivityState(ActivityState::Flags);
+ ActivityState::Flags activityState() const { return m_activityState; }
+
+ bool isWindowActive() const;
+ bool isVisibleAndActive() const;
+ WEBCORE_EXPORT void setIsVisible(bool);
+ WEBCORE_EXPORT void setIsPrerender();
+ bool isVisible() const { return m_activityState & ActivityState::IsVisible; }
// Notification that this Page was moved into or out of a native window.
- void setIsInWindow(bool);
- bool isInWindow() const { return m_isInWindow; }
+ WEBCORE_EXPORT void setIsInWindow(bool);
+ bool isInWindow() const { return m_activityState & ActivityState::IsInWindow; }
- void suspendScriptedAnimations();
- void resumeScriptedAnimations();
+ void setIsClosing() { m_isClosing = true; }
+ bool isClosing() const { return m_isClosing; }
+
+ void addActivityStateChangeObserver(ActivityStateChangeObserver&);
+ void removeActivityStateChangeObserver(ActivityStateChangeObserver&);
+
+ WEBCORE_EXPORT void suspendScriptedAnimations();
+ WEBCORE_EXPORT void resumeScriptedAnimations();
bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; }
- void setIsVisuallyIdle(bool);
void userStyleSheetLocationChanged();
const String& userStyleSheet() const;
void dnsPrefetchingStateChanged();
void storageBlockingStateChanged();
- void privateBrowsingStateChanged();
+
+#if ENABLE(RESOURCE_USAGE)
+ void setResourceUsageOverlayVisible(bool);
+#endif
+
+ void setAsRunningUserScripts() { m_isRunningUserScripts = true; }
+ bool isRunningUserScripts() const { return m_isRunningUserScripts; }
void setDebugger(JSC::Debugger*);
JSC::Debugger* debugger() const { return m_debugger; }
- static void removeAllVisitedLinks();
+ WEBCORE_EXPORT void invalidateStylesForAllLinks();
+ WEBCORE_EXPORT void invalidateStylesForLink(LinkHash);
- static void allVisitedStateChanged(PageGroup*);
- static void visitedStateChanged(PageGroup*, LinkHash visitedHash);
+ void invalidateInjectedStyleSheetCacheInAllFrames();
StorageNamespace* sessionStorage(bool optionalCreate = true);
- void setSessionStorage(PassRefPtr<StorageNamespace>);
+ void setSessionStorage(RefPtr<StorageNamespace>&&);
- // FIXME: We should make Settings::maxParseDuration() platform-independent, remove {has, set}CustomHTMLTokenizerTimeDelay()
- // and customHTMLTokenizerTimeDelay() and modify theirs callers to update or query Settings::maxParseDuration().
- void setCustomHTMLTokenizerTimeDelay(double);
-#if PLATFORM(IOS)
- bool hasCustomHTMLTokenizerTimeDelay() const { return m_settings->maxParseDuration() != -1; }
- double customHTMLTokenizerTimeDelay() const { ASSERT(m_settings->maxParseDuration() != -1); return m_settings->maxParseDuration(); }
-#else
- bool hasCustomHTMLTokenizerTimeDelay() const { return m_customHTMLTokenizerTimeDelay != -1; }
- double customHTMLTokenizerTimeDelay() const { ASSERT(m_customHTMLTokenizerTimeDelay != -1); return m_customHTMLTokenizerTimeDelay; }
-#endif
+ StorageNamespace* ephemeralLocalStorage(bool optionalCreate = true);
+ void setEphemeralLocalStorage(RefPtr<StorageNamespace>&&);
- void setCustomHTMLTokenizerChunkSize(int);
- bool hasCustomHTMLTokenizerChunkSize() const { return m_customHTMLTokenizerChunkSize != -1; }
- int customHTMLTokenizerChunkSize() const { ASSERT(m_customHTMLTokenizerChunkSize != -1); return m_customHTMLTokenizerChunkSize; }
+ bool hasCustomHTMLTokenizerTimeDelay() const;
+ double customHTMLTokenizerTimeDelay() const;
- void setMemoryCacheClientCallsEnabled(bool);
+ WEBCORE_EXPORT void setMemoryCacheClientCallsEnabled(bool);
bool areMemoryCacheClientCallsEnabled() const { return m_areMemoryCacheClientCallsEnabled; }
// Don't allow more than a certain number of frames in a page.
@@ -347,31 +422,35 @@ public:
void setEditable(bool isEditable) { m_isEditable = isEditable; }
bool isEditable() { return m_isEditable; }
-#if ENABLE(PAGE_VISIBILITY_API)
- PageVisibilityState visibilityState() const;
-#endif
- void resumeAnimatingImages();
+ WEBCORE_EXPORT PageVisibilityState visibilityState() const;
+ WEBCORE_EXPORT void resumeAnimatingImages();
- void addLayoutMilestones(LayoutMilestones);
- void removeLayoutMilestones(LayoutMilestones);
+ WEBCORE_EXPORT void addLayoutMilestones(LayoutMilestones);
+ WEBCORE_EXPORT void removeLayoutMilestones(LayoutMilestones);
LayoutMilestones requestedLayoutMilestones() const { return m_requestedLayoutMilestones; }
#if ENABLE(RUBBER_BANDING)
- void addHeaderWithHeight(int);
- void addFooterWithHeight(int);
+ WEBCORE_EXPORT void addHeaderWithHeight(int);
+ WEBCORE_EXPORT void addFooterWithHeight(int);
#endif
int headerHeight() const { return m_headerHeight; }
int footerHeight() const { return m_footerHeight; }
+ WEBCORE_EXPORT Color pageExtendedBackgroundColor() const;
+
bool isCountingRelevantRepaintedObjects() const;
+ void setIsCountingRelevantRepaintedObjects(bool isCounting) { m_isCountingRelevantRepaintedObjects = isCounting; }
void startCountingRelevantRepaintedObjects();
void resetRelevantPaintedObjectCounter();
void addRelevantRepaintedObject(RenderObject*, const LayoutRect& objectPaintRect);
void addRelevantUnpaintedObject(RenderObject*, const LayoutRect& objectPaintRect);
- void suspendActiveDOMObjectsAndAnimations();
- void resumeActiveDOMObjectsAndAnimations();
+ WEBCORE_EXPORT void suspendActiveDOMObjectsAndAnimations();
+ WEBCORE_EXPORT void resumeActiveDOMObjectsAndAnimations();
+ void suspendDeviceMotionAndOrientationUpdates();
+ void resumeDeviceMotionAndOrientationUpdates();
+
#ifndef NDEBUG
void setIsPainting(bool painting) { m_isPainting = painting; }
bool isPainting() const { return m_isPainting; }
@@ -380,7 +459,7 @@ public:
AlternativeTextClient* alternativeTextClient() const { return m_alternativeTextClient; }
bool hasSeenPlugin(const String& serviceType) const;
- bool hasSeenAnyPlugin() const;
+ WEBCORE_EXPORT bool hasSeenAnyPlugin() const;
void sawPlugin(const String& serviceType);
void resetSeenPlugins();
@@ -389,33 +468,121 @@ public:
void sawMediaEngine(const String& engineName);
void resetSeenMediaEngines();
- PageThrottler& pageThrottler() { return *m_pageThrottler; }
- std::unique_ptr<PageActivityAssertionToken> createActivityToken();
+ PageConsoleClient& console() { return *m_consoleClient; }
- PageConsole& console() { return *m_console; }
-
-#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
- void hiddenPageDOMTimerThrottlingStateChanged();
+#if ENABLE(REMOTE_INSPECTOR)
+ PageDebuggable& inspectorDebuggable() const { return *m_inspectorDebuggable.get(); }
#endif
-#if ENABLE(PAGE_VISIBILITY_API)
+
void hiddenPageCSSAnimationSuspensionStateChanged();
-#endif
#if ENABLE(VIDEO_TRACK)
void captionPreferencesChanged();
#endif
- void incrementFrameHandlingBeforeUnloadEventCount();
- void decrementFrameHandlingBeforeUnloadEventCount();
- bool isAnyFrameHandlingBeforeUnloadEvent();
+ void forbidPrompts();
+ void allowPrompts();
+ bool arePromptsAllowed();
+
void setLastSpatialNavigationCandidateCount(unsigned count) { m_lastSpatialNavigationCandidatesCount = count; }
unsigned lastSpatialNavigationCandidateCount() const { return m_lastSpatialNavigationCandidatesCount; }
- void setUserContentController(UserContentController*);
- UserContentController* userContentController() { return m_userContentController.get(); }
+ ApplicationCacheStorage& applicationCacheStorage() { return m_applicationCacheStorage; }
+ DatabaseProvider& databaseProvider() { return m_databaseProvider; }
+ SocketProvider& socketProvider() { return m_socketProvider; }
+
+ StorageNamespaceProvider& storageNamespaceProvider() { return m_storageNamespaceProvider.get(); }
+ void setStorageNamespaceProvider(Ref<StorageNamespaceProvider>&&);
+
+ PluginInfoProvider& pluginInfoProvider();
+
+ UserContentProvider& userContentProvider();
+ WEBCORE_EXPORT void setUserContentProvider(Ref<UserContentProvider>&&);
+
+ VisitedLinkStore& visitedLinkStore();
+ WEBCORE_EXPORT void setVisitedLinkStore(Ref<VisitedLinkStore>&&);
+
+ WEBCORE_EXPORT SessionID sessionID() const;
+ WEBCORE_EXPORT void setSessionID(SessionID);
+ WEBCORE_EXPORT void enableLegacyPrivateBrowsing(bool privateBrowsingEnabled);
+ bool usesEphemeralSession() const { return m_sessionID.isEphemeral(); }
+
+ MediaProducer::MediaStateFlags mediaState() const { return m_mediaState; }
+ void updateIsPlayingMedia(uint64_t);
+ MediaProducer::MutedStateFlags mutedState() const { return m_mutedState; }
+ bool isAudioMuted() const { return m_mutedState & MediaProducer::AudioIsMuted; }
+ bool isMediaCaptureMuted() const { return m_mutedState & MediaProducer::CaptureDevicesAreMuted; };
+ WEBCORE_EXPORT void setMuted(MediaProducer::MutedStateFlags);
+
+#if ENABLE(MEDIA_SESSION)
+ WEBCORE_EXPORT void handleMediaEvent(MediaEventType);
+ WEBCORE_EXPORT void setVolumeOfMediaElement(double, uint64_t);
+#endif
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ void addPlaybackTargetPickerClient(uint64_t);
+ void removePlaybackTargetPickerClient(uint64_t);
+ void showPlaybackTargetPicker(uint64_t, const IntPoint&, bool);
+ void playbackTargetPickerClientStateDidChange(uint64_t, MediaProducer::MediaStateFlags);
+ WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerEnabled(bool);
+ WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::State);
+
+ WEBCORE_EXPORT void setPlaybackTarget(uint64_t, Ref<MediaPlaybackTarget>&&);
+ WEBCORE_EXPORT void playbackTargetAvailabilityDidChange(uint64_t, bool);
+ WEBCORE_EXPORT void setShouldPlayToPlaybackTarget(uint64_t, bool);
+#endif
+
+ RefPtr<WheelEventTestTrigger> testTrigger() const { return m_testTrigger; }
+ WEBCORE_EXPORT WheelEventTestTrigger& ensureTestTrigger();
+ void clearTrigger() { m_testTrigger = nullptr; }
+ bool expectsWheelEventTriggers() const { return !!m_testTrigger; }
+
+#if ENABLE(VIDEO)
+ bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
+ WEBCORE_EXPORT void setAllowsMediaDocumentInlinePlayback(bool);
+#endif
+
+ bool allowsPlaybackControlsForAutoplayingAudio() const { return m_allowsPlaybackControlsForAutoplayingAudio; }
+ void setAllowsPlaybackControlsForAutoplayingAudio(bool allowsPlaybackControlsForAutoplayingAudio) { m_allowsPlaybackControlsForAutoplayingAudio = allowsPlaybackControlsForAutoplayingAudio; }
+
+#if ENABLE(INDEXED_DATABASE)
+ IDBClient::IDBConnectionToServer& idbConnection();
+#endif
+
+ void setShowAllPlugins(bool showAll) { m_showAllPlugins = showAll; }
+ bool showAllPlugins() const;
+
+ WEBCORE_EXPORT void setTimerAlignmentIntervalIncreaseLimit(std::chrono::milliseconds);
+
+ bool isControlledByAutomation() const { return m_controlledByAutomation; }
+ void setControlledByAutomation(bool controlled) { m_controlledByAutomation = controlled; }
+
+ WEBCORE_EXPORT bool isAlwaysOnLoggingAllowed() const;
+
+ String captionUserPreferencesStyleSheet();
+ void setCaptionUserPreferencesStyleSheet(const String&);
+
+ bool isResourceCachingDisabled() const { return m_resourceCachingDisabled; }
+ void setResourceCachingDisabled(bool disabled) { m_resourceCachingDisabled = disabled; }
+
+ std::optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const { return m_eventThrottlingBehaviorOverride; }
+ void setEventThrottlingBehaviorOverride(std::optional<EventThrottlingBehavior> throttling) { m_eventThrottlingBehaviorOverride = throttling; }
+
+ WebGLStateTracker* webGLStateTracker() const { return m_webGLStateTracker.get(); }
+
+ bool isOnlyNonUtilityPage() const;
+ bool isUtilityPage() const { return m_isUtilityPage; }
+
+#if ENABLE(DATA_INTERACTION)
+ WEBCORE_EXPORT bool hasDataInteractionAtPosition(const FloatPoint&) const;
+#endif
private:
- void initGroup();
+ WEBCORE_EXPORT void initGroup();
+
+ void setIsInWindowInternal(bool);
+ void setIsVisibleInternal(bool);
+ void setIsVisuallyIdleInternal(bool);
#if ASSERT_DISABLED
void checkSubframeCountConsistency() const { }
@@ -428,18 +595,16 @@ private:
unsigned findMatchesForText(const String&, FindOptions, unsigned maxMatchCount, ShouldHighlightMatches, ShouldMarkMatches);
- MediaCanStartListener* takeAnyMediaCanStartListener();
-
- void setMinimumTimerInterval(double);
- double minimumTimerInterval() const;
-
- void setTimerAlignmentInterval(double);
- double timerAlignmentInterval() const;
+ std::optional<std::pair<MediaCanStartListener&, Document&>> takeAnyMediaCanStartListener();
Vector<Ref<PluginViewBase>> pluginViews();
- void throttleTimers();
- void unthrottleTimers();
+ enum class TimerThrottlingState { Disabled, Enabled, EnabledIncreasing };
+ void hiddenPageDOMTimerThrottlingStateChanged();
+ void setTimerThrottlingState(TimerThrottlingState);
+ void updateTimerThrottlingState();
+ void updateDOMTimerAlignmentInterval();
+ void timerAlignmentIntervalIncreaseTimerFired();
const std::unique_ptr<Chrome> m_chrome;
const std::unique_ptr<DragCaretController> m_dragCaretController;
@@ -451,11 +616,13 @@ private:
#if ENABLE(CONTEXT_MENUS)
const std::unique_ptr<ContextMenuController> m_contextMenuController;
#endif
-#if ENABLE(INSPECTOR)
- const std::unique_ptr<InspectorController> m_inspectorController;
+ const std::unique_ptr<UserInputBridge> m_userInputBridge;
+#if ENABLE(WEB_REPLAY)
+ const std::unique_ptr<ReplayController> m_replayController;
#endif
+ const std::unique_ptr<InspectorController> m_inspectorController;
#if ENABLE(POINTER_LOCK)
- OwnPtr<PointerLockController> m_pointerLockController;
+ const std::unique_ptr<PointerLockController> m_pointerLockController;
#endif
RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
@@ -463,19 +630,24 @@ private:
const std::unique_ptr<ProgressTracker> m_progress;
const std::unique_ptr<BackForwardController> m_backForwardController;
- const RefPtr<MainFrame> m_mainFrame;
+ Ref<MainFrame> m_mainFrame;
- mutable RefPtr<PluginData> m_pluginData;
+ RefPtr<PluginData> m_pluginData;
RefPtr<RenderTheme> m_theme;
- EditorClient* m_editorClient;
+ UniqueRef<EditorClient> m_editorClient;
PlugInClient* m_plugInClient;
- ValidationMessageClient* m_validationMessageClient;
+ std::unique_ptr<ValidationMessageClient> m_validationMessageClient;
+ std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient;
+ std::unique_ptr<WebGLStateTracker> m_webGLStateTracker;
- FeatureObserver m_featureObserver;
+ UniqueRef<LibWebRTCProvider> m_libWebRTCProvider;
- int m_subframeCount;
+ int m_nestedRunLoopCount { 0 };
+ std::function<void()> m_unnestCallback;
+
+ int m_subframeCount { 0 };
String m_groupName;
bool m_openedByDOM;
@@ -486,43 +658,63 @@ private:
bool m_inLowQualityInterpolationMode;
bool m_areMemoryCacheClientCallsEnabled;
float m_mediaVolume;
+ MediaProducer::MutedStateFlags m_mutedState { MediaProducer::NoneMuted };
float m_pageScaleFactor;
- float m_deviceScaleFactor;
+ float m_zoomedOutPageScaleFactor;
+ float m_deviceScaleFactor { 1 };
+ float m_viewScaleFactor { 1 };
+
+ float m_topContentInset;
+
+#if PLATFORM(IOS)
+ // This is only used for history scroll position restoration.
+ FloatSize m_obscuredInset;
+ bool m_enclosedInScrollableAncestorView { false };
+#endif
+#if ENABLE(TEXT_AUTOSIZING)
+ float m_textAutosizingWidth;
+#endif
+
bool m_suppressScrollbarAnimations;
+
+ unsigned m_verticalScrollElasticity : 2; // ScrollElasticity
+ unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity
Pagination m_pagination;
+ bool m_paginationLineGridEnabled { false };
String m_userStyleSheetPath;
mutable String m_userStyleSheet;
mutable bool m_didLoadUserStyleSheet;
mutable time_t m_userStyleSheetModificationTime;
+ String m_captionUserPreferencesStyleSheet;
+
std::unique_ptr<PageGroup> m_singlePageGroup;
PageGroup* m_group;
JSC::Debugger* m_debugger;
- double m_customHTMLTokenizerTimeDelay;
- int m_customHTMLTokenizerChunkSize;
-
bool m_canStartMedia;
RefPtr<StorageNamespace> m_sessionStorage;
+ RefPtr<StorageNamespace> m_ephemeralLocalStorage;
#if ENABLE(VIEW_MODE_CSS_MEDIA)
ViewMode m_viewMode;
#endif // ENABLE(VIEW_MODE_CSS_MEDIA)
- double m_minimumTimerInterval;
-
- double m_timerAlignmentInterval;
+ TimerThrottlingState m_timerThrottlingState { TimerThrottlingState::Disabled };
+ std::chrono::steady_clock::time_point m_timerThrottlingStateLastChangedTime { std::chrono::steady_clock::duration::zero() };
+ std::chrono::milliseconds m_timerAlignmentInterval;
+ Timer m_timerAlignmentIntervalIncreaseTimer;
+ std::chrono::milliseconds m_timerAlignmentIntervalIncreaseLimit { 0 };
bool m_isEditable;
- bool m_isInWindow;
- bool m_isVisible;
bool m_isPrerender;
+ ActivityState::Flags m_activityState;
LayoutMilestones m_requestedLayoutMilestones;
@@ -540,20 +732,57 @@ private:
AlternativeTextClient* m_alternativeTextClient;
bool m_scriptedAnimationsSuspended;
- const std::unique_ptr<PageThrottler> m_pageThrottler;
- const std::unique_ptr<PageConsole> m_console;
+ const std::unique_ptr<PageConsoleClient> m_consoleClient;
#if ENABLE(REMOTE_INSPECTOR)
const std::unique_ptr<PageDebuggable> m_inspectorDebuggable;
#endif
+#if ENABLE(INDEXED_DATABASE)
+ RefPtr<IDBClient::IDBConnectionToServer> m_idbIDBConnectionToServer;
+#endif
+
HashSet<String> m_seenPlugins;
HashSet<String> m_seenMediaEngines;
unsigned m_lastSpatialNavigationCandidatesCount;
- unsigned m_framesHandlingBeforeUnloadEvent;
+ unsigned m_forbidPromptsDepth;
+
+ Ref<SocketProvider> m_socketProvider;
+ Ref<ApplicationCacheStorage> m_applicationCacheStorage;
+ Ref<DatabaseProvider> m_databaseProvider;
+ Ref<PluginInfoProvider> m_pluginInfoProvider;
+ Ref<StorageNamespaceProvider> m_storageNamespaceProvider;
+ Ref<UserContentProvider> m_userContentProvider;
+ Ref<VisitedLinkStore> m_visitedLinkStore;
+ RefPtr<WheelEventTestTrigger> m_testTrigger;
+
+ HashSet<ActivityStateChangeObserver*> m_activityStateChangeObservers;
+
+#if ENABLE(RESOURCE_USAGE)
+ std::unique_ptr<ResourceUsageOverlay> m_resourceUsageOverlay;
+#endif
+
+ SessionID m_sessionID;
- RefPtr<UserContentController> m_userContentController;
+ bool m_isClosing;
+
+ MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying };
+
+ bool m_allowsMediaDocumentInlinePlayback { false };
+ bool m_allowsPlaybackControlsForAutoplayingAudio { false };
+ bool m_showAllPlugins { false };
+ bool m_controlledByAutomation { false };
+ bool m_resourceCachingDisabled { false };
+ bool m_isUtilityPage;
+ UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { UserInterfaceLayoutDirection::LTR };
+
+ // For testing.
+ std::optional<EventThrottlingBehavior> m_eventThrottlingBehaviorOverride;
+
+ std::unique_ptr<PerformanceMonitor> m_performanceMonitor;
+
+ bool m_isRunningUserScripts { false };
};
inline PageGroup& Page::group()
@@ -564,5 +793,3 @@ inline PageGroup& Page::group()
}
} // namespace WebCore
-
-#endif // Page_h