2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
15 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef InternalSettings_h
28 #define InternalSettings_h
30 // FIXME (121927): This include should not be needed.
31 #include <wtf/text/AtomicStringHash.h>
33 #include "EditingBehaviorTypes.h"
34 #include "FontGenericFamilies.h"
36 #include "InternalSettingsGenerated.h"
37 #include <wtf/PassRefPtr.h>
41 typedef int ExceptionCode;
48 class InternalSettings : public InternalSettingsGenerated {
52 explicit Backup(Settings&);
53 void restoreTo(Settings&);
55 bool m_originalCSSExclusionsEnabled;
56 bool m_originalCSSShapesEnabled;
57 #if ENABLE(SHADOW_DOM)
58 bool m_originalShadowDOMEnabled;
59 bool m_originalAuthorShadowDOMForAnyElementEnabled;
61 EditingBehaviorType m_originalEditingBehavior;
63 // Initially empty, only used if changed by a test.
64 ScriptFontFamilyMap m_standardFontFamilies;
65 ScriptFontFamilyMap m_fixedFontFamilies;
66 ScriptFontFamilyMap m_serifFontFamilies;
67 ScriptFontFamilyMap m_sansSerifFontFamilies;
68 ScriptFontFamilyMap m_cursiveFontFamilies;
69 ScriptFontFamilyMap m_fantasyFontFamilies;
70 ScriptFontFamilyMap m_pictographFontFamilies;
72 #if ENABLE(TEXT_AUTOSIZING)
73 bool m_originalTextAutosizingEnabled;
74 IntSize m_originalTextAutosizingWindowSizeOverride;
75 float m_originalTextAutosizingFontScaleFactor;
77 String m_originalMediaTypeOverride;
78 bool m_originalCanvasUsesAcceleratedDrawing;
79 bool m_originalMockScrollbarsEnabled;
80 bool m_originalUsesOverlayScrollbars;
81 bool m_langAttributeAwareFormControlUIEnabled;
83 double m_minimumTimerInterval;
84 #if ENABLE(VIDEO_TRACK)
85 bool m_shouldDisplaySubtitles;
86 bool m_shouldDisplayCaptions;
87 bool m_shouldDisplayTextDescriptions;
89 String m_defaultVideoPosterURL;
90 bool m_originalTimeWithoutMouseMovementBeforeHidingControls;
91 bool m_useLegacyBackgroundSizeShorthandBehavior;
92 bool m_autoscrollForDragAndDropEnabled;
93 bool m_pluginReplacementEnabled;
96 static PassRefPtr<InternalSettings> create(Page* page)
98 return adoptRef(new InternalSettings(page));
100 static InternalSettings* from(Page*);
101 void hostDestroyed() { m_page = 0; }
103 virtual ~InternalSettings();
104 void resetToConsistentState();
106 void setMockScrollbarsEnabled(bool enabled, ExceptionCode&);
107 void setUsesOverlayScrollbars(bool enabled, ExceptionCode&);
108 void setTouchEventEmulationEnabled(bool enabled, ExceptionCode&);
109 void setShadowDOMEnabled(bool enabled, ExceptionCode&);
110 void setAuthorShadowDOMForAnyElementEnabled(bool);
111 void setStandardFontFamily(const String& family, const String& script, ExceptionCode&);
112 void setSerifFontFamily(const String& family, const String& script, ExceptionCode&);
113 void setSansSerifFontFamily(const String& family, const String& script, ExceptionCode&);
114 void setFixedFontFamily(const String& family, const String& script, ExceptionCode&);
115 void setCursiveFontFamily(const String& family, const String& script, ExceptionCode&);
116 void setFantasyFontFamily(const String& family, const String& script, ExceptionCode&);
117 void setPictographFontFamily(const String& family, const String& script, ExceptionCode&);
118 void setTextAutosizingEnabled(bool enabled, ExceptionCode&);
119 void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode&);
120 void setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode&);
121 void setMediaTypeOverride(const String& mediaType, ExceptionCode&);
122 void setCSSExclusionsEnabled(bool enabled, ExceptionCode&);
123 void setCSSShapesEnabled(bool enabled, ExceptionCode&);
124 void setCanStartMedia(bool, ExceptionCode&);
125 void setEditingBehavior(const String&, ExceptionCode&);
126 void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&);
127 bool shouldDisplayTrackKind(const String& kind, ExceptionCode&);
128 void setStorageBlockingPolicy(const String&, ExceptionCode&);
129 void setLangAttributeAwareFormControlUIEnabled(bool);
130 void setImagesEnabled(bool enabled, ExceptionCode&);
131 void setMinimumTimerInterval(double intervalInSeconds, ExceptionCode&);
132 void setDefaultVideoPosterURL(const String& url, ExceptionCode&);
133 void setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode&);
134 void setUseLegacyBackgroundSizeShorthandBehavior(bool enabled, ExceptionCode&);
135 void setAutoscrollForDragAndDropEnabled(bool enabled, ExceptionCode&);
136 void setFontFallbackPrefersPictographs(bool preferPictographs, ExceptionCode&);
137 void setPluginReplacementEnabled(bool);
138 void setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode&);
142 explicit InternalSettings(Page*);
144 Settings* settings() const;
145 Page* page() const { return m_page; }
146 static const char* supplementName();
152 } // namespace WebCore