Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / testing / InternalSettings.h
blob46b68d1f24174ffdcc0e3fe28cf606ebfa77bc70
1 /*
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
7 * are met:
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 #include "core/editing/EditingBehaviorTypes.h"
31 #include "core/page/Page.h"
32 #include "core/testing/InternalSettingsGenerated.h"
33 #include "platform/geometry/IntSize.h"
34 #include "platform/graphics/ImageAnimationPolicy.h"
35 #include "platform/heap/Handle.h"
36 #include "public/platform/WebDisplayMode.h"
37 #include "wtf/Allocator.h"
38 #include "wtf/PassRefPtr.h"
39 #include "wtf/RefCounted.h"
40 #include "wtf/text/WTFString.h"
42 namespace blink {
44 class Document;
45 class ExceptionState;
46 class LocalFrame;
47 class Page;
48 class Settings;
50 #if ENABLE(OILPAN)
51 class InternalSettings final : public InternalSettingsGenerated, public HeapSupplement<Page> {
52 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(InternalSettings);
53 #else
54 class InternalSettings final : public InternalSettingsGenerated {
55 #endif
56 DEFINE_WRAPPERTYPEINFO();
57 public:
58 class Backup {
59 DISALLOW_ALLOCATION();
60 public:
61 explicit Backup(Settings*);
62 void restoreTo(Settings*);
64 bool m_originalAuthorShadowDOMForAnyElementEnabled;
65 bool m_originalCSP;
66 bool m_originalCSSStickyPositionEnabled;
67 bool m_originalOverlayScrollbarsEnabled;
68 EditingBehaviorType m_originalEditingBehavior;
69 bool m_originalTextAutosizingEnabled;
70 IntSize m_originalTextAutosizingWindowSizeOverride;
71 float m_originalAccessibilityFontScaleFactor;
72 String m_originalMediaTypeOverride;
73 WebDisplayMode m_originalDisplayModeOverride;
74 bool m_originalMockScrollbarsEnabled;
75 bool m_originalMockGestureTapHighlightsEnabled;
76 bool m_langAttributeAwareFormControlUIEnabled;
77 bool m_imagesEnabled;
78 String m_defaultVideoPosterURL;
79 bool m_originalLayerSquashingEnabled;
80 bool m_originalImageColorProfilesEnabled;
81 ImageAnimationPolicy m_originalImageAnimationPolicy;
82 bool m_originalScrollTopLeftInteropEnabled;
85 static PassRefPtrWillBeRawPtr<InternalSettings> create(Page& page)
87 return adoptRefWillBeNoop(new InternalSettings(page));
89 static InternalSettings* from(Page&);
91 #if !ENABLE(OILPAN)
92 void hostDestroyed() { m_page = nullptr; }
93 #endif
95 ~InternalSettings() override;
96 void resetToConsistentState();
98 void setStandardFontFamily(const AtomicString& family, const String& script, ExceptionState&);
99 void setSerifFontFamily(const AtomicString& family, const String& script, ExceptionState&);
100 void setSansSerifFontFamily(const AtomicString& family, const String& script, ExceptionState&);
101 void setFixedFontFamily(const AtomicString& family, const String& script, ExceptionState&);
102 void setCursiveFontFamily(const AtomicString& family, const String& script, ExceptionState&);
103 void setFantasyFontFamily(const AtomicString& family, const String& script, ExceptionState&);
104 void setPictographFontFamily(const AtomicString& family, const String& script, ExceptionState&);
106 void setDefaultVideoPosterURL(const String& url, ExceptionState&);
107 void setEditingBehavior(const String&, ExceptionState&);
108 void setImagesEnabled(bool, ExceptionState&);
109 void setMediaTypeOverride(const String& mediaType, ExceptionState&);
110 void setDisplayModeOverride(const String& displayMode, ExceptionState&);
111 void setMockScrollbarsEnabled(bool, ExceptionState&);
112 void setMockGestureTapHighlightsEnabled(bool, ExceptionState&);
113 void setTextAutosizingEnabled(bool, ExceptionState&);
114 void setTextTrackKindUserPreference(const String& preference, ExceptionState&);
115 void setAccessibilityFontScaleFactor(float fontScaleFactor, ExceptionState&);
116 void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionState&);
117 void setViewportEnabled(bool, ExceptionState&);
118 void setViewportMetaEnabled(bool, ExceptionState&);
120 // FIXME: The following are RuntimeEnabledFeatures and likely
121 // cannot be changed after process start. These setters should
122 // be removed or moved onto internals.runtimeFlags:
123 void setAuthorShadowDOMForAnyElementEnabled(bool);
124 void setCSSStickyPositionEnabled(bool);
125 void setLangAttributeAwareFormControlUIEnabled(bool);
126 void setOverlayScrollbarsEnabled(bool);
127 void setExperimentalContentSecurityPolicyFeaturesEnabled(bool);
128 void setImageColorProfilesEnabled(bool);
129 void setImageAnimationPolicy(const String&, ExceptionState&);
130 void setScrollTopLeftInteropEnabled(bool);
131 void setLinkHeaderEnabled(bool);
133 DECLARE_VIRTUAL_TRACE();
135 void setAvailablePointerTypes(const String&, ExceptionState&);
136 void setPrimaryPointerType(const String&, ExceptionState&);
137 void setAvailableHoverTypes(const String&, ExceptionState&);
138 void setPrimaryHoverType(const String&, ExceptionState&);
139 void setDnsPrefetchLogging(bool, ExceptionState&);
140 void setPreloadLogging(bool, ExceptionState&);
142 private:
143 explicit InternalSettings(Page&);
145 Settings* settings() const;
146 Page* page() const { return m_page; }
147 static const char* supplementName();
149 RawPtrWillBeWeakMember<Page> m_page;
150 Backup m_backup;
153 } // namespace blink
155 #endif // InternalSettings_h