Lots of sticky tests failing in WK2
[WebKit-https.git] / Source / WebCore / testing / InternalSettings.cpp
1 /*
2  * Copyright (C) 2012 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer.
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "InternalSettings.h"
28
29 #include "Document.h"
30 #include "ExceptionCode.h"
31 #include "Frame.h"
32 #include "FrameView.h"
33 #include "Language.h"
34 #include "LocaleToScriptMapping.h"
35 #include "Page.h"
36 #include "RuntimeEnabledFeatures.h"
37 #include "Settings.h"
38 #include "TextRun.h"
39
40 #if ENABLE(INPUT_TYPE_COLOR)
41 #include "ColorChooser.h"
42 #endif
43
44 #define InternalSettingsGuardForSettingsReturn(returnValue) \
45     if (!settings()) { \
46         ec = INVALID_ACCESS_ERR; \
47         return returnValue; \
48     }
49
50 #define InternalSettingsGuardForSettings()  \
51     if (!settings()) { \
52         ec = INVALID_ACCESS_ERR; \
53         return; \
54     }
55
56 #define InternalSettingsGuardForPage() \
57     if (!page()) { \
58         ec = INVALID_ACCESS_ERR; \
59         return; \
60     }
61
62 namespace WebCore {
63
64 InternalSettings::Backup::Backup(Settings* settings)
65     : m_originalPasswordEchoDurationInSeconds(settings->passwordEchoDurationInSeconds())
66     , m_originalPasswordEchoEnabled(settings->passwordEchoEnabled())
67     , m_originalFixedElementsLayoutRelativeToFrame(settings->fixedElementsLayoutRelativeToFrame())
68     , m_originalCSSExclusionsEnabled(RuntimeEnabledFeatures::cssExclusionsEnabled())
69     , m_originalCSSVariablesEnabled(settings->cssVariablesEnabled())
70 #if ENABLE(SHADOW_DOM)
71     , m_originalShadowDOMEnabled(RuntimeEnabledFeatures::shadowDOMEnabled())
72     , m_originalAuthorShadowDOMForAnyElementEnabled(RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled())
73 #endif
74 #if ENABLE(STYLE_SCOPED)
75     , m_originalStyleScoped(RuntimeEnabledFeatures::styleScopedEnabled())
76 #endif
77     , m_originalEditingBehavior(settings->editingBehaviorType())
78     , m_originalUnifiedSpellCheckerEnabled(settings->unifiedTextCheckerEnabled())
79     , m_originalFixedPositionCreatesStackingContext(settings->fixedPositionCreatesStackingContext())
80     , m_originalSyncXHRInDocumentsEnabled(settings->syncXHRInDocumentsEnabled())
81     , m_originalWindowFocusRestricted(settings->windowFocusRestricted())
82     , m_originalDeviceSupportsTouch(settings->deviceSupportsTouch())
83     , m_originalDeviceSupportsMouse(settings->deviceSupportsMouse())
84 #if ENABLE(TEXT_AUTOSIZING)
85     , m_originalTextAutosizingEnabled(settings->textAutosizingEnabled())
86     , m_originalTextAutosizingWindowSizeOverride(settings->textAutosizingWindowSizeOverride())
87     , m_originalTextAutosizingFontScaleFactor(settings->textAutosizingFontScaleFactor())
88 #endif
89     , m_originalResolutionOverride(settings->resolutionOverride())
90     , m_originalMediaTypeOverride(settings->mediaTypeOverride())
91 #if ENABLE(DIALOG_ELEMENT)
92     , m_originalDialogElementEnabled(RuntimeEnabledFeatures::dialogElementEnabled())
93 #endif
94     , m_originalForceCompositingMode(settings->forceCompositingMode())
95     , m_originalCompositingForFixedPositionEnabled(settings->acceleratedCompositingForFixedPositionEnabled())
96     , m_originalCompositingForScrollableFramesEnabled(settings->acceleratedCompositingForScrollableFramesEnabled())
97     , m_originalAcceleratedDrawingEnabled(settings->acceleratedDrawingEnabled())
98     , m_originalMockScrollbarsEnabled(settings->mockScrollbarsEnabled())
99     , m_langAttributeAwareFormControlUIEnabled(RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled())
100     , m_imagesEnabled(settings->areImagesEnabled())
101 #if ENABLE(VIDEO_TRACK)
102     , m_shouldDisplaySubtitles(settings->shouldDisplaySubtitles())
103     , m_shouldDisplayCaptions(settings->shouldDisplayCaptions())
104     , m_shouldDisplayTextDescriptions(settings->shouldDisplayTextDescriptions())
105 #endif
106 {
107 }
108
109
110 void InternalSettings::Backup::restoreTo(Settings* settings)
111 {
112     settings->setPasswordEchoDurationInSeconds(m_originalPasswordEchoDurationInSeconds);
113     settings->setPasswordEchoEnabled(m_originalPasswordEchoEnabled);
114     settings->setFixedElementsLayoutRelativeToFrame(m_originalFixedElementsLayoutRelativeToFrame);
115     RuntimeEnabledFeatures::setCSSExclusionsEnabled(m_originalCSSExclusionsEnabled);
116     settings->setCSSVariablesEnabled(m_originalCSSVariablesEnabled);
117 #if ENABLE(SHADOW_DOM)
118     RuntimeEnabledFeatures::setShadowDOMEnabled(m_originalShadowDOMEnabled);
119     RuntimeEnabledFeatures::setAuthorShadowDOMForAnyElementEnabled(m_originalAuthorShadowDOMForAnyElementEnabled);
120 #endif
121 #if ENABLE(STYLE_SCOPED)
122     RuntimeEnabledFeatures::setStyleScopedEnabled(m_originalStyleScoped);
123 #endif
124     settings->setEditingBehaviorType(m_originalEditingBehavior);
125     settings->setUnifiedTextCheckerEnabled(m_originalUnifiedSpellCheckerEnabled);
126     settings->setFixedPositionCreatesStackingContext(m_originalFixedPositionCreatesStackingContext);
127     settings->setSyncXHRInDocumentsEnabled(m_originalSyncXHRInDocumentsEnabled);
128     settings->setWindowFocusRestricted(m_originalWindowFocusRestricted);
129     settings->setDeviceSupportsTouch(m_originalDeviceSupportsTouch);
130     settings->setDeviceSupportsMouse(m_originalDeviceSupportsMouse);
131 #if ENABLE(TEXT_AUTOSIZING)
132     settings->setTextAutosizingEnabled(m_originalTextAutosizingEnabled);
133     settings->setTextAutosizingWindowSizeOverride(m_originalTextAutosizingWindowSizeOverride);
134     settings->setTextAutosizingFontScaleFactor(m_originalTextAutosizingFontScaleFactor);
135 #endif
136     settings->setResolutionOverride(m_originalResolutionOverride);
137     settings->setMediaTypeOverride(m_originalMediaTypeOverride);
138 #if ENABLE(DIALOG_ELEMENT)
139     RuntimeEnabledFeatures::setDialogElementEnabled(m_originalDialogElementEnabled);
140 #endif
141     settings->setForceCompositingMode(m_originalForceCompositingMode);
142     settings->setAcceleratedCompositingForFixedPositionEnabled(m_originalCompositingForFixedPositionEnabled);
143     settings->setAcceleratedCompositingForScrollableFramesEnabled(m_originalCompositingForScrollableFramesEnabled);
144     settings->setAcceleratedDrawingEnabled(m_originalAcceleratedDrawingEnabled);
145     settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled);
146     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttributeAwareFormControlUIEnabled);
147     settings->setImagesEnabled(m_imagesEnabled);
148 #if ENABLE(VIDEO_TRACK)
149     settings->setShouldDisplaySubtitles(m_shouldDisplaySubtitles);
150     settings->setShouldDisplayCaptions(m_shouldDisplayCaptions);
151     settings->setShouldDisplayTextDescriptions(m_shouldDisplayTextDescriptions);
152 #endif
153 }
154
155 InternalSettings* InternalSettings::from(Page* page)
156 {
157     DEFINE_STATIC_LOCAL(AtomicString, name, ("InternalSettings", AtomicString::ConstructFromLiteral));
158     if (!SuperType::from(page, name))
159         SuperType::provideTo(page, name, adoptRef(new InternalSettings(page)));
160     return static_cast<InternalSettings*>(SuperType::from(page, name));
161 }
162
163 InternalSettings::~InternalSettings()
164 {
165 }
166
167 InternalSettings::InternalSettings(Page* page)
168     : m_page(page)
169     , m_backup(page->settings())
170 {
171 }
172
173 void InternalSettings::reset()
174 {
175     page()->setPageScaleFactor(1, IntPoint(0, 0));
176     page()->setCanStartMedia(true);
177
178     m_backup.restoreTo(settings());
179     m_backup = Backup(settings());
180 }
181
182 Settings* InternalSettings::settings() const
183 {
184     if (!page())
185         return 0;
186     return page()->settings();
187 }
188
189 void InternalSettings::setForceCompositingMode(bool enabled, ExceptionCode& ec)
190 {
191     InternalSettingsGuardForSettings();
192     settings()->setForceCompositingMode(enabled);
193 }
194
195 void InternalSettings::setAcceleratedFiltersEnabled(bool enabled, ExceptionCode& ec)
196 {
197     InternalSettingsGuardForSettings();
198     settings()->setAcceleratedFiltersEnabled(enabled);
199 }
200
201 void InternalSettings::setEnableCompositingForFixedPosition(bool enabled, ExceptionCode& ec)
202 {
203     InternalSettingsGuardForSettings();
204     settings()->setAcceleratedCompositingForFixedPositionEnabled(enabled);
205 }
206
207 void InternalSettings::setEnableCompositingForScrollableFrames(bool enabled, ExceptionCode& ec)
208 {
209     InternalSettingsGuardForSettings();
210     settings()->setAcceleratedCompositingForScrollableFramesEnabled(enabled);
211 }
212
213 void InternalSettings::setEnableCompositingForOverflowScroll(bool enabled, ExceptionCode& ec)
214 {
215     InternalSettingsGuardForSettings();
216     settings()->setAcceleratedCompositingForOverflowScrollEnabled(enabled);
217 }
218
219 void InternalSettings::setAcceleratedDrawingEnabled(bool enabled, ExceptionCode& ec)
220 {
221     InternalSettingsGuardForSettings();
222     settings()->setAcceleratedDrawingEnabled(enabled);
223 }
224
225 void InternalSettings::setMockScrollbarsEnabled(bool enabled, ExceptionCode& ec)
226 {
227     InternalSettingsGuardForSettings();
228     settings()->setMockScrollbarsEnabled(enabled);
229 }
230
231 void InternalSettings::setPasswordEchoEnabled(bool enabled, ExceptionCode& ec)
232 {
233     InternalSettingsGuardForSettings();
234     settings()->setPasswordEchoEnabled(enabled);
235 }
236
237 void InternalSettings::setPasswordEchoDurationInSeconds(double durationInSeconds, ExceptionCode& ec)
238 {
239     InternalSettingsGuardForSettings();
240     settings()->setPasswordEchoDurationInSeconds(durationInSeconds);
241 }
242
243 void InternalSettings::setFixedElementsLayoutRelativeToFrame(bool enabled, ExceptionCode& ec)
244 {
245     InternalSettingsGuardForSettings();
246     settings()->setFixedElementsLayoutRelativeToFrame(enabled);
247 }
248
249 void InternalSettings::setUnifiedTextCheckingEnabled(bool enabled, ExceptionCode& ec)
250 {
251     InternalSettingsGuardForSettings();
252     settings()->setUnifiedTextCheckerEnabled(enabled);
253 }
254
255 bool InternalSettings::unifiedTextCheckingEnabled(ExceptionCode& ec)
256 {
257     InternalSettingsGuardForSettingsReturn(false);
258     return settings()->unifiedTextCheckerEnabled();
259 }
260
261 void InternalSettings::setShadowDOMEnabled(bool enabled, ExceptionCode& ec)
262 {
263 #if ENABLE(SHADOW_DOM)
264     UNUSED_PARAM(ec);
265     RuntimeEnabledFeatures::setShadowDOMEnabled(enabled);
266 #else
267     // Even SHADOW_DOM is off, InternalSettings allows setShadowDOMEnabled(false) to
268     // have broader test coverage. But it cannot be setShadowDOMEnabled(true).
269     if (enabled)
270         ec = INVALID_ACCESS_ERR;
271 #endif
272 }
273
274 void InternalSettings::setAuthorShadowDOMForAnyElementEnabled(bool isEnabled)
275 {
276 #if ENABLE(SHADOW_DOM)
277     RuntimeEnabledFeatures::setAuthorShadowDOMForAnyElementEnabled(isEnabled);
278 #else
279     UNUSED_PARAM(isEnabled);
280 #endif
281 }
282
283 void InternalSettings::setStyleScopedEnabled(bool enabled)
284 {
285 #if ENABLE(STYLE_SCOPED)
286     RuntimeEnabledFeatures::setStyleScopedEnabled(enabled);
287 #else
288     UNUSED_PARAM(enabled);
289 #endif
290 }
291
292 void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode& ec)
293 {
294 #if ENABLE(TOUCH_EVENTS)
295     InternalSettingsGuardForSettings();
296     settings()->setTouchEventEmulationEnabled(enabled);
297 #else
298     UNUSED_PARAM(enabled);
299     UNUSED_PARAM(ec);
300 #endif
301 }
302
303 void InternalSettings::setDeviceSupportsTouch(bool enabled, ExceptionCode& ec)
304 {
305     InternalSettingsGuardForSettings();
306     settings()->setDeviceSupportsTouch(enabled);
307 }
308
309 void InternalSettings::setDeviceSupportsMouse(bool enabled, ExceptionCode& ec)
310 {
311     InternalSettingsGuardForSettings();
312     settings()->setDeviceSupportsMouse(enabled);
313 }
314
315 typedef void (Settings::*SetFontFamilyFunction)(const AtomicString&, UScriptCode);
316 static void setFontFamily(Settings* settings, const String& family, const String& script, SetFontFamilyFunction setter)
317 {
318     UScriptCode code = scriptNameToCode(script);
319     if (code != USCRIPT_INVALID_CODE)
320         (settings->*setter)(family, code);
321 }
322
323 void InternalSettings::setStandardFontFamily(const String& family, const String& script, ExceptionCode& ec)
324 {
325     InternalSettingsGuardForSettings();
326     setFontFamily(settings(), family, script, &Settings::setStandardFontFamily);
327 }
328
329 void InternalSettings::setSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
330 {
331     InternalSettingsGuardForSettings();
332     setFontFamily(settings(), family, script, &Settings::setSerifFontFamily);
333 }
334
335 void InternalSettings::setSansSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
336 {
337     InternalSettingsGuardForSettings();
338     setFontFamily(settings(), family, script, &Settings::setSansSerifFontFamily);
339 }
340
341 void InternalSettings::setFixedFontFamily(const String& family, const String& script, ExceptionCode& ec)
342 {
343     InternalSettingsGuardForSettings();
344     setFontFamily(settings(), family, script, &Settings::setFixedFontFamily);
345 }
346
347 void InternalSettings::setCursiveFontFamily(const String& family, const String& script, ExceptionCode& ec)
348 {
349     InternalSettingsGuardForSettings();
350     setFontFamily(settings(), family, script, &Settings::setCursiveFontFamily);
351 }
352
353 void InternalSettings::setFantasyFontFamily(const String& family, const String& script, ExceptionCode& ec)
354 {
355     InternalSettingsGuardForSettings();
356     setFontFamily(settings(), family, script, &Settings::setFantasyFontFamily);
357 }
358
359 void InternalSettings::setPictographFontFamily(const String& family, const String& script, ExceptionCode& ec)
360 {
361     InternalSettingsGuardForSettings();
362     setFontFamily(settings(), family, script, &Settings::setPictographFontFamily);
363 }
364
365 void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionCode& ec)
366 {
367 #if ENABLE(TEXT_AUTOSIZING)
368     InternalSettingsGuardForSettings();
369     settings()->setTextAutosizingEnabled(enabled);
370 #else
371     UNUSED_PARAM(enabled);
372     UNUSED_PARAM(ec);
373 #endif
374 }
375
376 void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode& ec)
377 {
378 #if ENABLE(TEXT_AUTOSIZING)
379     InternalSettingsGuardForSettings();
380     settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height));
381 #else
382     UNUSED_PARAM(width);
383     UNUSED_PARAM(height);
384     UNUSED_PARAM(ec);
385 #endif
386 }
387
388 void InternalSettings::setResolutionOverride(int dotsPerCSSInchHorizontally, int dotsPerCSSInchVertically, ExceptionCode& ec)
389 {
390     InternalSettingsGuardForSettings();
391     // An empty size resets the override.
392     settings()->setResolutionOverride(IntSize(dotsPerCSSInchHorizontally, dotsPerCSSInchVertically));
393 }
394
395 void InternalSettings::setMediaTypeOverride(const String& mediaType, ExceptionCode& ec)
396 {
397     InternalSettingsGuardForSettings();
398     settings()->setMediaTypeOverride(mediaType);
399 }
400
401 void InternalSettings::setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode& ec)
402 {
403 #if ENABLE(TEXT_AUTOSIZING)
404     InternalSettingsGuardForSettings();
405     settings()->setTextAutosizingFontScaleFactor(fontScaleFactor);
406 #else
407     UNUSED_PARAM(fontScaleFactor);
408     UNUSED_PARAM(ec);
409 #endif
410 }
411
412 void InternalSettings::setEnableScrollAnimator(bool enabled, ExceptionCode& ec)
413 {
414 #if ENABLE(SMOOTH_SCROLLING)
415     InternalSettingsGuardForSettings();
416     settings()->setEnableScrollAnimator(enabled);
417 #else
418     UNUSED_PARAM(enabled);
419     UNUSED_PARAM(ec);
420 #endif
421 }
422
423 bool InternalSettings::scrollAnimatorEnabled(ExceptionCode& ec)
424 {
425 #if ENABLE(SMOOTH_SCROLLING)
426     InternalSettingsGuardForSettingsReturn(false);
427     return settings()->scrollAnimatorEnabled();
428 #else
429     UNUSED_PARAM(ec);
430     return false;
431 #endif
432 }
433
434 void InternalSettings::setCSSExclusionsEnabled(bool enabled, ExceptionCode& ec)
435 {
436     UNUSED_PARAM(ec);
437     RuntimeEnabledFeatures::setCSSExclusionsEnabled(enabled);
438 }
439
440 void InternalSettings::setCSSVariablesEnabled(bool enabled, ExceptionCode& ec)
441 {
442     InternalSettingsGuardForSettings();
443     settings()->setCSSVariablesEnabled(enabled);
444 }
445
446 bool InternalSettings::cssVariablesEnabled(ExceptionCode& ec)
447 {
448     InternalSettingsGuardForSettingsReturn(false);
449     return settings()->cssVariablesEnabled();
450 }
451
452 void InternalSettings::setCanStartMedia(bool enabled, ExceptionCode& ec)
453 {
454     InternalSettingsGuardForSettings();
455     m_page->setCanStartMedia(enabled);
456 }
457
458 void InternalSettings::setMediaPlaybackRequiresUserGesture(bool enabled, ExceptionCode& ec)
459 {
460     InternalSettingsGuardForSettings();
461     settings()->setMediaPlaybackRequiresUserGesture(enabled);
462 }
463
464 void InternalSettings::setEditingBehavior(const String& editingBehavior, ExceptionCode& ec)
465 {
466     InternalSettingsGuardForSettings();
467     if (equalIgnoringCase(editingBehavior, "win"))
468         settings()->setEditingBehaviorType(EditingWindowsBehavior);
469     else if (equalIgnoringCase(editingBehavior, "mac"))
470         settings()->setEditingBehaviorType(EditingMacBehavior);
471     else if (equalIgnoringCase(editingBehavior, "unix"))
472         settings()->setEditingBehaviorType(EditingUnixBehavior);
473     else
474         ec = SYNTAX_ERR;
475 }
476
477 void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, ExceptionCode& ec)
478 {
479     InternalSettingsGuardForSettings();
480     settings()->setFixedPositionCreatesStackingContext(creates);
481 }
482
483 void InternalSettings::setSyncXHRInDocumentsEnabled(bool enabled, ExceptionCode& ec)
484 {
485     InternalSettingsGuardForSettings();
486     settings()->setSyncXHRInDocumentsEnabled(enabled);
487 }
488
489 void InternalSettings::setWindowFocusRestricted(bool restricted, ExceptionCode& ec)
490 {
491     InternalSettingsGuardForSettings();
492     settings()->setWindowFocusRestricted(restricted);
493 }
494
495 void InternalSettings::setDialogElementEnabled(bool enabled, ExceptionCode& ec)
496 {
497     UNUSED_PARAM(ec);
498 #if ENABLE(DIALOG_ELEMENT)
499     RuntimeEnabledFeatures::setDialogElementEnabled(enabled);
500 #else
501     UNUSED_PARAM(enabled);
502 #endif
503 }
504
505 void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode& ec)
506 {
507     InternalSettingsGuardForSettings();
508
509 #if ENABLE(VIDEO_TRACK)
510     if (equalIgnoringCase(kind, "Subtitles"))
511         settings()->setShouldDisplaySubtitles(enabled);
512     else if (equalIgnoringCase(kind, "Captions"))
513         settings()->setShouldDisplayCaptions(enabled);
514     else if (equalIgnoringCase(kind, "TextDescriptions"))
515         settings()->setShouldDisplayTextDescriptions(enabled);
516     else
517         ec = SYNTAX_ERR;
518 #else
519     UNUSED_PARAM(kind);
520     UNUSED_PARAM(enabled);
521 #endif
522 }
523
524 bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode& ec)
525 {
526     InternalSettingsGuardForSettingsReturn(false);
527
528 #if ENABLE(VIDEO_TRACK)
529     if (equalIgnoringCase(kind, "Subtitles"))
530         return settings()->shouldDisplaySubtitles();
531     if (equalIgnoringCase(kind, "Captions"))
532         return settings()->shouldDisplayCaptions();
533     if (equalIgnoringCase(kind, "TextDescriptions"))
534         return settings()->shouldDisplayTextDescriptions();
535
536     ec = SYNTAX_ERR;
537     return false;
538 #else
539     UNUSED_PARAM(kind);
540     return false;
541 #endif
542 }
543
544 void InternalSettings::setMemoryInfoEnabled(bool enabled, ExceptionCode& ec)
545 {
546     InternalSettingsGuardForSettings();
547     settings()->setMemoryInfoEnabled(enabled);
548 }
549
550 void InternalSettings::setStorageBlockingPolicy(const String& mode, ExceptionCode& ec)
551 {
552     InternalSettingsGuardForSettings();
553
554     if (mode == "AllowAll")
555         settings()->setStorageBlockingPolicy(SecurityOrigin::AllowAllStorage);
556     else if (mode == "BlockThirdParty")
557         settings()->setStorageBlockingPolicy(SecurityOrigin::BlockThirdPartyStorage);
558     else if (mode == "BlockAll")
559         settings()->setStorageBlockingPolicy(SecurityOrigin::BlockAllStorage);
560     else
561         ec = SYNTAX_ERR;
562 }
563
564 void InternalSettings::setLangAttributeAwareFormControlUIEnabled(bool enabled)
565 {
566     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(enabled);
567 }
568
569 void InternalSettings::setImagesEnabled(bool enabled, ExceptionCode& ec)
570 {
571     InternalSettingsGuardForSettings();
572     settings()->setImagesEnabled(enabled);
573 }
574
575 }