Unreviewed, rolling out r124000.
[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 "CachedResourceLoader.h"
30 #include "Chrome.h"
31 #include "ChromeClient.h"
32 #include "Document.h"
33 #include "ExceptionCode.h"
34 #include "Frame.h"
35 #include "FrameView.h"
36 #include "InspectorController.h"
37 #include "Language.h"
38 #include "LocaleToScriptMapping.h"
39 #include "MockPagePopupDriver.h"
40 #include "Page.h"
41 #include "RuntimeEnabledFeatures.h"
42 #include "Settings.h"
43 #include "TextRun.h"
44
45 #if ENABLE(INPUT_TYPE_COLOR)
46 #include "ColorChooser.h"
47 #endif
48
49 #define InternalSettingsGuardForSettingsReturn(returnValue) \
50     if (!settings()) { \
51         ec = INVALID_ACCESS_ERR; \
52         return returnValue; \
53     }
54
55 #define InternalSettingsGuardForSettings()  \
56     if (!settings()) { \
57         ec = INVALID_ACCESS_ERR; \
58         return; \
59     }
60
61 #define InternalSettingsGuardForPageReturn(returnValue) \
62     if (!page()) { \
63         ec = INVALID_ACCESS_ERR; \
64         return returnValue; \
65     }
66
67 #define InternalSettingsGuardForPage() \
68     if (!page()) { \
69         ec = INVALID_ACCESS_ERR; \
70         return; \
71     }
72
73 namespace WebCore {
74
75 InternalSettings::Backup::Backup(Page* page, Settings* settings)
76     : m_originalPasswordEchoDurationInSeconds(settings->passwordEchoDurationInSeconds())
77     , m_originalPasswordEchoEnabled(settings->passwordEchoEnabled())
78     , m_originalCSSExclusionsEnabled(RuntimeEnabledFeatures::cssExclusionsEnabled())
79 #if ENABLE(SHADOW_DOM)
80     , m_originalShadowDOMEnabled(RuntimeEnabledFeatures::shadowDOMEnabled())
81 #endif
82     , m_originalEditingBehavior(settings->editingBehaviorType())
83     , m_originalFixedPositionCreatesStackingContext(settings->fixedPositionCreatesStackingContext())
84     , m_originalSyncXHRInDocumentsEnabled(settings->syncXHRInDocumentsEnabled())
85 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
86     , m_originalJavaScriptProfilingEnabled(page->inspectorController() && page->inspectorController()->profilerEnabled())
87 #endif
88     , m_originalWindowFocusRestricted(settings->windowFocusRestricted())
89     , m_originalDeviceSupportsTouch(settings->deviceSupportsTouch())
90     , m_originalDeviceSupportsMouse(settings->deviceSupportsMouse())
91 #if ENABLE(TEXT_AUTOSIZING)
92     , m_originalTextAutosizingEnabled(settings->textAutosizingEnabled())
93     , m_originalTextAutosizingWindowSizeOverride(settings->textAutosizingWindowSizeOverride())
94 #endif
95 #if ENABLE(DIALOG_ELEMENT)
96     , m_originalDialogElementEnabled(RuntimeEnabledFeatures::dialogElementEnabled())
97 #endif
98 {
99 }
100
101
102 void InternalSettings::Backup::restoreTo(Page* page, Settings* settings)
103 {
104     settings->setPasswordEchoDurationInSeconds(m_originalPasswordEchoDurationInSeconds);
105     settings->setPasswordEchoEnabled(m_originalPasswordEchoEnabled);
106     RuntimeEnabledFeatures::setCSSExclusionsEnabled(m_originalCSSExclusionsEnabled);
107 #if ENABLE(SHADOW_DOM)
108     RuntimeEnabledFeatures::setShadowDOMEnabled(m_originalShadowDOMEnabled);
109 #endif
110     settings->setEditingBehaviorType(m_originalEditingBehavior);
111     settings->setFixedPositionCreatesStackingContext(m_originalFixedPositionCreatesStackingContext);
112     settings->setSyncXHRInDocumentsEnabled(m_originalSyncXHRInDocumentsEnabled);
113 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
114     if (page->inspectorController())
115         page->inspectorController()->setProfilerEnabled(m_originalJavaScriptProfilingEnabled);
116 #endif
117     settings->setWindowFocusRestricted(m_originalWindowFocusRestricted);
118     settings->setDeviceSupportsTouch(m_originalDeviceSupportsTouch);
119     settings->setDeviceSupportsMouse(m_originalDeviceSupportsMouse);
120 #if ENABLE(TEXT_AUTOSIZING)
121     settings->setTextAutosizingEnabled(m_originalTextAutosizingEnabled);
122     settings->setTextAutosizingWindowSizeOverride(m_originalTextAutosizingWindowSizeOverride);
123 #endif
124 #if ENABLE(DIALOG_ELEMENT)
125     RuntimeEnabledFeatures::setDialogElementEnabled(m_originalDialogElementEnabled);
126 #endif
127 }
128
129 InternalSettings* InternalSettings::from(Page* page)
130 {
131     DEFINE_STATIC_LOCAL(AtomicString, name, ("InternalSettings"));
132     if (!SuperType::from(page, name))
133         SuperType::provideTo(page, name, adoptRef(new InternalSettings(page)));
134     return static_cast<InternalSettings*>(SuperType::from(page, name));
135 }
136
137 InternalSettings::~InternalSettings()
138 {
139 }
140
141 InternalSettings::InternalSettings(Page* page)
142     : m_page(page)
143     , m_backup(page, page->settings())
144 {
145 }
146
147 #if ENABLE(PAGE_POPUP)
148 PagePopupController* InternalSettings::pagePopupController()
149 {
150     return m_pagePopupDriver ? m_pagePopupDriver->pagePopupController() : 0;
151 }
152 #endif
153
154 void InternalSettings::reset()
155 {
156     TextRun::setAllowsRoundingHacks(false);
157     setUserPreferredLanguages(Vector<String>());
158     page()->setPagination(Page::Pagination());
159     page()->setPageScaleFactor(1, IntPoint(0, 0));
160 #if ENABLE(PAGE_POPUP)
161     m_pagePopupDriver.clear();
162     if (page()->chrome())
163         page()->chrome()->client()->resetPagePopupDriver();
164 #endif
165
166     m_backup.restoreTo(page(), settings());
167     m_backup = Backup(page(), settings());
168 }
169
170 Settings* InternalSettings::settings() const
171 {
172     if (!page())
173         return 0;
174     return page()->settings();
175 }
176
177 void InternalSettings::setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode& ec)
178 {
179 #if ENABLE(INSPECTOR)
180     if (!page() || !page()->inspectorController()) {
181         ec = INVALID_ACCESS_ERR;
182         return;
183     }
184     page()->inspectorController()->setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize);
185 #else
186     UNUSED_PARAM(maximumResourcesContentSize);
187     UNUSED_PARAM(maximumSingleResourceContentSize);
188     UNUSED_PARAM(ec);
189 #endif
190 }
191
192 void InternalSettings::setForceCompositingMode(bool enabled, ExceptionCode& ec)
193 {
194     InternalSettingsGuardForSettings();
195     settings()->setForceCompositingMode(enabled);
196 }
197
198 void InternalSettings::setAcceleratedFiltersEnabled(bool enabled, ExceptionCode& ec)
199 {
200     InternalSettingsGuardForSettings();
201     settings()->setAcceleratedFiltersEnabled(enabled);
202 }
203
204 void InternalSettings::setEnableCompositingForFixedPosition(bool enabled, ExceptionCode& ec)
205 {
206     InternalSettingsGuardForSettings();
207     settings()->setAcceleratedCompositingForFixedPositionEnabled(enabled);
208 }
209
210 void InternalSettings::setEnableCompositingForScrollableFrames(bool enabled, ExceptionCode& ec)
211 {
212     InternalSettingsGuardForSettings();
213     settings()->setAcceleratedCompositingForScrollableFramesEnabled(enabled);
214 }
215
216 void InternalSettings::setAcceleratedDrawingEnabled(bool enabled, ExceptionCode& ec)
217 {
218     InternalSettingsGuardForSettings();
219     settings()->setAcceleratedDrawingEnabled(enabled);
220 }
221
222 void InternalSettings::setMockScrollbarsEnabled(bool enabled, ExceptionCode& ec)
223 {
224     InternalSettingsGuardForSettings();
225     settings()->setMockScrollbarsEnabled(enabled);
226 }
227
228 void InternalSettings::setPasswordEchoEnabled(bool enabled, ExceptionCode& ec)
229 {
230     InternalSettingsGuardForSettings();
231     settings()->setPasswordEchoEnabled(enabled);
232 }
233
234 void InternalSettings::setPasswordEchoDurationInSeconds(double durationInSeconds, ExceptionCode& ec)
235 {
236     InternalSettingsGuardForSettings();
237     settings()->setPasswordEchoDurationInSeconds(durationInSeconds);
238 }
239
240 void InternalSettings::setFixedElementsLayoutRelativeToFrame(bool enabled, ExceptionCode& ec)
241 {
242     InternalSettingsGuardForSettings();
243     settings()->setFixedElementsLayoutRelativeToFrame(enabled);
244 }
245
246 void InternalSettings::setUnifiedTextCheckingEnabled(bool enabled, ExceptionCode& ec)
247 {
248     InternalSettingsGuardForSettings();
249     settings()->setUnifiedTextCheckerEnabled(enabled);
250 }
251
252 bool InternalSettings::unifiedTextCheckingEnabled(ExceptionCode& ec)
253 {
254     InternalSettingsGuardForSettingsReturn(false);
255     return settings()->unifiedTextCheckerEnabled();
256 }
257
258 void InternalSettings::setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode& ec)
259 {
260     InternalSettingsGuardForPage();
261     page()->setPageScaleFactor(scaleFactor, IntPoint(x, y));
262 }
263
264 void InternalSettings::setShadowDOMEnabled(bool enabled, ExceptionCode& ec)
265 {
266 #if ENABLE(SHADOW_DOM)
267     UNUSED_PARAM(ec);
268     RuntimeEnabledFeatures::setShadowDOMEnabled(enabled);
269 #else
270     // Even SHADOW_DOM is off, InternalSettings allows setShadowDOMEnabled(false) to
271     // have broader test coverage. But it cannot be setShadowDOMEnabled(true).
272     if (enabled)
273         ec = INVALID_ACCESS_ERR;
274 #endif
275 }
276
277 void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode& ec)
278 {
279 #if ENABLE(TOUCH_EVENTS)
280     InternalSettingsGuardForSettings();
281     settings()->setTouchEventEmulationEnabled(enabled);
282 #else
283     UNUSED_PARAM(enabled);
284     UNUSED_PARAM(ec);
285 #endif
286 }
287
288 void InternalSettings::setDeviceSupportsTouch(bool enabled, ExceptionCode& ec)
289 {
290     InternalSettingsGuardForSettings();
291     settings()->setDeviceSupportsTouch(enabled);
292 }
293
294 void InternalSettings::setDeviceSupportsMouse(bool enabled, ExceptionCode& ec)
295 {
296     InternalSettingsGuardForSettings();
297     settings()->setDeviceSupportsMouse(enabled);
298 }
299
300 typedef void (Settings::*SetFontFamilyFunction)(const AtomicString&, UScriptCode);
301 static void setFontFamily(Settings* settings, const String& family, const String& script, SetFontFamilyFunction setter)
302 {
303     UScriptCode code = scriptNameToCode(script);
304     if (code != USCRIPT_INVALID_CODE)
305         (settings->*setter)(family, code);
306 }
307
308 void InternalSettings::setStandardFontFamily(const String& family, const String& script, ExceptionCode& ec)
309 {
310     InternalSettingsGuardForSettings();
311     setFontFamily(settings(), family, script, &Settings::setStandardFontFamily);
312 }
313
314 void InternalSettings::setSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
315 {
316     InternalSettingsGuardForSettings();
317     setFontFamily(settings(), family, script, &Settings::setSerifFontFamily);
318 }
319
320 void InternalSettings::setSansSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
321 {
322     InternalSettingsGuardForSettings();
323     setFontFamily(settings(), family, script, &Settings::setSansSerifFontFamily);
324 }
325
326 void InternalSettings::setFixedFontFamily(const String& family, const String& script, ExceptionCode& ec)
327 {
328     InternalSettingsGuardForSettings();
329     setFontFamily(settings(), family, script, &Settings::setFixedFontFamily);
330 }
331
332 void InternalSettings::setCursiveFontFamily(const String& family, const String& script, ExceptionCode& ec)
333 {
334     InternalSettingsGuardForSettings();
335     setFontFamily(settings(), family, script, &Settings::setCursiveFontFamily);
336 }
337
338 void InternalSettings::setFantasyFontFamily(const String& family, const String& script, ExceptionCode& ec)
339 {
340     InternalSettingsGuardForSettings();
341     setFontFamily(settings(), family, script, &Settings::setFantasyFontFamily);
342 }
343
344 void InternalSettings::setPictographFontFamily(const String& family, const String& script, ExceptionCode& ec)
345 {
346     InternalSettingsGuardForSettings();
347     setFontFamily(settings(), family, script, &Settings::setPictographFontFamily);
348 }
349
350 void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionCode& ec)
351 {
352 #if ENABLE(TEXT_AUTOSIZING)
353     InternalSettingsGuardForSettings();
354     settings()->setTextAutosizingEnabled(enabled);
355 #else
356     UNUSED_PARAM(enabled);
357     UNUSED_PARAM(ec);
358 #endif
359 }
360
361 void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode& ec)
362 {
363 #if ENABLE(TEXT_AUTOSIZING)
364     InternalSettingsGuardForSettings();
365     settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height));
366 #else
367     UNUSED_PARAM(width);
368     UNUSED_PARAM(height);
369     UNUSED_PARAM(ec);
370 #endif
371 }
372
373 void InternalSettings::setEnableScrollAnimator(bool enabled, ExceptionCode& ec)
374 {
375 #if ENABLE(SMOOTH_SCROLLING)
376     InternalSettingsGuardForSettings();
377     settings()->setEnableScrollAnimator(enabled);
378 #else
379     UNUSED_PARAM(enabled);
380     UNUSED_PARAM(ec);
381 #endif
382 }
383
384 bool InternalSettings::scrollAnimatorEnabled(ExceptionCode& ec)
385 {
386 #if ENABLE(SMOOTH_SCROLLING)
387     InternalSettingsGuardForSettingsReturn(false);
388     return settings()->scrollAnimatorEnabled();
389 #else
390     UNUSED_PARAM(ec);
391     return false;
392 #endif
393 }
394
395 void InternalSettings::setCSSExclusionsEnabled(bool enabled, ExceptionCode& ec)
396 {
397     UNUSED_PARAM(ec);
398     RuntimeEnabledFeatures::setCSSExclusionsEnabled(enabled);
399 }
400
401 void InternalSettings::setCSSVariablesEnabled(bool enabled, ExceptionCode& ec)
402 {
403     InternalSettingsGuardForSettings();
404     settings()->setCSSVariablesEnabled(enabled);
405 }
406
407 bool InternalSettings::cssVariablesEnabled(ExceptionCode& ec)
408 {
409     InternalSettingsGuardForSettingsReturn(false);
410     return settings()->cssVariablesEnabled();
411 }
412
413 void InternalSettings::setMediaPlaybackRequiresUserGesture(bool enabled, ExceptionCode& ec)
414 {
415     InternalSettingsGuardForSettings();
416     settings()->setMediaPlaybackRequiresUserGesture(enabled);
417 }
418
419 void InternalSettings::setEditingBehavior(const String& editingBehavior, ExceptionCode& ec)
420 {
421     InternalSettingsGuardForSettings();
422     if (equalIgnoringCase(editingBehavior, "win"))
423         settings()->setEditingBehaviorType(EditingWindowsBehavior);
424     else if (equalIgnoringCase(editingBehavior, "mac"))
425         settings()->setEditingBehaviorType(EditingMacBehavior);
426     else if (equalIgnoringCase(editingBehavior, "unix"))
427         settings()->setEditingBehaviorType(EditingUnixBehavior);
428     else
429         ec = SYNTAX_ERR;
430 }
431
432 void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, ExceptionCode& ec)
433 {
434     InternalSettingsGuardForSettings();
435     settings()->setFixedPositionCreatesStackingContext(creates);
436 }
437
438 void InternalSettings::setSyncXHRInDocumentsEnabled(bool enabled, ExceptionCode& ec)
439 {
440     InternalSettingsGuardForSettings();
441     settings()->setSyncXHRInDocumentsEnabled(enabled);
442 }
443
444 void InternalSettings::setJavaScriptProfilingEnabled(bool enabled, ExceptionCode& ec)
445 {
446 #if ENABLE(INSPECTOR)
447     if (!page() || !page()->inspectorController()) {
448         ec = INVALID_ACCESS_ERR;
449         return;
450     }
451
452     page()->inspectorController()->setProfilerEnabled(enabled);
453 #else
454     UNUSED_PARAM(enabled);
455     UNUSED_PARAM(ec);
456     return;
457 #endif
458 }
459
460 void InternalSettings::setWindowFocusRestricted(bool restricted, ExceptionCode& ec)
461 {
462     InternalSettingsGuardForSettings();
463     settings()->setWindowFocusRestricted(restricted);
464 }
465
466 void InternalSettings::setDialogElementEnabled(bool enabled, ExceptionCode& ec)
467 {
468     UNUSED_PARAM(ec);
469 #if ENABLE(DIALOG_ELEMENT)
470     RuntimeEnabledFeatures::setDialogElementEnabled(enabled);
471 #else
472     UNUSED_PARAM(enabled);
473 #endif
474 }
475
476 void InternalSettings::allowRoundingHacks() const
477 {
478     TextRun::setAllowsRoundingHacks(true);
479 }
480
481 Vector<String> InternalSettings::userPreferredLanguages() const
482 {
483     return WebCore::userPreferredLanguages();
484 }
485
486 void InternalSettings::setUserPreferredLanguages(const Vector<String>& languages)
487 {
488     WebCore::overrideUserPreferredLanguages(languages);
489 }
490
491 void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode& ec)
492 {
493     InternalSettingsGuardForSettings();
494
495 #if ENABLE(VIDEO_TRACK)
496     if (equalIgnoringCase(kind, "Subtitles"))
497         settings()->setShouldDisplaySubtitles(enabled);
498     else if (equalIgnoringCase(kind, "Captions"))
499         settings()->setShouldDisplayCaptions(enabled);
500     else if (equalIgnoringCase(kind, "TextDescriptions"))
501         settings()->setShouldDisplayTextDescriptions(enabled);
502     else
503         ec = SYNTAX_ERR;
504 #else
505     UNUSED_PARAM(kind);
506     UNUSED_PARAM(enabled);
507 #endif
508 }
509
510 bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode& ec)
511 {
512     InternalSettingsGuardForSettingsReturn(false);
513
514 #if ENABLE(VIDEO_TRACK)
515     if (equalIgnoringCase(kind, "Subtitles"))
516         return settings()->shouldDisplaySubtitles();
517     if (equalIgnoringCase(kind, "Captions"))
518         return settings()->shouldDisplayCaptions();
519     if (equalIgnoringCase(kind, "TextDescriptions"))
520         return settings()->shouldDisplayTextDescriptions();
521
522     ec = SYNTAX_ERR;
523     return false;
524 #else
525     UNUSED_PARAM(kind);
526     return false;
527 #endif
528 }
529
530 void InternalSettings::setPagination(const String& mode, int gap, int pageLength, ExceptionCode& ec)
531 {
532     if (!page()) {
533         ec = INVALID_ACCESS_ERR;
534         return;
535     }
536
537     Page::Pagination pagination;
538     if (mode == "Unpaginated")
539         pagination.mode = Page::Pagination::Unpaginated;
540     else if (mode == "LeftToRightPaginated")
541         pagination.mode = Page::Pagination::LeftToRightPaginated;
542     else if (mode == "RightToLeftPaginated")
543         pagination.mode = Page::Pagination::RightToLeftPaginated;
544     else if (mode == "TopToBottomPaginated")
545         pagination.mode = Page::Pagination::TopToBottomPaginated;
546     else if (mode == "BottomToTopPaginated")
547         pagination.mode = Page::Pagination::BottomToTopPaginated;
548     else {
549         ec = SYNTAX_ERR;
550         return;
551     }
552
553     pagination.gap = gap;
554     pagination.pageLength = pageLength;
555     page()->setPagination(pagination);
556 }
557
558 void InternalSettings::setEnableMockPagePopup(bool enabled, ExceptionCode& ec)
559 {
560 #if ENABLE(PAGE_POPUP)
561     InternalSettingsGuardForPage();
562     if (!page()->chrome())
563         return;
564     if (!enabled) {
565         page()->chrome()->client()->resetPagePopupDriver();
566         return;
567     }
568     if (!m_pagePopupDriver)
569         m_pagePopupDriver = MockPagePopupDriver::create(page()->mainFrame());
570     page()->chrome()->client()->setPagePopupDriver(m_pagePopupDriver.get());
571 #else
572     UNUSED_PARAM(enabled);
573     UNUSED_PARAM(ec);
574 #endif
575 }
576
577 String InternalSettings::configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec)
578 {
579     if (!page()) {
580         ec = INVALID_ACCESS_ERR;
581         return String();
582     }
583
584     const int defaultLayoutWidthForNonMobilePages = 980;
585
586     ViewportArguments arguments = page()->viewportArguments();
587     ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight));
588     restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight));
589     restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
590
591     return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false");
592 }
593
594 void InternalSettings::setMemoryInfoEnabled(bool enabled, ExceptionCode& ec)
595 {
596     InternalSettingsGuardForSettings();
597     settings()->setMemoryInfoEnabled(enabled);
598 }
599
600 }