Skip to content

Commit

Permalink
Remove IntersectionObserverEnabled preference
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264479
rdar://118175306

Reviewed by Simon Fraser.

It's been enabled for a very long time now.

* LayoutTests/intersection-observer/intersection-observer-callback-after-gc.html:
* LayoutTests/intersection-observer/intersection-observer-callback-leak.html:
* LayoutTests/intersection-observer/intersection-observer-entry-interface.html:
* LayoutTests/intersection-observer/intersection-observer-interface.html:
* LayoutTests/intersection-observer/intersection-observer-keeps-element-of-queued-entry-alive.html:
* LayoutTests/intersection-observer/intersection-observer-should-not-leak-observed-nodes.html:
* LayoutTests/intersection-observer/root-element-deleted.html:
* LayoutTests/intersection-observer/root-element-moved.html:
* LayoutTests/intersection-observer/target-deleted.html:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/page/IntersectionObserver.idl:
* Source/WebCore/page/IntersectionObserverEntry.idl:
* Source/WebKit/UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetIntersectionObserverEnabled):
(WKPreferencesGetIntersectionObserverEnabled):
* Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h:
* Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h:
* Source/WebKitLegacy/mac/WebView/WebPreferences.mm:
(-[WebPreferences intersectionObserverEnabled]):
(-[WebPreferences setIntersectionObserverEnabled:]):
* Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h:

Canonical link: https://commits.webkit.org/270547@main
  • Loading branch information
annevk committed Nov 10, 2023
1 parent 7718863 commit 9e3021a
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<html>

<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<html>

<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<head>
<title>IntersectionObserverEntry interface tests.</title>
<link rel="author" title="Simon Fraser" href="mailto:simon.fraser@apple.com" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<head>
<title>IntersectionObserver interface tests.</title>
<link rel="author" title="Simon Fraser" href="mailto:simon.fraser@apple.com" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<html>
<body>
<pre id="log">This tests observing an element with an IntersectionObserver and removing the element from the document while it is queued for delivery.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<html>
<body>
<pre id="log">This tests observing an element with an IntersectionObserver and removing the element from the document.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<head>
<script src="../resources/gc.js"></script>
<body>
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/intersection-observer/root-element-moved.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/intersection-observer/target-deleted.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><!-- webkit-test-runner [ IntersectionObserverEnabled=true ] -->
<!DOCTYPE html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
Expand Down
13 changes: 0 additions & 13 deletions Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3462,19 +3462,6 @@ InterruptVideoOnPageVisibilityChangeEnabled:
WebCore:
default: false

IntersectionObserverEnabled:
type: bool
status: mature
humanReadableName: "Intersection Observer"
humanReadableDescription: "Enable Intersection Observer support"
defaultValue:
WebKitLegacy:
default: true
WebKit:
default: true
WebCore:
default: true

InvisibleAutoplayNotPermitted:
type: bool
status: embedder
Expand Down
4 changes: 0 additions & 4 deletions Source/WebCore/page/IntersectionObserver.idl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
// https://wicg.github.io/IntersectionObserver/

[
EnabledBySetting=IntersectionObserverEnabled,
Exposed=Window,
JSCustomMarkFunction,
CustomIsReachable,
Expand All @@ -43,9 +42,6 @@
[ResultField=records] sequence<IntersectionObserverEntry> takeRecords();
};

[
EnabledBySetting=IntersectionObserverEnabled
]
dictionary IntersectionObserverInit {
(Element or Document)? root = null;
DOMString rootMargin = "0px";
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/page/IntersectionObserverEntry.idl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
typedef double DOMHighResTimeStamp;

[
EnabledBySetting=IntersectionObserverEnabled,
JSCustomMarkFunction,
Exposed=Window
] interface IntersectionObserverEntry {
Expand Down
3 changes: 1 addition & 2 deletions Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,12 +1539,11 @@ bool WKPreferencesGetDownloadAttributeEnabled(WKPreferencesRef preferencesRef)

void WKPreferencesSetIntersectionObserverEnabled(WKPreferencesRef preferencesRef, bool flag)
{
toImpl(preferencesRef)->setIntersectionObserverEnabled(flag);
}

bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef preferencesRef)
{
return toImpl(preferencesRef)->intersectionObserverEnabled();
return true;
}

void WKPreferencesSetMenuItemElementEnabled(WKPreferencesRef preferencesRef, bool flag)
Expand Down
6 changes: 2 additions & 4 deletions Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,6 @@ WK_EXPORT bool WKPreferencesGetAllowsPictureInPictureMediaPlayback(WKPreferences
WK_EXPORT void WKPreferencesSetAttachmentElementEnabled(WKPreferencesRef preferencesRef, bool flag);
WK_EXPORT bool WKPreferencesGetAttachmentElementEnabled(WKPreferencesRef preferencesRef);

// Defaults to false
WK_EXPORT void WKPreferencesSetIntersectionObserverEnabled(WKPreferencesRef, bool flag);
WK_EXPORT bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef);

// Defaults to false
WK_EXPORT void WKPreferencesSetDataTransferItemsEnabled(WKPreferencesRef, bool flag);
WK_EXPORT bool WKPreferencesGetDataTransferItemsEnabled(WKPreferencesRef);
Expand Down Expand Up @@ -531,6 +527,8 @@ WK_EXPORT void WKPreferencesSetFetchAPIEnabled(WKPreferencesRef, bool) WK_C_API_
WK_EXPORT bool WKPreferencesGetFetchAPIEnabled(WKPreferencesRef) WK_C_API_DEPRECATED;
WK_EXPORT void WKPreferencesSetFetchAPIKeepAliveEnabled(WKPreferencesRef, bool) WK_C_API_DEPRECATED;
WK_EXPORT bool WKPreferencesGetFetchAPIKeepAliveEnabled(WKPreferencesRef) WK_C_API_DEPRECATED;
WK_EXPORT void WKPreferencesSetIntersectionObserverEnabled(WKPreferencesRef, bool flag) WK_C_API_DEPRECATED;
WK_EXPORT bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef) WK_C_API_DEPRECATED;
WK_EXPORT void WKPreferencesSetIsSecureContextAttributeEnabled(WKPreferencesRef, bool) WK_C_API_DEPRECATED;
WK_EXPORT bool WKPreferencesGetIsSecureContextAttributeEnabled(WKPreferencesRef) WK_C_API_DEPRECATED;
WK_EXPORT void WKPreferencesSetUserTimingEnabled(WKPreferencesRef, bool) WK_C_API_DEPRECATED;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@
#define WebKitRequestIdleCallbackEnabledPreferenceKey @"WebKitRequestIdleCallbackEnabled"
#define WebKitHighlightAPIEnabledPreferenceKey @"WebKitHighlightAPIEnabled"
#define WebKitAsyncClipboardAPIEnabledPreferenceKey @"WebKitAsyncClipboardAPIEnabled"
#define WebKitIntersectionObserverEnabledPreferenceKey @"WebKitIntersectionObserverEnabled"
#define WebKitVisualViewportAPIEnabledPreferenceKey @"WebKitVisualViewportAPIEnabled"
#define WebKitSyntheticEditingCommandsEnabledPreferenceKey @"WebKitSyntheticEditingCommandsEnabled"
#define WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey @"WebKitCSSOMViewSmoothScrollingEnabled"
Expand Down Expand Up @@ -277,3 +276,4 @@
#define WebKitAVFoundationNSURLSessionEnabledKey @"WebKitAVFoundationNSURLSessionEnabled"
#define WebKitDisplayListDrawingEnabledPreferenceKey @"WebKitDisplayListDrawingEnabled"
#define WebKitTransformStreamAPIEnabledPreferenceKey @"WebKitTransformStreamAPIEnabled"
#define WebKitIntersectionObserverEnabledPreferenceKey @"WebKitIntersectionObserverEnabled"
19 changes: 9 additions & 10 deletions Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2916,16 +2916,6 @@ - (void)setContactPickerAPIEnabled:(BOOL)flag
[self _setBoolValue:flag forKey:WebKitContactPickerAPIEnabledPreferenceKey];
}

- (BOOL)intersectionObserverEnabled
{
return [self _boolValueForKey:WebKitIntersectionObserverEnabledPreferenceKey];
}

- (void)setIntersectionObserverEnabled:(BOOL)flag
{
[self _setBoolValue:flag forKey:WebKitIntersectionObserverEnabledPreferenceKey];
}

- (BOOL)visualViewportAPIEnabled
{
return [self _boolValueForKey:WebKitVisualViewportAPIEnabledPreferenceKey];
Expand Down Expand Up @@ -3215,6 +3205,15 @@ - (BOOL)fetchAPIKeepAliveEnabled
return YES;
}

- (BOOL)intersectionObserverEnabled
{
return YES;
}

- (void)setIntersectionObserverEnabled:(BOOL)flag
{
}

- (void)setShadowDOMEnabled:(BOOL)flag
{
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR
@property (nonatomic) BOOL requestIdleCallbackEnabled;
@property (nonatomic) BOOL highlightAPIEnabled;
@property (nonatomic) BOOL asyncClipboardAPIEnabled;
@property (nonatomic) BOOL intersectionObserverEnabled;
@property (nonatomic) BOOL visualViewportAPIEnabled;
@property (nonatomic) BOOL syntheticEditingCommandsEnabled;
@property (nonatomic) BOOL CSSOMViewSmoothScrollingEnabled;
Expand Down Expand Up @@ -342,6 +341,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR
@property (nonatomic) BOOL isSecureContextAttributeEnabled;
@property (nonatomic) BOOL fetchAPIEnabled;
@property (nonatomic) BOOL fetchAPIKeepAliveEnabled;
@property (nonatomic) BOOL intersectionObserverEnabled;
@property (nonatomic) BOOL shadowDOMEnabled;
@property (nonatomic) BOOL customElementsEnabled;
@property (nonatomic) BOOL keygenElementEnabled;
Expand Down

0 comments on commit 9e3021a

Please sign in to comment.