Index: Source/core/frame/FrameView.h |
diff --git a/Source/core/frame/FrameView.h b/Source/core/frame/FrameView.h |
index 09b988f04d31fe986c742e483168ddf486b0f3c8..66a4a4567d8d1ef5f9afcc8ef0f28386ff482f74 100644 |
--- a/Source/core/frame/FrameView.h |
+++ b/Source/core/frame/FrameView.h |
@@ -26,6 +26,7 @@ |
#define FrameView_h |
#include "core/CoreExport.h" |
+#include "core/dom/DocumentLifecycle.h" |
#include "core/frame/FrameViewAutoSizeInfo.h" |
#include "core/frame/LayoutSubtreeRootList.h" |
#include "core/frame/RootFrameViewport.h" |
@@ -82,6 +83,7 @@ class CORE_EXPORT FrameView final : public Widget, public ScrollableArea { |
friend class Internals; |
friend class LayoutPart; // for invalidateTreeIfNeeded |
friend class LayoutView; // for contentRectangleForPaintInvalidation |
+ friend class FrameViewTest; |
public: |
static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*); |
@@ -226,12 +228,14 @@ public: |
Color documentBackgroundColor() const; |
// Run all needed lifecycle stages. After calling this method, all frames will be in the lifecycle state PaintInvalidationClean. |
+ // If lifecycle throttling is allowed, some frames may skip the lifecycle update (e.g., based on visibility) and will not end |
+ // up being PaintInvalidationClean. |
// TODO(pdr): Update callers to pass in the interest rect. |
- void updateAllLifecyclePhases(const LayoutRect& interestRect = LayoutRect::infiniteRect()); |
+ void updateAllLifecyclePhases(DocumentLifecycle::ThrottlingMode = DocumentLifecycle::ThrottlingMode::Disallow, const LayoutRect& interestRect = LayoutRect::infiniteRect()); |
// Computes the style, layout and compositing lifecycle stages if needed. After calling this method, all frames wil lbe in a lifecycle |
// state >= CompositingClean, and scrolling has been updated. |
- void updateLifecycleToCompositingCleanPlusScrolling(); |
+ void updateLifecycleToCompositingCleanPlusScrolling(DocumentLifecycle::ThrottlingMode = DocumentLifecycle::ThrottlingMode::Disallow); |
bool invalidateViewportConstrainedObjects(); |
@@ -560,6 +564,19 @@ public: |
void setFrameTimingRequestsDirty(bool isDirty) { m_frameTimingRequestsDirty = isDirty; } |
bool frameTimingRequestsDirty() { return m_frameTimingRequestsDirty; } |
+ // Returns true if this frame should skip rendering pipeline processing during the |
+ // current BeginMainFrame. |
+ bool shouldThrottleRenderingPipeline() const; |
+ |
+ // Returns true if this frame should skip style computation, layout and |
+ // compositing updates for the current BeginMainFrame. |
+ bool shouldThrottleStyleLayoutAndCompositingUpdates() const; |
+ |
+ // Updates the throttling status of all frames in the hierarchy and |
+ // schedules new animations or lifecycle updates as necessary. Must be |
+ // called after the layer update phase of the current BeginMainFrame. |
+ void updateThrottling(); |
+ |
protected: |
// Scroll the content via the compositor. |
bool scrollContentsFastPath(const IntSize& scrollDelta); |
@@ -613,7 +630,7 @@ private: |
OnlyUpToCompositingCleanPlusScrolling, |
}; |
- void updateLifecyclePhasesInternal(LifeCycleUpdateOption, const LayoutRect& interestRect = LayoutRect::infiniteRect()); |
+ void updateLifecyclePhasesInternal(LifeCycleUpdateOption, DocumentLifecycle::ThrottlingMode, const LayoutRect& interestRect = LayoutRect::infiniteRect()); |
void invalidateTreeIfNeededRecursive(); |
void scrollContentsIfNeededRecursive(); |
void updateStyleAndLayoutIfNeededRecursive(); |
@@ -718,6 +735,12 @@ private: |
void collectFrameTimingRequests(GraphicsLayerFrameTimingRequests&); |
void collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests&); |
+ void updateViewportVisibilityIfNeeded(); |
+ void setLifecycleThrottlingModeForSubtree(DocumentLifecycle::ThrottlingMode); |
+ |
+ enum class SecurityOriginStatus { IsSameOrigin, IsCrossOrigin }; |
+ void updateThrottlingRecursive(SecurityOriginStatus); |
+ |
LayoutSize m_size; |
typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; |
@@ -799,6 +822,7 @@ private: |
float m_topControlsViewportAdjustment; |
bool m_needsUpdateWidgetPositions; |
+ bool m_needsUpdateViewportVisibility; |
#if ENABLE(ASSERT) |
// Verified when finalizing. |
@@ -837,6 +861,19 @@ private: |
// TODO(bokan): crbug.com/484188. We should specialize FrameView for the |
// main frame. |
OwnPtrWillBeMember<ScrollableArea> m_viewportScrollableArea; |
+ |
+ // This frame's bounds in the root frame's content coordinates, clipped |
+ // recursively through every ancestor view. |
+ IntRect m_clippedBounds; |
+ |
+ enum class ViewportVisibility { Hidden, Visible }; |
+ |
+ // The following members control rendering pipeline throttling for this |
+ // frame. They are only updated at the end of the pipeline (after painting) |
+ // to avoid running further pipeline stages for a frame without having gone |
+ // through the previous ones. |
+ ViewportVisibility m_viewportVisibility; |
+ SecurityOriginStatus m_securityOriginStatusForThrottling; |
}; |
inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) |