1/*
2* THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
3*
4* Copyright (C) 2018 Apple Inc. All rights reserved.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions
8* are met:
9* 1. Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* 2. Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14*
15* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
16* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
19* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25* THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#include "config.h"
29#include "WebPreferences.h"
30
31#include "WebPreferencesKeys.h"
32
33namespace WebKit {
34
35void WebPreferences::setAllowViewportShrinkToFitContent(const bool& value)
36{
37 if (!m_store.setBoolValueForKey(WebPreferencesKey::allowViewportShrinkToFitContentKey(), value))
38 return;
39 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::allowViewportShrinkToFitContentKey(), value);
40}
41
42bool WebPreferences::allowViewportShrinkToFitContent() const
43{
44 return m_store.getBoolValueForKey(WebPreferencesKey::allowViewportShrinkToFitContentKey());
45}
46
47void WebPreferences::setApplePayRemoteUIEnabled(const bool& value)
48{
49 if (!m_store.setBoolValueForKey(WebPreferencesKey::applePayRemoteUIEnabledKey(), value))
50 return;
51 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::applePayRemoteUIEnabledKey(), value);
52}
53
54bool WebPreferences::applePayRemoteUIEnabled() const
55{
56 return m_store.getBoolValueForKey(WebPreferencesKey::applePayRemoteUIEnabledKey());
57}
58
59void WebPreferences::setAriaReflectionEnabled(const bool& value)
60{
61 if (!m_store.setBoolValueForKey(WebPreferencesKey::ariaReflectionEnabledKey(), value))
62 return;
63 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::ariaReflectionEnabledKey(), value);
64}
65
66bool WebPreferences::ariaReflectionEnabled() const
67{
68 return m_store.getBoolValueForKey(WebPreferencesKey::ariaReflectionEnabledKey());
69}
70
71void WebPreferences::setAsyncFrameScrollingEnabled(const bool& value)
72{
73 if (!m_store.setBoolValueForKey(WebPreferencesKey::asyncFrameScrollingEnabledKey(), value))
74 return;
75 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::asyncFrameScrollingEnabledKey(), value);
76}
77
78bool WebPreferences::asyncFrameScrollingEnabled() const
79{
80 return m_store.getBoolValueForKey(WebPreferencesKey::asyncFrameScrollingEnabledKey());
81}
82
83void WebPreferences::setAsyncOverflowScrollingEnabled(const bool& value)
84{
85 if (!m_store.setBoolValueForKey(WebPreferencesKey::asyncOverflowScrollingEnabledKey(), value))
86 return;
87 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::asyncOverflowScrollingEnabledKey(), value);
88}
89
90bool WebPreferences::asyncOverflowScrollingEnabled() const
91{
92 return m_store.getBoolValueForKey(WebPreferencesKey::asyncOverflowScrollingEnabledKey());
93}
94
95void WebPreferences::setBlockingOfSmallPluginsEnabled(const bool& value)
96{
97 if (!m_store.setBoolValueForKey(WebPreferencesKey::blockingOfSmallPluginsEnabledKey(), value))
98 return;
99 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::blockingOfSmallPluginsEnabledKey(), value);
100}
101
102bool WebPreferences::blockingOfSmallPluginsEnabled() const
103{
104 return m_store.getBoolValueForKey(WebPreferencesKey::blockingOfSmallPluginsEnabledKey());
105}
106
107void WebPreferences::setCSSLogicalEnabled(const bool& value)
108{
109 if (!m_store.setBoolValueForKey(WebPreferencesKey::cssLogicalEnabledKey(), value))
110 return;
111 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::cssLogicalEnabledKey(), value);
112}
113
114bool WebPreferences::cssLogicalEnabled() const
115{
116 return m_store.getBoolValueForKey(WebPreferencesKey::cssLogicalEnabledKey());
117}
118
119void WebPreferences::setCSSOMViewScrollingAPIEnabled(const bool& value)
120{
121 if (!m_store.setBoolValueForKey(WebPreferencesKey::cssOMViewScrollingAPIEnabledKey(), value))
122 return;
123 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::cssOMViewScrollingAPIEnabledKey(), value);
124}
125
126bool WebPreferences::cssOMViewScrollingAPIEnabled() const
127{
128 return m_store.getBoolValueForKey(WebPreferencesKey::cssOMViewScrollingAPIEnabledKey());
129}
130
131void WebPreferences::setCaptureAudioInUIProcessEnabled(const bool& value)
132{
133 if (!m_store.setBoolValueForKey(WebPreferencesKey::captureAudioInUIProcessEnabledKey(), value))
134 return;
135 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::captureAudioInUIProcessEnabledKey(), value);
136}
137
138bool WebPreferences::captureAudioInUIProcessEnabled() const
139{
140 return m_store.getBoolValueForKey(WebPreferencesKey::captureAudioInUIProcessEnabledKey());
141}
142
143void WebPreferences::setCaptureVideoInUIProcessEnabled(const bool& value)
144{
145 if (!m_store.setBoolValueForKey(WebPreferencesKey::captureVideoInUIProcessEnabledKey(), value))
146 return;
147 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::captureVideoInUIProcessEnabledKey(), value);
148}
149
150bool WebPreferences::captureVideoInUIProcessEnabled() const
151{
152 return m_store.getBoolValueForKey(WebPreferencesKey::captureVideoInUIProcessEnabledKey());
153}
154
155void WebPreferences::setDOMPasteAccessRequestsEnabled(const bool& value)
156{
157 if (!m_store.setBoolValueForKey(WebPreferencesKey::domPasteAccessRequestsEnabledKey(), value))
158 return;
159 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::domPasteAccessRequestsEnabledKey(), value);
160}
161
162bool WebPreferences::domPasteAccessRequestsEnabled() const
163{
164 return m_store.getBoolValueForKey(WebPreferencesKey::domPasteAccessRequestsEnabledKey());
165}
166
167void WebPreferences::setDataListElementEnabled(const bool& value)
168{
169 if (!m_store.setBoolValueForKey(WebPreferencesKey::dataListElementEnabledKey(), value))
170 return;
171 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::dataListElementEnabledKey(), value);
172}
173
174bool WebPreferences::dataListElementEnabled() const
175{
176 return m_store.getBoolValueForKey(WebPreferencesKey::dataListElementEnabledKey());
177}
178
179void WebPreferences::setExperimentalPlugInSandboxProfilesEnabled(const bool& value)
180{
181 if (!m_store.setBoolValueForKey(WebPreferencesKey::experimentalPlugInSandboxProfilesEnabledKey(), value))
182 return;
183 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::experimentalPlugInSandboxProfilesEnabledKey(), value);
184}
185
186bool WebPreferences::experimentalPlugInSandboxProfilesEnabled() const
187{
188 return m_store.getBoolValueForKey(WebPreferencesKey::experimentalPlugInSandboxProfilesEnabledKey());
189}
190
191void WebPreferences::setFastClicksEverywhere(const bool& value)
192{
193 if (!m_store.setBoolValueForKey(WebPreferencesKey::fastClicksEverywhereKey(), value))
194 return;
195 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::fastClicksEverywhereKey(), value);
196}
197
198bool WebPreferences::fastClicksEverywhere() const
199{
200 return m_store.getBoolValueForKey(WebPreferencesKey::fastClicksEverywhereKey());
201}
202
203void WebPreferences::setFasterClicksEnabled(const bool& value)
204{
205 if (!m_store.setBoolValueForKey(WebPreferencesKey::fasterClicksEnabledKey(), value))
206 return;
207 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::fasterClicksEnabledKey(), value);
208}
209
210bool WebPreferences::fasterClicksEnabled() const
211{
212 return m_store.getBoolValueForKey(WebPreferencesKey::fasterClicksEnabledKey());
213}
214
215void WebPreferences::setFrameFlatteningEnabled(const bool& value)
216{
217 if (!m_store.setBoolValueForKey(WebPreferencesKey::frameFlatteningEnabledKey(), value))
218 return;
219 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::frameFlatteningEnabledKey(), value);
220}
221
222bool WebPreferences::frameFlatteningEnabled() const
223{
224 return m_store.getBoolValueForKey(WebPreferencesKey::frameFlatteningEnabledKey());
225}
226
227void WebPreferences::setFullScreenEnabled(const bool& value)
228{
229 if (!m_store.setBoolValueForKey(WebPreferencesKey::fullScreenEnabledKey(), value))
230 return;
231 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::fullScreenEnabledKey(), value);
232}
233
234bool WebPreferences::fullScreenEnabled() const
235{
236 return m_store.getBoolValueForKey(WebPreferencesKey::fullScreenEnabledKey());
237}
238
239void WebPreferences::setInputTypeColorEnabled(const bool& value)
240{
241 if (!m_store.setBoolValueForKey(WebPreferencesKey::inputTypeColorEnabledKey(), value))
242 return;
243 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::inputTypeColorEnabledKey(), value);
244}
245
246bool WebPreferences::inputTypeColorEnabled() const
247{
248 return m_store.getBoolValueForKey(WebPreferencesKey::inputTypeColorEnabledKey());
249}
250
251void WebPreferences::setIsITPDatabaseEnabled(const bool& value)
252{
253 if (!m_store.setBoolValueForKey(WebPreferencesKey::isITPDatabaseEnabledKey(), value))
254 return;
255 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::isITPDatabaseEnabledKey(), value);
256}
257
258bool WebPreferences::isITPDatabaseEnabled() const
259{
260 return m_store.getBoolValueForKey(WebPreferencesKey::isITPDatabaseEnabledKey());
261}
262
263void WebPreferences::setIsNSURLSessionWebSocketEnabled(const bool& value)
264{
265 if (!m_store.setBoolValueForKey(WebPreferencesKey::isNSURLSessionWebSocketEnabledKey(), value))
266 return;
267 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::isNSURLSessionWebSocketEnabledKey(), value);
268}
269
270bool WebPreferences::isNSURLSessionWebSocketEnabled() const
271{
272 return m_store.getBoolValueForKey(WebPreferencesKey::isNSURLSessionWebSocketEnabledKey());
273}
274
275void WebPreferences::setLayoutFormattingContextEnabled(const bool& value)
276{
277 if (!m_store.setBoolValueForKey(WebPreferencesKey::layoutFormattingContextEnabledKey(), value))
278 return;
279 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::layoutFormattingContextEnabledKey(), value);
280}
281
282bool WebPreferences::layoutFormattingContextEnabled() const
283{
284 return m_store.getBoolValueForKey(WebPreferencesKey::layoutFormattingContextEnabledKey());
285}
286
287void WebPreferences::setLegacyOverflowScrollingTouchEnabled(const bool& value)
288{
289 if (!m_store.setBoolValueForKey(WebPreferencesKey::legacyOverflowScrollingTouchEnabledKey(), value))
290 return;
291 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::legacyOverflowScrollingTouchEnabledKey(), value);
292}
293
294bool WebPreferences::legacyOverflowScrollingTouchEnabled() const
295{
296 return m_store.getBoolValueForKey(WebPreferencesKey::legacyOverflowScrollingTouchEnabledKey());
297}
298
299void WebPreferences::setMouseEventsSimulationEnabled(const bool& value)
300{
301 if (!m_store.setBoolValueForKey(WebPreferencesKey::mouseEventsSimulationEnabledKey(), value))
302 return;
303 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::mouseEventsSimulationEnabledKey(), value);
304}
305
306bool WebPreferences::mouseEventsSimulationEnabled() const
307{
308 return m_store.getBoolValueForKey(WebPreferencesKey::mouseEventsSimulationEnabledKey());
309}
310
311void WebPreferences::setRestrictedHTTPResponseAccess(const bool& value)
312{
313 if (!m_store.setBoolValueForKey(WebPreferencesKey::restrictedHTTPResponseAccessKey(), value))
314 return;
315 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::restrictedHTTPResponseAccessKey(), value);
316}
317
318bool WebPreferences::restrictedHTTPResponseAccess() const
319{
320 return m_store.getBoolValueForKey(WebPreferencesKey::restrictedHTTPResponseAccessKey());
321}
322
323void WebPreferences::setSelectionAcrossShadowBoundariesEnabled(const bool& value)
324{
325 if (!m_store.setBoolValueForKey(WebPreferencesKey::selectionAcrossShadowBoundariesEnabledKey(), value))
326 return;
327 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::selectionAcrossShadowBoundariesEnabledKey(), value);
328}
329
330bool WebPreferences::selectionAcrossShadowBoundariesEnabled() const
331{
332 return m_store.getBoolValueForKey(WebPreferencesKey::selectionAcrossShadowBoundariesEnabledKey());
333}
334
335void WebPreferences::setServiceWorkersEnabled(const bool& value)
336{
337 if (!m_store.setBoolValueForKey(WebPreferencesKey::serviceWorkersEnabledKey(), value))
338 return;
339 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::serviceWorkersEnabledKey(), value);
340}
341
342bool WebPreferences::serviceWorkersEnabled() const
343{
344 return m_store.getBoolValueForKey(WebPreferencesKey::serviceWorkersEnabledKey());
345}
346
347void WebPreferences::setTextAutosizingUsesIdempotentMode(const bool& value)
348{
349 if (!m_store.setBoolValueForKey(WebPreferencesKey::textAutosizingUsesIdempotentModeKey(), value))
350 return;
351 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::textAutosizingUsesIdempotentModeKey(), value);
352}
353
354bool WebPreferences::textAutosizingUsesIdempotentMode() const
355{
356 return m_store.getBoolValueForKey(WebPreferencesKey::textAutosizingUsesIdempotentModeKey());
357}
358
359void WebPreferences::setUndoManagerAPIEnabled(const bool& value)
360{
361 if (!m_store.setBoolValueForKey(WebPreferencesKey::undoManagerAPIEnabledKey(), value))
362 return;
363 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::undoManagerAPIEnabledKey(), value);
364}
365
366bool WebPreferences::undoManagerAPIEnabled() const
367{
368 return m_store.getBoolValueForKey(WebPreferencesKey::undoManagerAPIEnabledKey());
369}
370
371void WebPreferences::setWebAPIStatisticsEnabled(const bool& value)
372{
373 if (!m_store.setBoolValueForKey(WebPreferencesKey::webAPIStatisticsEnabledKey(), value))
374 return;
375 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::webAPIStatisticsEnabledKey(), value);
376}
377
378bool WebPreferences::webAPIStatisticsEnabled() const
379{
380 return m_store.getBoolValueForKey(WebPreferencesKey::webAPIStatisticsEnabledKey());
381}
382
383void WebPreferences::setWebGLCompressedTextureASTCSupportEnabled(const bool& value)
384{
385 if (!m_store.setBoolValueForKey(WebPreferencesKey::webGLCompressedTextureASTCSupportEnabledKey(), value))
386 return;
387 updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::webGLCompressedTextureASTCSupportEnabledKey(), value);
388}
389
390bool WebPreferences::webGLCompressedTextureASTCSupportEnabled() const
391{
392 return m_store.getBoolValueForKey(WebPreferencesKey::webGLCompressedTextureASTCSupportEnabledKey());
393}
394
395const Vector<RefPtr<API::Object>>& WebPreferences::internalDebugFeatures()
396{
397 static NeverDestroyed<Vector<RefPtr<API::Object>>> features(std::initializer_list<RefPtr<API::Object>> {
398#if PLATFORM(IOS_FAMILY)
399 API::InternalDebugFeature::create("Allow Viewport Shrink to Fit Content", "AllowViewportShrinkToFitContent", "Allow the viewport shrink to fit content heuristic when appropriate", true, false),
400#endif
401#if ENABLE(APPLE_PAY_REMOTE_UI)
402 API::InternalDebugFeature::create("Apple Pay Remote UI", "ApplePayRemoteUIEnabled", "Enable Apple Pay Remote UI", true, false),
403#endif
404 API::InternalDebugFeature::create("ARIA Reflection", "AriaReflectionEnabled", "ARIA Reflection support", true, false),
405 API::InternalDebugFeature::create("Async Frame Scrolling", "AsyncFrameScrollingEnabled", "Perform frame scrolling off the main thread", DEFAULT_ASYNC_FRAME_SCROLLING_ENABLED, false),
406 API::InternalDebugFeature::create("Async Overflow Scrolling", "AsyncOverflowScrollingEnabled", "Perform overflow scrolling off the main thread", DEFAULT_ASYNC_OVERFLOW_SCROLLING_ENABLED, false),
407 API::InternalDebugFeature::create("Block small plugins", "BlockingOfSmallPluginsEnabled", "Stop plugins smaller than a certain threshold from loading.", true, false),
408 API::InternalDebugFeature::create("CSS Logical Properties and Values", "CSSLogicalEnabled", "Enable CSS Logical Properties and Values", false, false),
409 API::InternalDebugFeature::create("CSSOM View Scrolling API", "CSSOMViewScrollingAPIEnabled", "Implement standard behavior for scrollLeft, scrollTop, scrollWidth, scrollHeight, scrollTo, scrollBy and scrollingElement.", true, false),
410#if ENABLE(MEDIA_STREAM)
411 API::InternalDebugFeature::create("Capture audio in UIProcess", "CaptureAudioInUIProcessEnabled", "Enable audio capture in UIProcess", DEFAULT_CAPTURE_AUDIO_IN_UIPROCESS, false),
412#endif
413#if ENABLE(MEDIA_STREAM)
414 API::InternalDebugFeature::create("Capture video in UIProcess", "CaptureVideoInUIProcessEnabled", "Enable video capture in UIProcess", false, false),
415#endif
416 API::InternalDebugFeature::create("DOM Paste Access Requests", "DOMPasteAccessRequestsEnabled", "Enable DOM Paste Access Requests", DEFAULT_DOM_PASTE_ACCESS_REQUESTS_ENABLED, false),
417#if ENABLE(DATALIST_ELEMENT)
418 API::InternalDebugFeature::create("DataList Element", "DataListElementEnabled", "Enable datalist elements", DEFAULT_DATALIST_ELEMENT_ENABLED, false),
419#endif
420 API::InternalDebugFeature::create("Sandbox Plug-Ins", "ExperimentalPlugInSandboxProfilesEnabled", "Enable Plug-In sandboxing", false, false),
421#if PLATFORM(IOS_FAMILY)
422 API::InternalDebugFeature::create("Fast clicks everywhere", "FastClicksEverywhere", "Force fast clicks on all pages", DEFAULT_FAST_CLICKS_EVERYWHERE, false),
423#endif
424#if PLATFORM(IOS_FAMILY)
425 API::InternalDebugFeature::create("Faster clicks", "FasterClicksEnabled", "Support faster clicks on zoomable pages", true, false),
426#endif
427 API::InternalDebugFeature::create("Frame flattening", "FrameFlatteningEnabled", "Enable frame flattening, which adjusts the height of an iframe to fit its contents", DEFAULT_FRAME_FLATTENING, false),
428#if ENABLE(FULLSCREEN_API)
429 API::InternalDebugFeature::create("Fullscreen API", "FullScreenEnabled", "Fullscreen API", false, EXPERIMENTAL_FULLSCREEN_API_HIDDEN),
430#endif
431#if ENABLE(INPUT_TYPE_COLOR)
432 API::InternalDebugFeature::create("Color Inputs", "InputTypeColorEnabled", "Enable input elements of type color", DEFAULT_INPUT_TYPE_COLOR_ENABLED, false),
433#endif
434 API::InternalDebugFeature::create("ITP Database Backend", "IsITPDatabaseEnabled", "Enable Intelligent Tracking Prevention Database Backend", false, false),
435#if HAVE(NSURLSESSION_WEBSOCKET)
436 API::InternalDebugFeature::create("NSURLSession WebSocket", "IsNSURLSessionWebSocketEnabled", "Use NSURLSession WebSocket API", false, false),
437#endif
438#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
439 API::InternalDebugFeature::create("Next-gen layout", "LayoutFormattingContextEnabled", "Enable next-gen layout", false, false),
440#endif
441#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
442 API::InternalDebugFeature::create("Legacy -webkit-overflow-scrolling property", "LegacyOverflowScrollingTouchEnabled", "Support the legacy -webkit-overflow-scrolling CSS property", true, false),
443#endif
444#if ENABLE(TOUCH_EVENTS)
445 API::InternalDebugFeature::create("Mouse events simulation", "MouseEventsSimulationEnabled", "Enable mouse events dispatch along with touch events on iOS", false, false),
446#endif
447 API::InternalDebugFeature::create("Filter HTTP Response for WebProcesses", "RestrictedHTTPResponseAccess", "Enable HTTP Response filtering for WebProcesses", true, false),
448 API::InternalDebugFeature::create("Selection across shadow DOM", "SelectionAcrossShadowBoundariesEnabled", "Allow user-initiated selection across shadow DOM boundaries", true, false),
449#if ENABLE(SERVICE_WORKER)
450 API::InternalDebugFeature::create("Service Workers", "ServiceWorkersEnabled", "Enable Service Workers", DEFAULT_SERVICE_WORKERS_ENABLED, false),
451#endif
452#if ENABLE(TEXT_AUTOSIZING)
453 API::InternalDebugFeature::create("Idempotent Text Autosizing", "TextAutosizingUsesIdempotentMode", "Use idempotent text autosizing mode", defaultTextAutosizingUsesIdempotentMode(), false),
454#endif
455 API::InternalDebugFeature::create("UndoManager DOM API", "UndoManagerAPIEnabled", "Enable the UndoManager DOM API", false, false),
456 API::InternalDebugFeature::create("Web API Statistics", "WebAPIStatisticsEnabled", "Enable Web API Statistics", false, false),
457 API::InternalDebugFeature::create("ASTC Texture Support", "WebGLCompressedTextureASTCSupportEnabled", "Support for ASTC compressed texture formats in WebGL", false, false),
458 });
459
460 return features;
461}
462
463bool WebPreferences::isFeatureEnabled(const API::InternalDebugFeature& feature) const
464{
465 struct FeatureGetterMapping {
466 const char* name;
467 bool (WebPreferences::*function) () const;
468 };
469
470 static FeatureGetterMapping getters[] = {
471#if PLATFORM(IOS_FAMILY)
472 { "AllowViewportShrinkToFitContent", &WebPreferences::allowViewportShrinkToFitContent },
473#endif
474#if ENABLE(APPLE_PAY_REMOTE_UI)
475 { "ApplePayRemoteUIEnabled", &WebPreferences::applePayRemoteUIEnabled },
476#endif
477 { "AriaReflectionEnabled", &WebPreferences::ariaReflectionEnabled },
478 { "AsyncFrameScrollingEnabled", &WebPreferences::asyncFrameScrollingEnabled },
479 { "AsyncOverflowScrollingEnabled", &WebPreferences::asyncOverflowScrollingEnabled },
480 { "BlockingOfSmallPluginsEnabled", &WebPreferences::blockingOfSmallPluginsEnabled },
481 { "CSSLogicalEnabled", &WebPreferences::cssLogicalEnabled },
482 { "CSSOMViewScrollingAPIEnabled", &WebPreferences::cssOMViewScrollingAPIEnabled },
483#if ENABLE(MEDIA_STREAM)
484 { "CaptureAudioInUIProcessEnabled", &WebPreferences::captureAudioInUIProcessEnabled },
485#endif
486#if ENABLE(MEDIA_STREAM)
487 { "CaptureVideoInUIProcessEnabled", &WebPreferences::captureVideoInUIProcessEnabled },
488#endif
489 { "DOMPasteAccessRequestsEnabled", &WebPreferences::domPasteAccessRequestsEnabled },
490#if ENABLE(DATALIST_ELEMENT)
491 { "DataListElementEnabled", &WebPreferences::dataListElementEnabled },
492#endif
493 { "ExperimentalPlugInSandboxProfilesEnabled", &WebPreferences::experimentalPlugInSandboxProfilesEnabled },
494#if PLATFORM(IOS_FAMILY)
495 { "FastClicksEverywhere", &WebPreferences::fastClicksEverywhere },
496#endif
497#if PLATFORM(IOS_FAMILY)
498 { "FasterClicksEnabled", &WebPreferences::fasterClicksEnabled },
499#endif
500 { "FrameFlatteningEnabled", &WebPreferences::frameFlatteningEnabled },
501#if ENABLE(FULLSCREEN_API)
502 { "FullScreenEnabled", &WebPreferences::fullScreenEnabled },
503#endif
504#if ENABLE(INPUT_TYPE_COLOR)
505 { "InputTypeColorEnabled", &WebPreferences::inputTypeColorEnabled },
506#endif
507 { "IsITPDatabaseEnabled", &WebPreferences::isITPDatabaseEnabled },
508#if HAVE(NSURLSESSION_WEBSOCKET)
509 { "IsNSURLSessionWebSocketEnabled", &WebPreferences::isNSURLSessionWebSocketEnabled },
510#endif
511#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
512 { "LayoutFormattingContextEnabled", &WebPreferences::layoutFormattingContextEnabled },
513#endif
514#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
515 { "LegacyOverflowScrollingTouchEnabled", &WebPreferences::legacyOverflowScrollingTouchEnabled },
516#endif
517#if ENABLE(TOUCH_EVENTS)
518 { "MouseEventsSimulationEnabled", &WebPreferences::mouseEventsSimulationEnabled },
519#endif
520 { "RestrictedHTTPResponseAccess", &WebPreferences::restrictedHTTPResponseAccess },
521 { "SelectionAcrossShadowBoundariesEnabled", &WebPreferences::selectionAcrossShadowBoundariesEnabled },
522#if ENABLE(SERVICE_WORKER)
523 { "ServiceWorkersEnabled", &WebPreferences::serviceWorkersEnabled },
524#endif
525#if ENABLE(TEXT_AUTOSIZING)
526 { "TextAutosizingUsesIdempotentMode", &WebPreferences::textAutosizingUsesIdempotentMode },
527#endif
528 { "UndoManagerAPIEnabled", &WebPreferences::undoManagerAPIEnabled },
529 { "WebAPIStatisticsEnabled", &WebPreferences::webAPIStatisticsEnabled },
530 { "WebGLCompressedTextureASTCSupportEnabled", &WebPreferences::webGLCompressedTextureASTCSupportEnabled },
531 };
532
533 const String& key = feature.key();
534
535 for (auto& getter : getters) {
536 if (key == getter.name)
537 return (this->*getter.function)();
538 }
539
540 return false;
541}
542
543void WebPreferences::setFeatureEnabled(const API::InternalDebugFeature& feature, bool value)
544{
545 setInternalDebugFeatureEnabledForKey(feature.key(), value);
546}
547
548void WebPreferences::setInternalDebugFeatureEnabledForKey(const String& key, bool value)
549{
550 struct FeatureSetterMapping {
551 const char* name;
552 void (WebPreferences::*function) (const bool&);
553 };
554
555 static FeatureSetterMapping setters[] = {
556#if PLATFORM(IOS_FAMILY)
557 { "AllowViewportShrinkToFitContent", &WebPreferences::setAllowViewportShrinkToFitContent },
558#endif
559#if ENABLE(APPLE_PAY_REMOTE_UI)
560 { "ApplePayRemoteUIEnabled", &WebPreferences::setApplePayRemoteUIEnabled },
561#endif
562 { "AriaReflectionEnabled", &WebPreferences::setAriaReflectionEnabled },
563 { "AsyncFrameScrollingEnabled", &WebPreferences::setAsyncFrameScrollingEnabled },
564 { "AsyncOverflowScrollingEnabled", &WebPreferences::setAsyncOverflowScrollingEnabled },
565 { "BlockingOfSmallPluginsEnabled", &WebPreferences::setBlockingOfSmallPluginsEnabled },
566 { "CSSLogicalEnabled", &WebPreferences::setCSSLogicalEnabled },
567 { "CSSOMViewScrollingAPIEnabled", &WebPreferences::setCSSOMViewScrollingAPIEnabled },
568#if ENABLE(MEDIA_STREAM)
569 { "CaptureAudioInUIProcessEnabled", &WebPreferences::setCaptureAudioInUIProcessEnabled },
570#endif
571#if ENABLE(MEDIA_STREAM)
572 { "CaptureVideoInUIProcessEnabled", &WebPreferences::setCaptureVideoInUIProcessEnabled },
573#endif
574 { "DOMPasteAccessRequestsEnabled", &WebPreferences::setDOMPasteAccessRequestsEnabled },
575#if ENABLE(DATALIST_ELEMENT)
576 { "DataListElementEnabled", &WebPreferences::setDataListElementEnabled },
577#endif
578 { "ExperimentalPlugInSandboxProfilesEnabled", &WebPreferences::setExperimentalPlugInSandboxProfilesEnabled },
579#if PLATFORM(IOS_FAMILY)
580 { "FastClicksEverywhere", &WebPreferences::setFastClicksEverywhere },
581#endif
582#if PLATFORM(IOS_FAMILY)
583 { "FasterClicksEnabled", &WebPreferences::setFasterClicksEnabled },
584#endif
585 { "FrameFlatteningEnabled", &WebPreferences::setFrameFlatteningEnabled },
586#if ENABLE(FULLSCREEN_API)
587 { "FullScreenEnabled", &WebPreferences::setFullScreenEnabled },
588#endif
589#if ENABLE(INPUT_TYPE_COLOR)
590 { "InputTypeColorEnabled", &WebPreferences::setInputTypeColorEnabled },
591#endif
592 { "IsITPDatabaseEnabled", &WebPreferences::setIsITPDatabaseEnabled },
593#if HAVE(NSURLSESSION_WEBSOCKET)
594 { "IsNSURLSessionWebSocketEnabled", &WebPreferences::setIsNSURLSessionWebSocketEnabled },
595#endif
596#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
597 { "LayoutFormattingContextEnabled", &WebPreferences::setLayoutFormattingContextEnabled },
598#endif
599#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
600 { "LegacyOverflowScrollingTouchEnabled", &WebPreferences::setLegacyOverflowScrollingTouchEnabled },
601#endif
602#if ENABLE(TOUCH_EVENTS)
603 { "MouseEventsSimulationEnabled", &WebPreferences::setMouseEventsSimulationEnabled },
604#endif
605 { "RestrictedHTTPResponseAccess", &WebPreferences::setRestrictedHTTPResponseAccess },
606 { "SelectionAcrossShadowBoundariesEnabled", &WebPreferences::setSelectionAcrossShadowBoundariesEnabled },
607#if ENABLE(SERVICE_WORKER)
608 { "ServiceWorkersEnabled", &WebPreferences::setServiceWorkersEnabled },
609#endif
610#if ENABLE(TEXT_AUTOSIZING)
611 { "TextAutosizingUsesIdempotentMode", &WebPreferences::setTextAutosizingUsesIdempotentMode },
612#endif
613 { "UndoManagerAPIEnabled", &WebPreferences::setUndoManagerAPIEnabled },
614 { "WebAPIStatisticsEnabled", &WebPreferences::setWebAPIStatisticsEnabled },
615 { "WebGLCompressedTextureASTCSupportEnabled", &WebPreferences::setWebGLCompressedTextureASTCSupportEnabled },
616 };
617
618 for (auto& setter : setters) {
619 if (key == setter.name) {
620 (this->*setter.function)(value);
621 return;
622 }
623 }
624}
625
626void WebPreferences::resetAllInternalDebugFeatures()
627{
628#if PLATFORM(IOS_FAMILY)
629 setAllowViewportShrinkToFitContent(true);
630#endif
631#if ENABLE(APPLE_PAY_REMOTE_UI)
632 setApplePayRemoteUIEnabled(true);
633#endif
634 setAriaReflectionEnabled(true);
635 setAsyncFrameScrollingEnabled(DEFAULT_ASYNC_FRAME_SCROLLING_ENABLED);
636 setAsyncOverflowScrollingEnabled(DEFAULT_ASYNC_OVERFLOW_SCROLLING_ENABLED);
637 setBlockingOfSmallPluginsEnabled(true);
638 setCSSLogicalEnabled(false);
639 setCSSOMViewScrollingAPIEnabled(true);
640#if ENABLE(MEDIA_STREAM)
641 setCaptureAudioInUIProcessEnabled(DEFAULT_CAPTURE_AUDIO_IN_UIPROCESS);
642#endif
643#if ENABLE(MEDIA_STREAM)
644 setCaptureVideoInUIProcessEnabled(false);
645#endif
646 setDOMPasteAccessRequestsEnabled(DEFAULT_DOM_PASTE_ACCESS_REQUESTS_ENABLED);
647#if ENABLE(DATALIST_ELEMENT)
648 setDataListElementEnabled(DEFAULT_DATALIST_ELEMENT_ENABLED);
649#endif
650 setExperimentalPlugInSandboxProfilesEnabled(false);
651#if PLATFORM(IOS_FAMILY)
652 setFastClicksEverywhere(DEFAULT_FAST_CLICKS_EVERYWHERE);
653#endif
654#if PLATFORM(IOS_FAMILY)
655 setFasterClicksEnabled(true);
656#endif
657 setFrameFlatteningEnabled(DEFAULT_FRAME_FLATTENING);
658#if ENABLE(FULLSCREEN_API)
659 setFullScreenEnabled(false);
660#endif
661#if ENABLE(INPUT_TYPE_COLOR)
662 setInputTypeColorEnabled(DEFAULT_INPUT_TYPE_COLOR_ENABLED);
663#endif
664 setIsITPDatabaseEnabled(false);
665#if HAVE(NSURLSESSION_WEBSOCKET)
666 setIsNSURLSessionWebSocketEnabled(false);
667#endif
668#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
669 setLayoutFormattingContextEnabled(false);
670#endif
671#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
672 setLegacyOverflowScrollingTouchEnabled(true);
673#endif
674#if ENABLE(TOUCH_EVENTS)
675 setMouseEventsSimulationEnabled(false);
676#endif
677 setRestrictedHTTPResponseAccess(true);
678 setSelectionAcrossShadowBoundariesEnabled(true);
679#if ENABLE(SERVICE_WORKER)
680 setServiceWorkersEnabled(DEFAULT_SERVICE_WORKERS_ENABLED);
681#endif
682#if ENABLE(TEXT_AUTOSIZING)
683 setTextAutosizingUsesIdempotentMode(defaultTextAutosizingUsesIdempotentMode());
684#endif
685 setUndoManagerAPIEnabled(false);
686 setWebAPIStatisticsEnabled(false);
687 setWebGLCompressedTextureASTCSupportEnabled(false);
688}
689
690}
691