Move internals.settings.setPageScaleFactor to internals.setPageScaleFactor
[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::setShadowDOMEnabled(bool enabled, ExceptionCode& ec)
257 {
258 #if ENABLE(SHADOW_DOM)
259     UNUSED_PARAM(ec);
260     RuntimeEnabledFeatures::setShadowDOMEnabled(enabled);
261 #else
262     // Even SHADOW_DOM is off, InternalSettings allows setShadowDOMEnabled(false) to
263     // have broader test coverage. But it cannot be setShadowDOMEnabled(true).
264     if (enabled)
265         ec = INVALID_ACCESS_ERR;
266 #endif
267 }
268
269 void InternalSettings::setAuthorShadowDOMForAnyElementEnabled(bool isEnabled)
270 {
271 #if ENABLE(SHADOW_DOM)
272     RuntimeEnabledFeatures::setAuthorShadowDOMForAnyElementEnabled(isEnabled);
273 #else
274     UNUSED_PARAM(isEnabled);
275 #endif
276 }
277
278 void InternalSettings::setStyleScopedEnabled(bool enabled)
279 {
280 #if ENABLE(STYLE_SCOPED)
281     RuntimeEnabledFeatures::setStyleScopedEnabled(enabled);
282 #else
283     UNUSED_PARAM(enabled);
284 #endif
285 }
286
287 void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode& ec)
288 {
289 #if ENABLE(TOUCH_EVENTS)
290     InternalSettingsGuardForSettings();
291     settings()->setTouchEventEmulationEnabled(enabled);
292 #else
293     UNUSED_PARAM(enabled);
294     UNUSED_PARAM(ec);
295 #endif
296 }
297
298 void InternalSettings::setDeviceSupportsTouch(bool enabled, ExceptionCode& ec)
299 {
300     InternalSettingsGuardForSettings();
301     settings()->setDeviceSupportsTouch(enabled);
302 }
303
304 void InternalSettings::setDeviceSupportsMouse(bool enabled, ExceptionCode& ec)
305 {
306     InternalSettingsGuardForSettings();
307     settings()->setDeviceSupportsMouse(enabled);
308 }
309
310 typedef void (Settings::*SetFontFamilyFunction)(const AtomicString&, UScriptCode);
311 static void setFontFamily(Settings* settings, const String& family, const String& script, SetFontFamilyFunction setter)
312 {
313     UScriptCode code = scriptNameToCode(script);
314     if (code != USCRIPT_INVALID_CODE)
315         (settings->*setter)(family, code);
316 }
317
318 void InternalSettings::setStandardFontFamily(const String& family, const String& script, ExceptionCode& ec)
319 {
320     InternalSettingsGuardForSettings();
321     setFontFamily(settings(), family, script, &Settings::setStandardFontFamily);
322 }
323
324 void InternalSettings::setSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
325 {
326     InternalSettingsGuardForSettings();
327     setFontFamily(settings(), family, script, &Settings::setSerifFontFamily);
328 }
329
330 void InternalSettings::setSansSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
331 {
332     InternalSettingsGuardForSettings();
333     setFontFamily(settings(), family, script, &Settings::setSansSerifFontFamily);
334 }
335
336 void InternalSettings::setFixedFontFamily(const String& family, const String& script, ExceptionCode& ec)
337 {
338     InternalSettingsGuardForSettings();
339     setFontFamily(settings(), family, script, &Settings::setFixedFontFamily);
340 }
341
342 void InternalSettings::setCursiveFontFamily(const String& family, const String& script, ExceptionCode& ec)
343 {
344     InternalSettingsGuardForSettings();
345     setFontFamily(settings(), family, script, &Settings::setCursiveFontFamily);
346 }
347
348 void InternalSettings::setFantasyFontFamily(const String& family, const String& script, ExceptionCode& ec)
349 {
350     InternalSettingsGuardForSettings();
351     setFontFamily(settings(), family, script, &Settings::setFantasyFontFamily);
352 }
353
354 void InternalSettings::setPictographFontFamily(const String& family, const String& script, ExceptionCode& ec)
355 {
356     InternalSettingsGuardForSettings();
357     setFontFamily(settings(), family, script, &Settings::setPictographFontFamily);
358 }
359
360 void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionCode& ec)
361 {
362 #if ENABLE(TEXT_AUTOSIZING)
363     InternalSettingsGuardForSettings();
364     settings()->setTextAutosizingEnabled(enabled);
365 #else
366     UNUSED_PARAM(enabled);
367     UNUSED_PARAM(ec);
368 #endif
369 }
370
371 void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode& ec)
372 {
373 #if ENABLE(TEXT_AUTOSIZING)
374     InternalSettingsGuardForSettings();
375     settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height));
376 #else
377     UNUSED_PARAM(width);
378     UNUSED_PARAM(height);
379     UNUSED_PARAM(ec);
380 #endif
381 }
382
383 void InternalSettings::setResolutionOverride(int dotsPerCSSInchHorizontally, int dotsPerCSSInchVertically, ExceptionCode& ec)
384 {
385     InternalSettingsGuardForSettings();
386     // An empty size resets the override.
387     settings()->setResolutionOverride(IntSize(dotsPerCSSInchHorizontally, dotsPerCSSInchVertically));
388 }
389
390 void InternalSettings::setMediaTypeOverride(const String& mediaType, ExceptionCode& ec)
391 {
392     InternalSettingsGuardForSettings();
393     settings()->setMediaTypeOverride(mediaType);
394 }
395
396 void InternalSettings::setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode& ec)
397 {
398 #if ENABLE(TEXT_AUTOSIZING)
399     InternalSettingsGuardForSettings();
400     settings()->setTextAutosizingFontScaleFactor(fontScaleFactor);
401 #else
402     UNUSED_PARAM(fontScaleFactor);
403     UNUSED_PARAM(ec);
404 #endif
405 }
406
407 void InternalSettings::setEnableScrollAnimator(bool enabled, ExceptionCode& ec)
408 {
409 #if ENABLE(SMOOTH_SCROLLING)
410     InternalSettingsGuardForSettings();
411     settings()->setEnableScrollAnimator(enabled);
412 #else
413     UNUSED_PARAM(enabled);
414     UNUSED_PARAM(ec);
415 #endif
416 }
417
418 bool InternalSettings::scrollAnimatorEnabled(ExceptionCode& ec)
419 {
420 #if ENABLE(SMOOTH_SCROLLING)
421     InternalSettingsGuardForSettingsReturn(false);
422     return settings()->scrollAnimatorEnabled();
423 #else
424     UNUSED_PARAM(ec);
425     return false;
426 #endif
427 }
428
429 void InternalSettings::setCSSExclusionsEnabled(bool enabled, ExceptionCode& ec)
430 {
431     UNUSED_PARAM(ec);
432     RuntimeEnabledFeatures::setCSSExclusionsEnabled(enabled);
433 }
434
435 void InternalSettings::setCSSVariablesEnabled(bool enabled, ExceptionCode& ec)
436 {
437     InternalSettingsGuardForSettings();
438     settings()->setCSSVariablesEnabled(enabled);
439 }
440
441 bool InternalSettings::cssVariablesEnabled(ExceptionCode& ec)
442 {
443     InternalSettingsGuardForSettingsReturn(false);
444     return settings()->cssVariablesEnabled();
445 }
446
447 void InternalSettings::setCanStartMedia(bool enabled, ExceptionCode& ec)
448 {
449     InternalSettingsGuardForSettings();
450     m_page->setCanStartMedia(enabled);
451 }
452
453 void InternalSettings::setMediaPlaybackRequiresUserGesture(bool enabled, ExceptionCode& ec)
454 {
455     InternalSettingsGuardForSettings();
456     settings()->setMediaPlaybackRequiresUserGesture(enabled);
457 }
458
459 void InternalSettings::setEditingBehavior(const String& editingBehavior, ExceptionCode& ec)
460 {
461     InternalSettingsGuardForSettings();
462     if (equalIgnoringCase(editingBehavior, "win"))
463         settings()->setEditingBehaviorType(EditingWindowsBehavior);
464     else if (equalIgnoringCase(editingBehavior, "mac"))
465         settings()->setEditingBehaviorType(EditingMacBehavior);
466     else if (equalIgnoringCase(editingBehavior, "unix"))
467         settings()->setEditingBehaviorType(EditingUnixBehavior);
468     else
469         ec = SYNTAX_ERR;
470 }
471
472 void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, ExceptionCode& ec)
473 {
474     InternalSettingsGuardForSettings();
475     settings()->setFixedPositionCreatesStackingContext(creates);
476 }
477
478 void InternalSettings::setSyncXHRInDocumentsEnabled(bool enabled, ExceptionCode& ec)
479 {
480     InternalSettingsGuardForSettings();
481     settings()->setSyncXHRInDocumentsEnabled(enabled);
482 }
483
484 void InternalSettings::setWindowFocusRestricted(bool restricted, ExceptionCode& ec)
485 {
486     InternalSettingsGuardForSettings();
487     settings()->setWindowFocusRestricted(restricted);
488 }
489
490 void InternalSettings::setDialogElementEnabled(bool enabled, ExceptionCode& ec)
491 {
492     UNUSED_PARAM(ec);
493 #if ENABLE(DIALOG_ELEMENT)
494     RuntimeEnabledFeatures::setDialogElementEnabled(enabled);
495 #else
496     UNUSED_PARAM(enabled);
497 #endif
498 }
499
500 void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode& ec)
501 {
502     InternalSettingsGuardForSettings();
503
504 #if ENABLE(VIDEO_TRACK)
505     if (equalIgnoringCase(kind, "Subtitles"))
506         settings()->setShouldDisplaySubtitles(enabled);
507     else if (equalIgnoringCase(kind, "Captions"))
508         settings()->setShouldDisplayCaptions(enabled);
509     else if (equalIgnoringCase(kind, "TextDescriptions"))
510         settings()->setShouldDisplayTextDescriptions(enabled);
511     else
512         ec = SYNTAX_ERR;
513 #else
514     UNUSED_PARAM(kind);
515     UNUSED_PARAM(enabled);
516 #endif
517 }
518
519 bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode& ec)
520 {
521     InternalSettingsGuardForSettingsReturn(false);
522
523 #if ENABLE(VIDEO_TRACK)
524     if (equalIgnoringCase(kind, "Subtitles"))
525         return settings()->shouldDisplaySubtitles();
526     if (equalIgnoringCase(kind, "Captions"))
527         return settings()->shouldDisplayCaptions();
528     if (equalIgnoringCase(kind, "TextDescriptions"))
529         return settings()->shouldDisplayTextDescriptions();
530
531     ec = SYNTAX_ERR;
532     return false;
533 #else
534     UNUSED_PARAM(kind);
535     return false;
536 #endif
537 }
538
539 void InternalSettings::setMemoryInfoEnabled(bool enabled, ExceptionCode& ec)
540 {
541     InternalSettingsGuardForSettings();
542     settings()->setMemoryInfoEnabled(enabled);
543 }
544
545 void InternalSettings::setStorageBlockingPolicy(const String& mode, ExceptionCode& ec)
546 {
547     InternalSettingsGuardForSettings();
548
549     if (mode == "AllowAll")
550         settings()->setStorageBlockingPolicy(SecurityOrigin::AllowAllStorage);
551     else if (mode == "BlockThirdParty")
552         settings()->setStorageBlockingPolicy(SecurityOrigin::BlockThirdPartyStorage);
553     else if (mode == "BlockAll")
554         settings()->setStorageBlockingPolicy(SecurityOrigin::BlockAllStorage);
555     else
556         ec = SYNTAX_ERR;
557 }
558
559 void InternalSettings::setLangAttributeAwareFormControlUIEnabled(bool enabled)
560 {
561     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(enabled);
562 }
563
564 void InternalSettings::setImagesEnabled(bool enabled, ExceptionCode& ec)
565 {
566     InternalSettingsGuardForSettings();
567     settings()->setImagesEnabled(enabled);
568 }
569
570 }