Move more functions from internals.settings to internals
[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(Page* page, 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_canStartMedia(page->canStartMedia())
95     , m_originalForceCompositingMode(settings->forceCompositingMode())
96     , m_originalCompositingForFixedPositionEnabled(settings->acceleratedCompositingForFixedPositionEnabled())
97     , m_originalCompositingForScrollableFramesEnabled(settings->acceleratedCompositingForScrollableFramesEnabled())
98     , m_originalAcceleratedDrawingEnabled(settings->acceleratedDrawingEnabled())
99     , m_originalMockScrollbarsEnabled(settings->mockScrollbarsEnabled())
100     , m_langAttributeAwareFormControlUIEnabled(RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled())
101     , m_imagesEnabled(settings->areImagesEnabled())
102 #if ENABLE(VIDEO_TRACK)
103     , m_shouldDisplaySubtitles(settings->shouldDisplaySubtitles())
104     , m_shouldDisplayCaptions(settings->shouldDisplayCaptions())
105     , m_shouldDisplayTextDescriptions(settings->shouldDisplayTextDescriptions())
106 #endif
107 {
108 }
109
110
111 void InternalSettings::Backup::restoreTo(Page* page, Settings* settings)
112 {
113     settings->setPasswordEchoDurationInSeconds(m_originalPasswordEchoDurationInSeconds);
114     settings->setPasswordEchoEnabled(m_originalPasswordEchoEnabled);
115     settings->setFixedElementsLayoutRelativeToFrame(m_originalFixedElementsLayoutRelativeToFrame);
116     RuntimeEnabledFeatures::setCSSExclusionsEnabled(m_originalCSSExclusionsEnabled);
117     settings->setCSSVariablesEnabled(m_originalCSSVariablesEnabled);
118 #if ENABLE(SHADOW_DOM)
119     RuntimeEnabledFeatures::setShadowDOMEnabled(m_originalShadowDOMEnabled);
120     RuntimeEnabledFeatures::setAuthorShadowDOMForAnyElementEnabled(m_originalAuthorShadowDOMForAnyElementEnabled);
121 #endif
122 #if ENABLE(STYLE_SCOPED)
123     RuntimeEnabledFeatures::setStyleScopedEnabled(m_originalStyleScoped);
124 #endif
125     settings->setEditingBehaviorType(m_originalEditingBehavior);
126     settings->setUnifiedTextCheckerEnabled(m_originalUnifiedSpellCheckerEnabled);
127     settings->setFixedPositionCreatesStackingContext(m_originalFixedPositionCreatesStackingContext);
128     settings->setSyncXHRInDocumentsEnabled(m_originalSyncXHRInDocumentsEnabled);
129     settings->setWindowFocusRestricted(m_originalWindowFocusRestricted);
130     settings->setDeviceSupportsTouch(m_originalDeviceSupportsTouch);
131     settings->setDeviceSupportsMouse(m_originalDeviceSupportsMouse);
132 #if ENABLE(TEXT_AUTOSIZING)
133     settings->setTextAutosizingEnabled(m_originalTextAutosizingEnabled);
134     settings->setTextAutosizingWindowSizeOverride(m_originalTextAutosizingWindowSizeOverride);
135     settings->setTextAutosizingFontScaleFactor(m_originalTextAutosizingFontScaleFactor);
136 #endif
137     settings->setResolutionOverride(m_originalResolutionOverride);
138     settings->setMediaTypeOverride(m_originalMediaTypeOverride);
139 #if ENABLE(DIALOG_ELEMENT)
140     RuntimeEnabledFeatures::setDialogElementEnabled(m_originalDialogElementEnabled);
141 #endif
142     page->setCanStartMedia(m_canStartMedia);
143     settings->setForceCompositingMode(m_originalForceCompositingMode);
144     settings->setAcceleratedCompositingForFixedPositionEnabled(m_originalCompositingForFixedPositionEnabled);
145     settings->setAcceleratedCompositingForScrollableFramesEnabled(m_originalCompositingForScrollableFramesEnabled);
146     settings->setAcceleratedDrawingEnabled(m_originalAcceleratedDrawingEnabled);
147     settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled);
148     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttributeAwareFormControlUIEnabled);
149     settings->setImagesEnabled(m_imagesEnabled);
150 #if ENABLE(VIDEO_TRACK)
151     settings->setShouldDisplaySubtitles(m_shouldDisplaySubtitles);
152     settings->setShouldDisplayCaptions(m_shouldDisplayCaptions);
153     settings->setShouldDisplayTextDescriptions(m_shouldDisplayTextDescriptions);
154 #endif
155 }
156
157 InternalSettings* InternalSettings::from(Page* page)
158 {
159     DEFINE_STATIC_LOCAL(AtomicString, name, ("InternalSettings", AtomicString::ConstructFromLiteral));
160     if (!SuperType::from(page, name))
161         SuperType::provideTo(page, name, adoptRef(new InternalSettings(page)));
162     return static_cast<InternalSettings*>(SuperType::from(page, name));
163 }
164
165 InternalSettings::~InternalSettings()
166 {
167 }
168
169 InternalSettings::InternalSettings(Page* page)
170     : m_page(page)
171     , m_backup(page, page->settings())
172 {
173 }
174
175 void InternalSettings::reset()
176 {
177     page()->setPageScaleFactor(1, IntPoint(0, 0));
178
179     m_backup.restoreTo(page(), settings());
180     m_backup = Backup(page(), settings());
181 }
182
183 Settings* InternalSettings::settings() const
184 {
185     if (!page())
186         return 0;
187     return page()->settings();
188 }
189
190 void InternalSettings::setForceCompositingMode(bool enabled, ExceptionCode& ec)
191 {
192     InternalSettingsGuardForSettings();
193     settings()->setForceCompositingMode(enabled);
194 }
195
196 void InternalSettings::setAcceleratedFiltersEnabled(bool enabled, ExceptionCode& ec)
197 {
198     InternalSettingsGuardForSettings();
199     settings()->setAcceleratedFiltersEnabled(enabled);
200 }
201
202 void InternalSettings::setEnableCompositingForFixedPosition(bool enabled, ExceptionCode& ec)
203 {
204     InternalSettingsGuardForSettings();
205     settings()->setAcceleratedCompositingForFixedPositionEnabled(enabled);
206 }
207
208 void InternalSettings::setEnableCompositingForScrollableFrames(bool enabled, ExceptionCode& ec)
209 {
210     InternalSettingsGuardForSettings();
211     settings()->setAcceleratedCompositingForScrollableFramesEnabled(enabled);
212 }
213
214 void InternalSettings::setAcceleratedDrawingEnabled(bool enabled, ExceptionCode& ec)
215 {
216     InternalSettingsGuardForSettings();
217     settings()->setAcceleratedDrawingEnabled(enabled);
218 }
219
220 void InternalSettings::setMockScrollbarsEnabled(bool enabled, ExceptionCode& ec)
221 {
222     InternalSettingsGuardForSettings();
223     settings()->setMockScrollbarsEnabled(enabled);
224 }
225
226 void InternalSettings::setPasswordEchoEnabled(bool enabled, ExceptionCode& ec)
227 {
228     InternalSettingsGuardForSettings();
229     settings()->setPasswordEchoEnabled(enabled);
230 }
231
232 void InternalSettings::setPasswordEchoDurationInSeconds(double durationInSeconds, ExceptionCode& ec)
233 {
234     InternalSettingsGuardForSettings();
235     settings()->setPasswordEchoDurationInSeconds(durationInSeconds);
236 }
237
238 void InternalSettings::setFixedElementsLayoutRelativeToFrame(bool enabled, ExceptionCode& ec)
239 {
240     InternalSettingsGuardForSettings();
241     settings()->setFixedElementsLayoutRelativeToFrame(enabled);
242 }
243
244 void InternalSettings::setUnifiedTextCheckingEnabled(bool enabled, ExceptionCode& ec)
245 {
246     InternalSettingsGuardForSettings();
247     settings()->setUnifiedTextCheckerEnabled(enabled);
248 }
249
250 bool InternalSettings::unifiedTextCheckingEnabled(ExceptionCode& ec)
251 {
252     InternalSettingsGuardForSettingsReturn(false);
253     return settings()->unifiedTextCheckerEnabled();
254 }
255
256 void InternalSettings::setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode& ec)
257 {
258     InternalSettingsGuardForPage();
259     page()->setPageScaleFactor(scaleFactor, IntPoint(x, y));
260 }
261
262 void InternalSettings::setShadowDOMEnabled(bool enabled, ExceptionCode& ec)
263 {
264 #if ENABLE(SHADOW_DOM)
265     UNUSED_PARAM(ec);
266     RuntimeEnabledFeatures::setShadowDOMEnabled(enabled);
267 #else
268     // Even SHADOW_DOM is off, InternalSettings allows setShadowDOMEnabled(false) to
269     // have broader test coverage. But it cannot be setShadowDOMEnabled(true).
270     if (enabled)
271         ec = INVALID_ACCESS_ERR;
272 #endif
273 }
274
275 void InternalSettings::setAuthorShadowDOMForAnyElementEnabled(bool isEnabled)
276 {
277 #if ENABLE(SHADOW_DOM)
278     RuntimeEnabledFeatures::setAuthorShadowDOMForAnyElementEnabled(isEnabled);
279 #else
280     UNUSED_PARAM(isEnabled);
281 #endif
282 }
283
284 void InternalSettings::setStyleScopedEnabled(bool enabled)
285 {
286 #if ENABLE(STYLE_SCOPED)
287     RuntimeEnabledFeatures::setStyleScopedEnabled(enabled);
288 #else
289     UNUSED_PARAM(enabled);
290 #endif
291 }
292
293 void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode& ec)
294 {
295 #if ENABLE(TOUCH_EVENTS)
296     InternalSettingsGuardForSettings();
297     settings()->setTouchEventEmulationEnabled(enabled);
298 #else
299     UNUSED_PARAM(enabled);
300     UNUSED_PARAM(ec);
301 #endif
302 }
303
304 void InternalSettings::setDeviceSupportsTouch(bool enabled, ExceptionCode& ec)
305 {
306     InternalSettingsGuardForSettings();
307     settings()->setDeviceSupportsTouch(enabled);
308 }
309
310 void InternalSettings::setDeviceSupportsMouse(bool enabled, ExceptionCode& ec)
311 {
312     InternalSettingsGuardForSettings();
313     settings()->setDeviceSupportsMouse(enabled);
314 }
315
316 typedef void (Settings::*SetFontFamilyFunction)(const AtomicString&, UScriptCode);
317 static void setFontFamily(Settings* settings, const String& family, const String& script, SetFontFamilyFunction setter)
318 {
319     UScriptCode code = scriptNameToCode(script);
320     if (code != USCRIPT_INVALID_CODE)
321         (settings->*setter)(family, code);
322 }
323
324 void InternalSettings::setStandardFontFamily(const String& family, const String& script, ExceptionCode& ec)
325 {
326     InternalSettingsGuardForSettings();
327     setFontFamily(settings(), family, script, &Settings::setStandardFontFamily);
328 }
329
330 void InternalSettings::setSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
331 {
332     InternalSettingsGuardForSettings();
333     setFontFamily(settings(), family, script, &Settings::setSerifFontFamily);
334 }
335
336 void InternalSettings::setSansSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
337 {
338     InternalSettingsGuardForSettings();
339     setFontFamily(settings(), family, script, &Settings::setSansSerifFontFamily);
340 }
341
342 void InternalSettings::setFixedFontFamily(const String& family, const String& script, ExceptionCode& ec)
343 {
344     InternalSettingsGuardForSettings();
345     setFontFamily(settings(), family, script, &Settings::setFixedFontFamily);
346 }
347
348 void InternalSettings::setCursiveFontFamily(const String& family, const String& script, ExceptionCode& ec)
349 {
350     InternalSettingsGuardForSettings();
351     setFontFamily(settings(), family, script, &Settings::setCursiveFontFamily);
352 }
353
354 void InternalSettings::setFantasyFontFamily(const String& family, const String& script, ExceptionCode& ec)
355 {
356     InternalSettingsGuardForSettings();
357     setFontFamily(settings(), family, script, &Settings::setFantasyFontFamily);
358 }
359
360 void InternalSettings::setPictographFontFamily(const String& family, const String& script, ExceptionCode& ec)
361 {
362     InternalSettingsGuardForSettings();
363     setFontFamily(settings(), family, script, &Settings::setPictographFontFamily);
364 }
365
366 void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionCode& ec)
367 {
368 #if ENABLE(TEXT_AUTOSIZING)
369     InternalSettingsGuardForSettings();
370     settings()->setTextAutosizingEnabled(enabled);
371 #else
372     UNUSED_PARAM(enabled);
373     UNUSED_PARAM(ec);
374 #endif
375 }
376
377 void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode& ec)
378 {
379 #if ENABLE(TEXT_AUTOSIZING)
380     InternalSettingsGuardForSettings();
381     settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height));
382 #else
383     UNUSED_PARAM(width);
384     UNUSED_PARAM(height);
385     UNUSED_PARAM(ec);
386 #endif
387 }
388
389 void InternalSettings::setResolutionOverride(int dotsPerCSSInchHorizontally, int dotsPerCSSInchVertically, ExceptionCode& ec)
390 {
391     InternalSettingsGuardForSettings();
392     // An empty size resets the override.
393     settings()->setResolutionOverride(IntSize(dotsPerCSSInchHorizontally, dotsPerCSSInchVertically));
394 }
395
396 void InternalSettings::setMediaTypeOverride(const String& mediaType, ExceptionCode& ec)
397 {
398     InternalSettingsGuardForSettings();
399     settings()->setMediaTypeOverride(mediaType);
400 }
401
402 void InternalSettings::setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode& ec)
403 {
404 #if ENABLE(TEXT_AUTOSIZING)
405     InternalSettingsGuardForSettings();
406     settings()->setTextAutosizingFontScaleFactor(fontScaleFactor);
407 #else
408     UNUSED_PARAM(fontScaleFactor);
409     UNUSED_PARAM(ec);
410 #endif
411 }
412
413 void InternalSettings::setEnableScrollAnimator(bool enabled, ExceptionCode& ec)
414 {
415 #if ENABLE(SMOOTH_SCROLLING)
416     InternalSettingsGuardForSettings();
417     settings()->setEnableScrollAnimator(enabled);
418 #else
419     UNUSED_PARAM(enabled);
420     UNUSED_PARAM(ec);
421 #endif
422 }
423
424 bool InternalSettings::scrollAnimatorEnabled(ExceptionCode& ec)
425 {
426 #if ENABLE(SMOOTH_SCROLLING)
427     InternalSettingsGuardForSettingsReturn(false);
428     return settings()->scrollAnimatorEnabled();
429 #else
430     UNUSED_PARAM(ec);
431     return false;
432 #endif
433 }
434
435 void InternalSettings::setCSSExclusionsEnabled(bool enabled, ExceptionCode& ec)
436 {
437     UNUSED_PARAM(ec);
438     RuntimeEnabledFeatures::setCSSExclusionsEnabled(enabled);
439 }
440
441 void InternalSettings::setCSSVariablesEnabled(bool enabled, ExceptionCode& ec)
442 {
443     InternalSettingsGuardForSettings();
444     settings()->setCSSVariablesEnabled(enabled);
445 }
446
447 bool InternalSettings::cssVariablesEnabled(ExceptionCode& ec)
448 {
449     InternalSettingsGuardForSettingsReturn(false);
450     return settings()->cssVariablesEnabled();
451 }
452
453 void InternalSettings::setCanStartMedia(bool enabled, ExceptionCode& ec)
454 {
455     InternalSettingsGuardForSettings();
456     m_page->setCanStartMedia(enabled);
457 }
458
459 void InternalSettings::setMediaPlaybackRequiresUserGesture(bool enabled, ExceptionCode& ec)
460 {
461     InternalSettingsGuardForSettings();
462     settings()->setMediaPlaybackRequiresUserGesture(enabled);
463 }
464
465 void InternalSettings::setEditingBehavior(const String& editingBehavior, ExceptionCode& ec)
466 {
467     InternalSettingsGuardForSettings();
468     if (equalIgnoringCase(editingBehavior, "win"))
469         settings()->setEditingBehaviorType(EditingWindowsBehavior);
470     else if (equalIgnoringCase(editingBehavior, "mac"))
471         settings()->setEditingBehaviorType(EditingMacBehavior);
472     else if (equalIgnoringCase(editingBehavior, "unix"))
473         settings()->setEditingBehaviorType(EditingUnixBehavior);
474     else
475         ec = SYNTAX_ERR;
476 }
477
478 void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, ExceptionCode& ec)
479 {
480     InternalSettingsGuardForSettings();
481     settings()->setFixedPositionCreatesStackingContext(creates);
482 }
483
484 void InternalSettings::setSyncXHRInDocumentsEnabled(bool enabled, ExceptionCode& ec)
485 {
486     InternalSettingsGuardForSettings();
487     settings()->setSyncXHRInDocumentsEnabled(enabled);
488 }
489
490 void InternalSettings::setWindowFocusRestricted(bool restricted, ExceptionCode& ec)
491 {
492     InternalSettingsGuardForSettings();
493     settings()->setWindowFocusRestricted(restricted);
494 }
495
496 void InternalSettings::setDialogElementEnabled(bool enabled, ExceptionCode& ec)
497 {
498     UNUSED_PARAM(ec);
499 #if ENABLE(DIALOG_ELEMENT)
500     RuntimeEnabledFeatures::setDialogElementEnabled(enabled);
501 #else
502     UNUSED_PARAM(enabled);
503 #endif
504 }
505
506 void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode& ec)
507 {
508     InternalSettingsGuardForSettings();
509
510 #if ENABLE(VIDEO_TRACK)
511     if (equalIgnoringCase(kind, "Subtitles"))
512         settings()->setShouldDisplaySubtitles(enabled);
513     else if (equalIgnoringCase(kind, "Captions"))
514         settings()->setShouldDisplayCaptions(enabled);
515     else if (equalIgnoringCase(kind, "TextDescriptions"))
516         settings()->setShouldDisplayTextDescriptions(enabled);
517     else
518         ec = SYNTAX_ERR;
519 #else
520     UNUSED_PARAM(kind);
521     UNUSED_PARAM(enabled);
522 #endif
523 }
524
525 bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode& ec)
526 {
527     InternalSettingsGuardForSettingsReturn(false);
528
529 #if ENABLE(VIDEO_TRACK)
530     if (equalIgnoringCase(kind, "Subtitles"))
531         return settings()->shouldDisplaySubtitles();
532     if (equalIgnoringCase(kind, "Captions"))
533         return settings()->shouldDisplayCaptions();
534     if (equalIgnoringCase(kind, "TextDescriptions"))
535         return settings()->shouldDisplayTextDescriptions();
536
537     ec = SYNTAX_ERR;
538     return false;
539 #else
540     UNUSED_PARAM(kind);
541     return false;
542 #endif
543 }
544
545 void InternalSettings::setMemoryInfoEnabled(bool enabled, ExceptionCode& ec)
546 {
547     InternalSettingsGuardForSettings();
548     settings()->setMemoryInfoEnabled(enabled);
549 }
550
551 void InternalSettings::setStorageBlockingPolicy(const String& mode, ExceptionCode& ec)
552 {
553     InternalSettingsGuardForSettings();
554
555     if (mode == "AllowAll")
556         settings()->setStorageBlockingPolicy(SecurityOrigin::AllowAllStorage);
557     else if (mode == "BlockThirdParty")
558         settings()->setStorageBlockingPolicy(SecurityOrigin::BlockThirdPartyStorage);
559     else if (mode == "BlockAll")
560         settings()->setStorageBlockingPolicy(SecurityOrigin::BlockAllStorage);
561     else
562         ec = SYNTAX_ERR;
563 }
564
565 void InternalSettings::setLangAttributeAwareFormControlUIEnabled(bool enabled)
566 {
567     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(enabled);
568 }
569
570 void InternalSettings::setImagesEnabled(bool enabled, ExceptionCode& ec)
571 {
572     InternalSettingsGuardForSettings();
573     settings()->setImagesEnabled(enabled);
574 }
575
576 }