Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObserver.h

Issue 2272773002: Use intersection observer to control frame throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update LeakExpectations Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/IntersectionObserver.h
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserver.h b/third_party/WebKit/Source/core/dom/IntersectionObserver.h
index 85c449675b38e35c07282ee23625347baf4eb16e..3281fcea96352ef256fc00bd74383250e40b02ac 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.h
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.h
@@ -33,6 +33,15 @@ class CORE_EXPORT IntersectionObserver final
Function<void(const HeapVector<Member<IntersectionObserverEntry>>&),
WTF::SameThreadAffinity>;
+ // Defines the assumed initial state of the observed element. If the actual
+ // state is the same as the initial state, then no observation will be
+ // delivered. kAuto means the initial observation will always get sent.
+ enum class InitialState {
+ // TODO(skyostil): Add support for kVisible.
+ kAuto,
+ kHidden,
+ };
+
static IntersectionObserver* create(const IntersectionObserverInit&,
IntersectionObserverCallback&,
ExceptionState&);
@@ -72,6 +81,12 @@ class CORE_EXPORT IntersectionObserver final
return m_observations;
}
+ // Set the assumed initial state of the observed element. Note that this can
+ // only be set before calling observe().
+ // TODO(skyostil): Move this setting to IntersectionObserverInit once the API
+ // is finalized.
+ void setInitialState(InitialState);
+
DECLARE_TRACE();
private:
@@ -90,6 +105,7 @@ class CORE_EXPORT IntersectionObserver final
Length m_rightMargin;
Length m_bottomMargin;
Length m_leftMargin;
+ InitialState m_initialState;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698