1/* 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 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. 14 * 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. 25 */ 26 27#ifndef InternalSettings_h 28#define InternalSettings_h 29 30// FIXME (121927): This include should not be needed. 31#include <wtf/text/AtomicStringHash.h> 32 33#include "EditingBehaviorTypes.h" 34#include "FontGenericFamilies.h" 35#include "IntSize.h" 36#include "InternalSettingsGenerated.h" 37#include <wtf/PassRefPtr.h> 38 39namespace WebCore { 40 41typedef int ExceptionCode; 42 43class Frame; 44class Document; 45class Page; 46class Settings; 47 48class InternalSettings : public InternalSettingsGenerated { 49public: 50 class Backup { 51 public: 52 explicit Backup(Settings&); 53 void restoreTo(Settings&); 54 55 bool m_originalCSSExclusionsEnabled; 56 bool m_originalCSSShapesEnabled; 57 EditingBehaviorType m_originalEditingBehavior; 58 59 // Initially empty, only used if changed by a test. 60 ScriptFontFamilyMap m_standardFontFamilies; 61 ScriptFontFamilyMap m_fixedFontFamilies; 62 ScriptFontFamilyMap m_serifFontFamilies; 63 ScriptFontFamilyMap m_sansSerifFontFamilies; 64 ScriptFontFamilyMap m_cursiveFontFamilies; 65 ScriptFontFamilyMap m_fantasyFontFamilies; 66 ScriptFontFamilyMap m_pictographFontFamilies; 67 68#if ENABLE(TEXT_AUTOSIZING) 69 bool m_originalTextAutosizingEnabled; 70 IntSize m_originalTextAutosizingWindowSizeOverride; 71 float m_originalTextAutosizingFontScaleFactor; 72#endif 73 String m_originalMediaTypeOverride; 74 bool m_originalCanvasUsesAcceleratedDrawing; 75 bool m_originalMockScrollbarsEnabled; 76 bool m_originalUsesOverlayScrollbars; 77 bool m_langAttributeAwareFormControlUIEnabled; 78 bool m_imagesEnabled; 79 double m_minimumTimerInterval; 80#if ENABLE(VIDEO_TRACK) 81 bool m_shouldDisplaySubtitles; 82 bool m_shouldDisplayCaptions; 83 bool m_shouldDisplayTextDescriptions; 84#endif 85 String m_defaultVideoPosterURL; 86 bool m_originalTimeWithoutMouseMovementBeforeHidingControls; 87 bool m_useLegacyBackgroundSizeShorthandBehavior; 88 bool m_autoscrollForDragAndDropEnabled; 89 bool m_pluginReplacementEnabled; 90 bool m_shouldConvertPositionStyleOnCopy; 91 }; 92 93 static PassRefPtr<InternalSettings> create(Page* page) 94 { 95 return adoptRef(new InternalSettings(page)); 96 } 97 static InternalSettings* from(Page*); 98 void hostDestroyed() { m_page = 0; } 99 100 virtual ~InternalSettings(); 101 void resetToConsistentState(); 102 103 void setUsesOverlayScrollbars(bool, ExceptionCode&); 104 void setTouchEventEmulationEnabled(bool, ExceptionCode&); 105 void setStandardFontFamily(const String& family, const String& script, ExceptionCode&); 106 void setSerifFontFamily(const String& family, const String& script, ExceptionCode&); 107 void setSansSerifFontFamily(const String& family, const String& script, ExceptionCode&); 108 void setFixedFontFamily(const String& family, const String& script, ExceptionCode&); 109 void setCursiveFontFamily(const String& family, const String& script, ExceptionCode&); 110 void setFantasyFontFamily(const String& family, const String& script, ExceptionCode&); 111 void setPictographFontFamily(const String& family, const String& script, ExceptionCode&); 112 void setTextAutosizingEnabled(bool enabled, ExceptionCode&); 113 void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode&); 114 void setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode&); 115 void setMediaTypeOverride(const String& mediaType, ExceptionCode&); 116 void setCSSExclusionsEnabled(bool, ExceptionCode&); 117 void setCSSShapesEnabled(bool, ExceptionCode&); 118 void setCanStartMedia(bool, ExceptionCode&); 119 void setEditingBehavior(const String&, ExceptionCode&); 120 void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&); 121 bool shouldDisplayTrackKind(const String& kind, ExceptionCode&); 122 void setStorageBlockingPolicy(const String&, ExceptionCode&); 123 void setLangAttributeAwareFormControlUIEnabled(bool); 124 void setImagesEnabled(bool, ExceptionCode&); 125 void setMinimumTimerInterval(double intervalInSeconds, ExceptionCode&); 126 void setDefaultVideoPosterURL(const String& url, ExceptionCode&); 127 void setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode&); 128 void setUseLegacyBackgroundSizeShorthandBehavior(bool, ExceptionCode&); 129 void setAutoscrollForDragAndDropEnabled(bool, ExceptionCode&); 130 void setFontFallbackPrefersPictographs(bool, ExceptionCode&); 131 void setPluginReplacementEnabled(bool); 132 void setBackgroundShouldExtendBeyondPage(bool, ExceptionCode&); 133 void setShouldConvertPositionStyleOnCopy(bool, ExceptionCode&); 134 void setScrollingTreeIncludesFrames(bool, ExceptionCode&); 135 136private: 137 explicit InternalSettings(Page*); 138 139 Settings* settings() const; 140 Page* page() const { return m_page; } 141 static const char* supplementName(); 142 143 Page* m_page; 144 Backup m_backup; 145}; 146 147} // namespace WebCore 148 149#endif 150