Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (223331 => 223332)
--- trunk/Source/WebCore/CMakeLists.txt 2017-10-16 01:55:16 UTC (rev 223331)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-10-16 02:59:07 UTC (rev 223332)
@@ -2246,6 +2246,7 @@
page/SecurityOriginData.cpp
page/SecurityPolicy.cpp
page/Settings.cpp
+ page/SettingsBase.cpp
page/SocketProvider.cpp
page/SpatialNavigation.cpp
page/SuspendableTimer.cpp
Modified: trunk/Source/WebCore/ChangeLog (223331 => 223332)
--- trunk/Source/WebCore/ChangeLog 2017-10-16 01:55:16 UTC (rev 223331)
+++ trunk/Source/WebCore/ChangeLog 2017-10-16 02:59:07 UTC (rev 223332)
@@ -1,3 +1,25 @@
+2017-10-15 Sam Weinig <[email protected]>
+
+ [Settings] Split non-macro generated parts of Settings into SettingsBase base class
+ https://bugs.webkit.org/show_bug.cgi?id=178321
+
+ Reviewed by Darin Adler.
+
+ Working towards getting generated Settings working again, but in smaller patches, split
+ non-generated part off into SettingsBase as a first step.
+
+ One function, effectiveFrameFlattening(), needs to remain in Settings for now, as it directly
+ references a macro generated function, frameFlattening().
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * page/Page.h:
+ * page/Settings.cpp:
+ * page/Settings.h:
+ * page/SettingsBase.h: Copied from Source/WebCore/page/Settings.h.
+ * page/cocoa/SettingsBaseCocoa.mm: Copied from Source/WebCore/page/cocoa/SettingsCocoa.mm.
+ * page/cocoa/SettingsCocoa.mm: Removed.
+
2017-10-15 Yusuke Suzuki <[email protected]>
[JSC] Perform module specifier validation at parsing time
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (223331 => 223332)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-10-16 01:55:16 UTC (rev 223331)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-10-16 02:59:07 UTC (rev 223332)
@@ -3331,9 +3331,11 @@
7CC2DE031ECA04A50027B774 /* NotificationDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC2DE021ECA04A50027B774 /* NotificationDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */; };
7CC564BA18BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */; };
+ 7CC660A21F93CB9000D500E9 /* SettingsBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC6609B1F93057900D500E9 /* SettingsBase.cpp */; };
7CC69940191EC5F500AF2270 /* JSWebKitNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */; };
7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */; };
7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
+ 7CC9722E1F93E3360004D4CF /* SettingsBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC660991F93057800D500E9 /* SettingsBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D531DD7B09300128552 /* SVGLengthValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
7CD0BA041B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */; };
7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */; };
@@ -4419,7 +4421,7 @@
A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
A17D275E1EAC579800BF01E7 /* MediaSelectionOption.h in Headers */ = {isa = PBXBuildFile; fileRef = A17D275D1EAC579800BF01E7 /* MediaSelectionOption.h */; settings = {ATTRIBUTES = (Private, ); }; };
A17FEE641F8893220021E811 /* PaymentSessionBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A17FEE631F8893220021E811 /* PaymentSessionBase.h */; };
- A182D5B71BE722670087A7CC /* SettingsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A182D5B61BE722620087A7CC /* SettingsCocoa.mm */; };
+ A182D5B71BE722670087A7CC /* SettingsBaseCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A182D5B61BE722620087A7CC /* SettingsBaseCocoa.mm */; };
A185B4291E8211A100DC9118 /* PreviewLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = A185B4271E8211A100DC9118 /* PreviewLoader.mm */; };
A185B42A1E8211A100DC9118 /* PreviewLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A185B4281E8211A100DC9118 /* PreviewLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
A18890AE1AA13F250026C301 /* ParentalControlsContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */; };
@@ -11590,6 +11592,8 @@
7CC2DE021ECA04A50027B774 /* NotificationDirection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationDirection.h; sourceTree = "<group>"; };
7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneNumberDetector.h; sourceTree = "<group>"; };
7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneNumberDetectorCocoa.cpp; sourceTree = "<group>"; };
+ 7CC660991F93057800D500E9 /* SettingsBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsBase.h; sourceTree = "<group>"; };
+ 7CC6609B1F93057900D500E9 /* SettingsBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsBase.cpp; sourceTree = "<group>"; };
7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitNamespace.h; sourceTree = "<group>"; };
7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
@@ -12879,7 +12883,7 @@
A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; };
A17D275D1EAC579800BF01E7 /* MediaSelectionOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaSelectionOption.h; sourceTree = "<group>"; };
A17FEE631F8893220021E811 /* PaymentSessionBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentSessionBase.h; sourceTree = "<group>"; };
- A182D5B61BE722620087A7CC /* SettingsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsCocoa.mm; sourceTree = "<group>"; };
+ A182D5B61BE722620087A7CC /* SettingsBaseCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsBaseCocoa.mm; sourceTree = "<group>"; };
A185B4271E8211A100DC9118 /* PreviewLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreviewLoader.mm; sourceTree = "<group>"; };
A185B4281E8211A100DC9118 /* PreviewLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreviewLoader.h; sourceTree = "<group>"; };
A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ParentalControlsContentFilter.mm; sourceTree = "<group>"; };
@@ -19055,10 +19059,10 @@
517C87071F8E8FF200EB8076 /* context */ = {
isa = PBXGroup;
children = (
+ 517C87111F8EE72F00EB8076 /* ServiceWorkerThread.cpp */,
+ 517C87101F8EE72E00EB8076 /* ServiceWorkerThread.h */,
517C87081F8EB9BF00EB8076 /* SWContextManager.cpp */,
517C87091F8EB9C000EB8076 /* SWContextManager.h */,
- 517C87111F8EE72F00EB8076 /* ServiceWorkerThread.cpp */,
- 517C87101F8EE72E00EB8076 /* ServiceWorkerThread.h */,
);
path = context;
sourceTree = "<group>";
@@ -19307,7 +19311,7 @@
AD5A0C221DECA37E00707054 /* PerformanceLoggingCocoa.mm */,
ADFE2B541BD5F41200DAB457 /* ResourceUsageOverlayCocoa.mm */,
A5071E881C56D4FA009951BE /* ResourceUsageThreadCocoa.mm */,
- A182D5B61BE722620087A7CC /* SettingsCocoa.mm */,
+ A182D5B61BE722620087A7CC /* SettingsBaseCocoa.mm */,
26255F0118878E110006E1FD /* UserAgent.h */,
5D5975B61963637B00D00878 /* UserAgent.mm */,
);
@@ -19878,6 +19882,8 @@
14C9A5E90B3D105F005A0232 /* Settings.cpp */,
F587863A02DE3A1401EA4122 /* Settings.h */,
BC59DEF8169DEDC30016AC34 /* Settings.in */,
+ 7CC6609B1F93057900D500E9 /* SettingsBase.cpp */,
+ 7CC660991F93057800D500E9 /* SettingsBase.h */,
5C688AA21D38126F000B54FA /* SocketProvider.cpp */,
5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */,
626CDE0C1140424C001E5A68 /* SpatialNavigation.cpp */,
@@ -28552,7 +28558,6 @@
7C8139AA1ED6604B00CE26E8 /* JSDOMCastedThisErrorBehavior.h in Headers */,
413C2C341BC29A8F0075204C /* JSDOMConstructor.h in Headers */,
930841341CDDB15500B0958C /* JSDOMConvert.h in Headers */,
- 517C870B1F8EBB2500EB8076 /* SWContextManager.h in Headers */,
7C8E34AD1E4A33AF0054CE23 /* JSDOMConvertAny.h in Headers */,
7C8E34AE1E4A33AF0054CE23 /* JSDOMConvertBase.h in Headers */,
7C8E34AF1E4A33AF0054CE23 /* JSDOMConvertBoolean.h in Headers */,
@@ -30107,10 +30112,12 @@
517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */,
517A53291F4B90B900DCDC0A /* ServiceWorkerRegistrationKey.h in Headers */,
51F175691F3EBC8300C74950 /* ServiceWorkerRegistrationOptions.h in Headers */,
+ 51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */,
51F1756C1F3EBC8300C74950 /* ServiceWorkerUpdateViaCache.h in Headers */,
93309E10099E64920056E581 /* SetNodeAttributeCommand.h in Headers */,
B8DBDB4C130B0F8A00F5CDB1 /* SetSelectionCommand.h in Headers */,
93F1994F08245E59001E9ABC /* Settings.h in Headers */,
+ 7CC9722E1F93E3360004D4CF /* SettingsBase.h in Headers */,
53EF766B16530A61004CBE49 /* SettingsMacros.h in Headers */,
0F3DD45012F5EA1B000D9190 /* ShadowBlur.h in Headers */,
BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */,
@@ -30337,7 +30344,6 @@
B22279C50D00BF220071B782 /* SVGExternalResourcesRequired.h in Headers */,
B22279C80D00BF220071B782 /* SVGFEBlendElement.h in Headers */,
B22279CB0D00BF220071B782 /* SVGFEColorMatrixElement.h in Headers */,
- 51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */,
B22279CE0D00BF220071B782 /* SVGFEComponentTransferElement.h in Headers */,
B22279D10D00BF220071B782 /* SVGFECompositeElement.h in Headers */,
1921327511C0E6BB00456238 /* SVGFEConvolveMatrixElement.h in Headers */,
@@ -30527,6 +30533,7 @@
B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */,
B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */,
517A531D1F4B53B100DCDC0A /* SWClientConnection.h in Headers */,
+ 517C870B1F8EBB2500EB8076 /* SWContextManager.h in Headers */,
517A52F01F47535B00DCDC0A /* SWServer.h in Headers */,
51F645971F4A686F00B54DED /* SWServerRegistration.h in Headers */,
517A53461F50C17F00DCDC0A /* SWServerWorker.h in Headers */,
@@ -31512,7 +31519,6 @@
41D129CF1F3D0EFE00D15E47 /* CacheStorageConnection.cpp in Sources */,
E43AF8E61AC5B7E800CA717E /* CacheValidation.cpp in Sources */,
49AE2D96134EE5F90072920A /* CalculationValue.cpp in Sources */,
- 517C87181F8FD4D900EB8076 /* ServiceWorkerContextData.cpp in Sources */,
952076041F2675FE007D2AAB /* CallTracer.cpp in Sources */,
415CDAF41E6B8F87004F11EE /* CanvasCaptureMediaStreamTrack.cpp in Sources */,
49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */,
@@ -32153,7 +32159,6 @@
96ABA42314BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp in Sources */,
B2ED97710B1F55CE00257D0F /* GraphicsContextCG.cpp in Sources */,
B277B4040B22F37C0004BEC6 /* GraphicsContextCocoa.mm in Sources */,
- 51BCCE2F1F8F1795006BA0ED /* ServiceWorkerThread.cpp in Sources */,
0F580B0C0F12A2690051D689 /* GraphicsLayer.cpp in Sources */,
499B3ED6128CD31400E726C2 /* GraphicsLayerCA.cpp in Sources */,
0FA24D79162DF91900A3F4C0 /* GraphicsLayerUpdater.cpp in Sources */,
@@ -33458,7 +33463,6 @@
C96F5EC61B5872260091EA9D /* MediaSessionInterruptionProviderMac.mm in Sources */,
C90F65551B2253B1002163A1 /* MediaSessionManager.cpp in Sources */,
CD669D681D23364B004D1866 /* MediaSessionManagerCocoa.cpp in Sources */,
- 517C870A1F8EBB2500EB8076 /* SWContextManager.cpp in Sources */,
07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */,
07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.mm in Sources */,
CD3A495E17A9D01B00274E42 /* MediaSource.cpp in Sources */,
@@ -34015,6 +34019,7 @@
2D93AEE419DF5641002A86C3 /* ServicesOverlayController.mm in Sources */,
51F1755C1F3EBC8300C74950 /* ServiceWorker.cpp in Sources */,
51F1755E1F3EBC8300C74950 /* ServiceWorkerContainer.cpp in Sources */,
+ 517C87181F8FD4D900EB8076 /* ServiceWorkerContextData.cpp in Sources */,
51F175601F3EBC8300C74950 /* ServiceWorkerGlobalScope.cpp in Sources */,
51F175621F3EBC8300C74950 /* ServiceWorkerJob.cpp in Sources */,
517A53251F4B905500DCDC0A /* ServiceWorkerJobData.cpp in Sources */,
@@ -34023,10 +34028,12 @@
517A534E1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.cpp in Sources */,
517A53281F4B90B900DCDC0A /* ServiceWorkerRegistrationKey.cpp in Sources */,
51F645A21F4BF53C00B54DED /* ServiceWorkerRegistrationOptions.cpp in Sources */,
+ 51BCCE2F1F8F1795006BA0ED /* ServiceWorkerThread.cpp in Sources */,
93309E0F099E64920056E581 /* SetNodeAttributeCommand.cpp in Sources */,
B8DBDB4B130B0F8A00F5CDB1 /* SetSelectionCommand.cpp in Sources */,
14C9A5EA0B3D105F005A0232 /* Settings.cpp in Sources */,
- A182D5B71BE722670087A7CC /* SettingsCocoa.mm in Sources */,
+ 7CC660A21F93CB9000D500E9 /* SettingsBase.cpp in Sources */,
+ A182D5B71BE722670087A7CC /* SettingsBaseCocoa.mm in Sources */,
0F3DD44F12F5EA1B000D9190 /* ShadowBlur.cpp in Sources */,
BC5EB8C30E82031B00B25965 /* ShadowData.cpp in Sources */,
A6D169621346B49B000EB770 /* ShadowRoot.cpp in Sources */,
@@ -34327,6 +34334,7 @@
B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */,
B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */,
517A531C1F4B53B100DCDC0A /* SWClientConnection.cpp in Sources */,
+ 517C870A1F8EBB2500EB8076 /* SWContextManager.cpp in Sources */,
517A52F11F4754E700DCDC0A /* SWServer.cpp in Sources */,
51F645961F4A686F00B54DED /* SWServerRegistration.cpp in Sources */,
517A53451F50C17F00DCDC0A /* SWServerWorker.cpp in Sources */,
Modified: trunk/Source/WebCore/page/Page.h (223331 => 223332)
--- trunk/Source/WebCore/page/Page.h 2017-10-16 01:55:16 UTC (rev 223331)
+++ trunk/Source/WebCore/page/Page.h 2017-10-16 02:59:07 UTC (rev 223332)
@@ -149,7 +149,7 @@
class Page : public Supplementable<Page> {
WTF_MAKE_NONCOPYABLE(Page);
WTF_MAKE_FAST_ALLOCATED;
- friend class Settings;
+ friend class SettingsBase;
public:
WEBCORE_EXPORT static void updateStyleForAllPagesAfterGlobalChangeInEnvironment();
Modified: trunk/Source/WebCore/page/Settings.cpp (223331 => 223332)
--- trunk/Source/WebCore/page/Settings.cpp 2017-10-16 01:55:16 UTC (rev 223331)
+++ trunk/Source/WebCore/page/Settings.cpp 2017-10-16 02:59:07 UTC (rev 223332)
@@ -41,86 +41,13 @@
#include "HistoryItem.h"
#include "MainFrame.h"
#include "Page.h"
-#include "PageCache.h"
-#include "RuntimeApplicationChecks.h"
#include "StorageMap.h"
#include <limits>
#include <wtf/NeverDestroyed.h>
#include <wtf/StdLibExtras.h>
-#if PLATFORM(COCOA)
-#include <wtf/spi/darwin/dyldSPI.h>
-#endif
-
-#if ENABLE(MEDIA_STREAM) && USE(AVFOUNDATION)
-#include "RealtimeMediaSourceCenterMac.h"
-#endif
-
-#if ENABLE(MEDIA_STREAM)
-#include "MockRealtimeMediaSourceCenter.h"
-#endif
-
namespace WebCore {
-static void setImageLoadingSettings(Page* page)
-{
- if (!page)
- return;
-
- for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
- if (!frame->document())
- continue;
- frame->document()->cachedResourceLoader().setImagesEnabled(page->settings().areImagesEnabled());
- frame->document()->cachedResourceLoader().setAutoLoadImages(page->settings().loadsImagesAutomatically());
- }
-}
-
-static void invalidateAfterGenericFamilyChange(Page* page)
-{
- invalidateFontCascadeCache();
- if (page)
- page->setNeedsRecalcStyleInAllFrames();
-}
-
-#if USE(AVFOUNDATION)
-bool Settings::gAVFoundationEnabled = true;
-bool Settings::gAVFoundationNSURLSessionEnabled = true;
-#endif
-
-#if PLATFORM(COCOA)
-bool Settings::gQTKitEnabled = false;
-#endif
-
-#if USE(GSTREAMER)
-bool Settings::gGStreamerEnabled = true;
-#endif
-
-bool Settings::gMockScrollbarsEnabled = false;
-bool Settings::gUsesOverlayScrollbars = false;
-bool Settings::gMockScrollAnimatorEnabled = false;
-
-#if ENABLE(MEDIA_STREAM)
-bool Settings::gMockCaptureDevicesEnabled = false;
-bool Settings::gMediaCaptureRequiresSecureConnection = true;
-#endif
-
-#if PLATFORM(WIN)
-bool Settings::gShouldUseHighResolutionTimers = true;
-#endif
-
-bool Settings::gShouldRespectPriorityInCSSAttributeSetters = false;
-bool Settings::gLowPowerVideoAudioBufferSizeEnabled = false;
-bool Settings::gResourceLoadStatisticsEnabledEnabled = false;
-bool Settings::gAllowsAnySSLCertificate = false;
-
-#if PLATFORM(IOS)
-bool Settings::gNetworkDataUsageTrackingEnabled = false;
-bool Settings::gAVKitEnabled = false;
-bool Settings::gShouldOptOutOfNetworkStateObservation = false;
-#endif
-bool Settings::gManageAudioSession = false;
-bool Settings::gCustomPasteboardDataEnabled = false;
-
// NOTEs
// 1) EditingMacBehavior comprises Tiger, Leopard, SnowLeopard and iOS builds, as well as QtWebKit when built on Mac;
// 2) EditingWindowsBehavior comprises Win32 build;
@@ -144,19 +71,6 @@
;
}
-bool Settings::defaultCustomPasteboardDataEnabled()
-{
-#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110300
- return IOSApplication::isMobileSafari() || dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_11_3;
-#elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
- return MacApplication::isSafari() || dyld_get_program_sdk_version() > DYLD_MACOSX_VERSION_10_13;
-#elif PLATFORM(MAC)
- return MacApplication::isSafari();
-#else
- return false;
-#endif
-}
-
#if PLATFORM(COCOA)
static const bool defaultYouTubeFlashPluginReplacementEnabled = true;
#else
@@ -192,7 +106,6 @@
#endif
static const bool defaultRequiresUserGestureToLoadVideo = true;
-
static const bool defaultAllowsPictureInPictureMediaPlayback = true;
static const double defaultIncrementalRenderingSuppressionTimeoutInSeconds = 5;
@@ -204,48 +117,15 @@
static const bool defaultSmartInsertDeleteEnabled = true;
static const bool defaultSelectTrailingWhitespaceEnabled = false;
-// This amount of time must have elapsed before we will even consider scheduling a layout without a delay.
-// FIXME: For faster machines this value can really be lowered to 200. 250 is adequate, but a little high
-// for dual G5s. :)
-static const Seconds layoutScheduleThreshold = 250_ms;
+Ref<Settings> Settings::create(Page* page)
+{
+ return adoptRef(*new Settings(page));
+}
Settings::Settings(Page* page)
- : m_page(nullptr)
- , m_mediaTypeOverride("screen")
- , m_fontGenericFamilies(std::make_unique<FontGenericFamilies>())
- , m_storageBlockingPolicy(SecurityOrigin::AllowAllStorage)
- , m_layoutInterval(layoutScheduleThreshold)
- , m_minimumDOMTimerInterval(DOMTimer::defaultMinimumInterval())
+ : SettingsBase(page)
SETTINGS_INITIALIZER_LIST
- , m_isJavaEnabled(false)
- , m_isJavaEnabledForLocalFiles(true)
- , m_loadsImagesAutomatically(false)
- , m_areImagesEnabled(true)
- , m_preferMIMETypeForImages(false)
- , m_arePluginsEnabled(false)
- , m_isScriptEnabled(false)
- , m_needsAdobeFrameReloadingQuirk(false)
- , m_usesPageCache(false)
- , m_fontRenderingMode(0)
- , m_showTiledScrollingIndicator(false)
- , m_backgroundShouldExtendBeyondPage(false)
- , m_dnsPrefetchingEnabled(false)
-#if ENABLE(TOUCH_EVENTS)
- , m_touchEventEmulationEnabled(false)
-#endif
- , m_scrollingPerformanceLoggingEnabled(false)
- , m_timeWithoutMouseMovementBeforeHidingControls(3_s)
- , m_setImageLoadingSettingsTimer(*this, &Settings::imageLoadingSettingsTimerFired)
- , m_hiddenPageDOMTimerThrottlingEnabled(false)
- , m_hiddenPageCSSAnimationSuspensionEnabled(false)
- , m_fontFallbackPrefersPictographs(false)
- , m_forcePendingWebGLPolicy(false)
{
- // A Frame may not have been created yet, so we initialize the AtomicString
- // hash before trying to use it.
- AtomicString::init();
- initializeDefaultFontFamilies();
- m_page = page; // Page is not yet fully initialized when constructing Settings, so keeping m_page null over initializeDefaultFontFamilies() call.
}
Settings::~Settings()
@@ -252,195 +132,8 @@
{
}
-Ref<Settings> Settings::create(Page* page)
-{
- return adoptRef(*new Settings(page));
-}
-
SETTINGS_SETTER_BODIES
-#if !PLATFORM(COCOA)
-void Settings::initializeDefaultFontFamilies()
-{
- // Other platforms can set up fonts from a client, but on Mac, we want it in WebCore to share code between WebKit1 and WebKit2.
-}
-#endif
-
-const AtomicString& Settings::standardFontFamily(UScriptCode script) const
-{
- return m_fontGenericFamilies->standardFontFamily(script);
-}
-
-void Settings::setStandardFontFamily(const AtomicString& family, UScriptCode script)
-{
- bool changes = m_fontGenericFamilies->setStandardFontFamily(family, script);
- if (changes)
- invalidateAfterGenericFamilyChange(m_page);
-}
-
-const AtomicString& Settings::fixedFontFamily(UScriptCode script) const
-{
- return m_fontGenericFamilies->fixedFontFamily(script);
-}
-
-void Settings::setFixedFontFamily(const AtomicString& family, UScriptCode script)
-{
- bool changes = m_fontGenericFamilies->setFixedFontFamily(family, script);
- if (changes)
- invalidateAfterGenericFamilyChange(m_page);
-}
-
-const AtomicString& Settings::serifFontFamily(UScriptCode script) const
-{
- return m_fontGenericFamilies->serifFontFamily(script);
-}
-
-void Settings::setSerifFontFamily(const AtomicString& family, UScriptCode script)
-{
- bool changes = m_fontGenericFamilies->setSerifFontFamily(family, script);
- if (changes)
- invalidateAfterGenericFamilyChange(m_page);
-}
-
-const AtomicString& Settings::sansSerifFontFamily(UScriptCode script) const
-{
- return m_fontGenericFamilies->sansSerifFontFamily(script);
-}
-
-void Settings::setSansSerifFontFamily(const AtomicString& family, UScriptCode script)
-{
- bool changes = m_fontGenericFamilies->setSansSerifFontFamily(family, script);
- if (changes)
- invalidateAfterGenericFamilyChange(m_page);
-}
-
-const AtomicString& Settings::cursiveFontFamily(UScriptCode script) const
-{
- return m_fontGenericFamilies->cursiveFontFamily(script);
-}
-
-void Settings::setCursiveFontFamily(const AtomicString& family, UScriptCode script)
-{
- bool changes = m_fontGenericFamilies->setCursiveFontFamily(family, script);
- if (changes)
- invalidateAfterGenericFamilyChange(m_page);
-}
-
-const AtomicString& Settings::fantasyFontFamily(UScriptCode script) const
-{
- return m_fontGenericFamilies->fantasyFontFamily(script);
-}
-
-void Settings::setFantasyFontFamily(const AtomicString& family, UScriptCode script)
-{
- bool changes = m_fontGenericFamilies->setFantasyFontFamily(family, script);
- if (changes)
- invalidateAfterGenericFamilyChange(m_page);
-}
-
-const AtomicString& Settings::pictographFontFamily(UScriptCode script) const
-{
- return m_fontGenericFamilies->pictographFontFamily(script);
-}
-
-void Settings::setPictographFontFamily(const AtomicString& family, UScriptCode script)
-{
- bool changes = m_fontGenericFamilies->setPictographFontFamily(family, script);
- if (changes)
- invalidateAfterGenericFamilyChange(m_page);
-}
-
-float Settings::defaultMinimumZoomFontSize()
-{
- return 15;
-}
-
-#if !PLATFORM(IOS)
-bool Settings::defaultTextAutosizingEnabled()
-{
- return false;
-}
-#endif
-
-void Settings::setMediaTypeOverride(const String& mediaTypeOverride)
-{
- if (m_mediaTypeOverride == mediaTypeOverride)
- return;
-
- m_mediaTypeOverride = mediaTypeOverride;
-
- if (!m_page)
- return;
-
- FrameView* view = m_page->mainFrame().view();
- ASSERT(view);
-
- view->setMediaType(mediaTypeOverride);
- m_page->setNeedsRecalcStyleInAllFrames();
-}
-
-void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
-{
- m_loadsImagesAutomatically = loadsImagesAutomatically;
-
- // Changing this setting to true might immediately start new loads for images that had previously had loading disabled.
- // If this happens while a WebView is being dealloc'ed, and we don't know the WebView is being dealloc'ed, these new loads
- // can cause crashes downstream when the WebView memory has actually been free'd.
- // One example where this can happen is in Mac apps that subclass WebView then do work in their overridden dealloc methods.
- // Starting these loads synchronously is not important. By putting it on a 0-delay, properly closing the Page cancels them
- // before they have a chance to really start.
- // See http://webkit.org/b/60572 for more discussion.
- m_setImageLoadingSettingsTimer.startOneShot(0_s);
-}
-
-void Settings::imageLoadingSettingsTimerFired()
-{
- setImageLoadingSettings(m_page);
-}
-
-void Settings::setScriptEnabled(bool isScriptEnabled)
-{
- if (m_isScriptEnabled == isScriptEnabled)
- return;
-
- m_isScriptEnabled = isScriptEnabled;
-
- if (!m_page)
- return;
-
-#if PLATFORM(IOS)
- m_page->setNeedsRecalcStyleInAllFrames();
-#endif
-}
-
-void Settings::setJavaEnabled(bool isJavaEnabled)
-{
- m_isJavaEnabled = isJavaEnabled;
-}
-
-void Settings::setJavaEnabledForLocalFiles(bool isJavaEnabledForLocalFiles)
-{
- m_isJavaEnabledForLocalFiles = isJavaEnabledForLocalFiles;
-}
-
-void Settings::setImagesEnabled(bool areImagesEnabled)
-{
- m_areImagesEnabled = areImagesEnabled;
-
- // See comment in setLoadsImagesAutomatically.
- m_setImageLoadingSettingsTimer.startOneShot(0_s);
-}
-
-void Settings::setPreferMIMETypeForImages(bool preferMIMETypeForImages)
-{
- m_preferMIMETypeForImages = preferMIMETypeForImages;
-}
-
-void Settings::setForcePendingWebGLPolicy(bool forced)
-{
- m_forcePendingWebGLPolicy = forced;
-}
-
FrameFlattening Settings::effectiveFrameFlattening()
{
#if PLATFORM(IOS)
@@ -453,381 +146,4 @@
return frameFlattening();
}
-void Settings::setPluginsEnabled(bool arePluginsEnabled)
-{
- if (m_arePluginsEnabled == arePluginsEnabled)
- return;
-
- m_arePluginsEnabled = arePluginsEnabled;
- Page::refreshPlugins(false);
-}
-
-void Settings::setUserStyleSheetLocation(const URL& userStyleSheetLocation)
-{
- if (m_userStyleSheetLocation == userStyleSheetLocation)
- return;
-
- m_userStyleSheetLocation = userStyleSheetLocation;
-
- if (m_page)
- m_page->userStyleSheetLocationChanged();
-}
-
-// FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need to phase it out once Adobe
-// can fix the bug from their end.
-void Settings::setNeedsAdobeFrameReloadingQuirk(bool shouldNotReloadIFramesForUnchangedSRC)
-{
- m_needsAdobeFrameReloadingQuirk = shouldNotReloadIFramesForUnchangedSRC;
-}
-
-void Settings::setMinimumDOMTimerInterval(Seconds interval)
-{
- auto oldTimerInterval = std::exchange(m_minimumDOMTimerInterval, interval);
-
- if (!m_page)
- return;
-
- for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
- if (frame->document())
- frame->document()->adjustMinimumDOMTimerInterval(oldTimerInterval);
- }
-}
-
-void Settings::setLayoutInterval(Seconds layoutInterval)
-{
- // FIXME: It seems weird that this function may disregard the specified layout interval.
- // We should either expose layoutScheduleThreshold or better communicate this invariant.
- m_layoutInterval = std::max(layoutInterval, layoutScheduleThreshold);
-}
-
-void Settings::setUsesPageCache(bool usesPageCache)
-{
- if (m_usesPageCache == usesPageCache)
- return;
-
- m_usesPageCache = usesPageCache;
-
- if (!m_page)
- return;
-
- if (!m_usesPageCache)
- PageCache::singleton().pruneToSizeNow(0, PruningReason::None);
-}
-
-void Settings::setFontRenderingMode(FontRenderingMode mode)
-{
- if (fontRenderingMode() == mode)
- return;
- m_fontRenderingMode = static_cast<int>(mode);
- if (m_page)
- m_page->setNeedsRecalcStyleInAllFrames();
-}
-
-FontRenderingMode Settings::fontRenderingMode() const
-{
- return static_cast<FontRenderingMode>(m_fontRenderingMode);
-}
-
-void Settings::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
-{
- if (m_dnsPrefetchingEnabled == dnsPrefetchingEnabled)
- return;
-
- m_dnsPrefetchingEnabled = dnsPrefetchingEnabled;
- if (m_page)
- m_page->dnsPrefetchingStateChanged();
-}
-
-void Settings::setShowTiledScrollingIndicator(bool enabled)
-{
- if (m_showTiledScrollingIndicator == enabled)
- return;
-
- m_showTiledScrollingIndicator = enabled;
-}
-
-#if ENABLE(RESOURCE_USAGE)
-void Settings::setResourceUsageOverlayVisible(bool visible)
-{
- if (m_resourceUsageOverlayVisible == visible)
- return;
-
- m_resourceUsageOverlayVisible = visible;
- if (m_page)
- m_page->setResourceUsageOverlayVisible(visible);
-}
-#endif
-
-#if PLATFORM(WIN)
-void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
-{
- gShouldUseHighResolutionTimers = shouldUseHighResolutionTimers;
-}
-#endif
-
-void Settings::setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy enabled)
-{
- if (m_storageBlockingPolicy == enabled)
- return;
-
- m_storageBlockingPolicy = enabled;
- if (m_page)
- m_page->storageBlockingStateChanged();
-}
-
-void Settings::setBackgroundShouldExtendBeyondPage(bool shouldExtend)
-{
- if (m_backgroundShouldExtendBeyondPage == shouldExtend)
- return;
-
- m_backgroundShouldExtendBeyondPage = shouldExtend;
-
- if (m_page)
- m_page->mainFrame().view()->updateExtendBackgroundIfNecessary();
-}
-
-#if USE(AVFOUNDATION)
-void Settings::setAVFoundationEnabled(bool enabled)
-{
- if (gAVFoundationEnabled == enabled)
- return;
-
- gAVFoundationEnabled = enabled;
- HTMLMediaElement::resetMediaEngines();
-}
-
-void Settings::setAVFoundationNSURLSessionEnabled(bool enabled)
-{
- if (gAVFoundationNSURLSessionEnabled == enabled)
- return;
-
- gAVFoundationNSURLSessionEnabled = enabled;
-}
-#endif
-
-#if PLATFORM(COCOA)
-void Settings::setQTKitEnabled(bool enabled)
-{
- if (gQTKitEnabled == enabled)
- return;
-
- gQTKitEnabled = enabled;
- HTMLMediaElement::resetMediaEngines();
-}
-#endif
-
-#if USE(GSTREAMER)
-void Settings::setGStreamerEnabled(bool enabled)
-{
- if (gGStreamerEnabled == enabled)
- return;
-
- gGStreamerEnabled = enabled;
- HTMLMediaElement::resetMediaEngines();
-}
-#endif
-
-#if ENABLE(MEDIA_STREAM)
-bool Settings::mockCaptureDevicesEnabled()
-{
- return gMockCaptureDevicesEnabled;
-}
-
-void Settings::setMockCaptureDevicesEnabled(bool enabled)
-{
- gMockCaptureDevicesEnabled = enabled;
- MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled(enabled);
-}
-
-bool Settings::mediaCaptureRequiresSecureConnection() const
-{
- return gMediaCaptureRequiresSecureConnection;
-}
-
-void Settings::setMediaCaptureRequiresSecureConnection(bool mediaCaptureRequiresSecureConnection)
-{
- gMediaCaptureRequiresSecureConnection = mediaCaptureRequiresSecureConnection;
-}
-#endif
-
-void Settings::setScrollingPerformanceLoggingEnabled(bool enabled)
-{
- m_scrollingPerformanceLoggingEnabled = enabled;
-
- if (m_page && m_page->mainFrame().view())
- m_page->mainFrame().view()->setScrollingPerformanceLoggingEnabled(enabled);
-}
-
-// It's very important that this setting doesn't change in the middle of a document's lifetime.
-// The Mac port uses this flag when registering and deregistering platform-dependent scrollbar
-// objects. Therefore, if this changes at an unexpected time, deregistration may not happen
-// correctly, which may cause the platform to follow dangling pointers.
-void Settings::setMockScrollbarsEnabled(bool flag)
-{
- gMockScrollbarsEnabled = flag;
- // FIXME: This should update scroll bars in existing pages.
-}
-
-bool Settings::mockScrollbarsEnabled()
-{
- return gMockScrollbarsEnabled;
-}
-
-void Settings::setUsesOverlayScrollbars(bool flag)
-{
- gUsesOverlayScrollbars = flag;
- // FIXME: This should update scroll bars in existing pages.
-}
-
-bool Settings::usesOverlayScrollbars()
-{
- return gUsesOverlayScrollbars;
-}
-
-void Settings::setUsesMockScrollAnimator(bool flag)
-{
- gMockScrollAnimatorEnabled = flag;
-}
-
-bool Settings::usesMockScrollAnimator()
-{
- return gMockScrollAnimatorEnabled;
-}
-
-void Settings::setShouldRespectPriorityInCSSAttributeSetters(bool flag)
-{
- gShouldRespectPriorityInCSSAttributeSetters = flag;
-}
-
-bool Settings::shouldRespectPriorityInCSSAttributeSetters()
-{
- return gShouldRespectPriorityInCSSAttributeSetters;
-}
-
-void Settings::setHiddenPageDOMTimerThrottlingEnabled(bool flag)
-{
- if (m_hiddenPageDOMTimerThrottlingEnabled == flag)
- return;
- m_hiddenPageDOMTimerThrottlingEnabled = flag;
- if (m_page)
- m_page->hiddenPageDOMTimerThrottlingStateChanged();
-}
-
-void Settings::setHiddenPageDOMTimerThrottlingAutoIncreases(bool flag)
-{
- if (m_hiddenPageDOMTimerThrottlingAutoIncreases == flag)
- return;
- m_hiddenPageDOMTimerThrottlingAutoIncreases = flag;
- if (m_page)
- m_page->hiddenPageDOMTimerThrottlingStateChanged();
-}
-
-void Settings::setHiddenPageCSSAnimationSuspensionEnabled(bool flag)
-{
- if (m_hiddenPageCSSAnimationSuspensionEnabled == flag)
- return;
- m_hiddenPageCSSAnimationSuspensionEnabled = flag;
- if (m_page)
- m_page->hiddenPageCSSAnimationSuspensionStateChanged();
-}
-
-void Settings::setFontFallbackPrefersPictographs(bool preferPictographs)
-{
- if (m_fontFallbackPrefersPictographs == preferPictographs)
- return;
-
- m_fontFallbackPrefersPictographs = preferPictographs;
- if (m_page)
- m_page->setNeedsRecalcStyleInAllFrames();
-}
-
-void Settings::setLowPowerVideoAudioBufferSizeEnabled(bool flag)
-{
- gLowPowerVideoAudioBufferSizeEnabled = flag;
-}
-
-void Settings::setResourceLoadStatisticsEnabled(bool flag)
-{
- gResourceLoadStatisticsEnabledEnabled = flag;
-}
-
-#if PLATFORM(IOS)
-void Settings::setAudioSessionCategoryOverride(unsigned sessionCategory)
-{
- AudioSession::sharedSession().setCategoryOverride(static_cast<AudioSession::CategoryType>(sessionCategory));
-}
-
-unsigned Settings::audioSessionCategoryOverride()
-{
- return AudioSession::sharedSession().categoryOverride();
-}
-
-void Settings::setNetworkDataUsageTrackingEnabled(bool trackingEnabled)
-{
- gNetworkDataUsageTrackingEnabled = trackingEnabled;
-}
-
-bool Settings::networkDataUsageTrackingEnabled()
-{
- return gNetworkDataUsageTrackingEnabled;
-}
-
-static String& sharedNetworkInterfaceNameGlobal()
-{
- static NeverDestroyed<String> networkInterfaceName;
- return networkInterfaceName;
-}
-
-void Settings::setNetworkInterfaceName(const String& networkInterfaceName)
-{
- sharedNetworkInterfaceNameGlobal() = networkInterfaceName;
-}
-
-const String& Settings::networkInterfaceName()
-{
- return sharedNetworkInterfaceNameGlobal();
-}
-#endif
-
-bool Settings::globalConstRedeclarationShouldThrow()
-{
-#if PLATFORM(MAC)
- return !MacApplication::isIBooks();
-#elif PLATFORM(IOS)
- return !IOSApplication::isIBooks();
-#else
- return true;
-#endif
-}
-
-void Settings::setAllowsAnySSLCertificate(bool allowAnySSLCertificate)
-{
- gAllowsAnySSLCertificate = allowAnySSLCertificate;
-}
-
-bool Settings::allowsAnySSLCertificate()
-{
- return gAllowsAnySSLCertificate;
-}
-
-#if !PLATFORM(COCOA)
-const String& Settings::defaultMediaContentTypesRequiringHardwareSupport()
-{
- return emptyString();
-}
-#endif
-
-void Settings::setMediaContentTypesRequiringHardwareSupport(const String& contentTypes)
-{
- m_mediaContentTypesRequiringHardwareSupport.shrink(0);
- for (auto type : StringView(contentTypes).split(':'))
- m_mediaContentTypesRequiringHardwareSupport.append(ContentType { type.toString() });
-}
-
-void Settings::setMediaContentTypesRequiringHardwareSupport(const Vector<ContentType>& contentTypes)
-{
- m_mediaContentTypesRequiringHardwareSupport = contentTypes;
-}
-
-
} // namespace WebCore
Modified: trunk/Source/WebCore/page/Settings.h (223331 => 223332)
--- trunk/Source/WebCore/page/Settings.h 2017-10-16 01:55:16 UTC (rev 223331)
+++ trunk/Source/WebCore/page/Settings.h 2017-10-16 02:59:07 UTC (rev 223332)
@@ -26,77 +26,11 @@
#pragma once
-#include "ClipboardAccessPolicy.h"
-#include "ContentType.h"
-#include "EditingBehaviorTypes.h"
-#include "IntSize.h"
-#include "SecurityOrigin.h"
-#include "SettingsMacros.h"
-#include "TextFlags.h"
-#include "Timer.h"
-#include "URL.h"
-#include "WritingMode.h"
-#include <runtime/RuntimeFlags.h>
-#include <unicode/uscript.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/AtomicStringHash.h>
+#include "SettingsBase.h"
-#if ENABLE(DATA_DETECTION)
-#include "DataDetection.h"
-#endif
-
namespace WebCore {
-class FontGenericFamilies;
-class Page;
-
-enum EditableLinkBehavior {
- EditableLinkDefaultBehavior,
- EditableLinkAlwaysLive,
- EditableLinkOnlyLiveWithShiftKey,
- EditableLinkLiveWhenNotFocused,
- EditableLinkNeverLive
-};
-
-enum TextDirectionSubmenuInclusionBehavior {
- TextDirectionSubmenuNeverIncluded,
- TextDirectionSubmenuAutomaticallyIncluded,
- TextDirectionSubmenuAlwaysIncluded
-};
-
-enum DebugOverlayRegionFlags {
- NonFastScrollableRegion = 1 << 0,
- WheelEventHandlerRegion = 1 << 1,
-};
-
-enum class UserInterfaceDirectionPolicy {
- Content,
- System
-};
-
-enum PDFImageCachingPolicy {
- PDFImageCachingEnabled,
- PDFImageCachingBelowMemoryLimit,
- PDFImageCachingDisabled,
- PDFImageCachingClipBoundsOnly,
-#if PLATFORM(IOS)
- PDFImageCachingDefault = PDFImageCachingBelowMemoryLimit
-#else
- PDFImageCachingDefault = PDFImageCachingEnabled
-#endif
-};
-
-enum FrameFlattening {
- FrameFlatteningDisabled,
- FrameFlatteningEnabledForNonFullScreenIFrames,
- FrameFlatteningFullyEnabled
-};
-
-typedef unsigned DebugOverlayRegions;
-
-class Settings : public RefCounted<Settings> {
+class Settings : public SettingsBase, public RefCounted<Settings> {
WTF_MAKE_NONCOPYABLE(Settings); WTF_MAKE_FAST_ALLOCATED;
public:
static Ref<Settings> create(Page*);
@@ -104,392 +38,16 @@
void pageDestroyed() { m_page = nullptr; }
- enum class FontLoadTimingOverride { None, Block, Swap, Failure };
-
- enum class ForcedAccessibilityValue { System, On, Off };
- static const Settings::ForcedAccessibilityValue defaultForcedColorsAreInvertedAccessibilityValue = ForcedAccessibilityValue::System;
- static const Settings::ForcedAccessibilityValue defaultForcedDisplayIsMonochromeAccessibilityValue = ForcedAccessibilityValue::System;
- static const Settings::ForcedAccessibilityValue defaultForcedPrefersReducedMotionAccessibilityValue = ForcedAccessibilityValue::System;
-
- WEBCORE_EXPORT void setStandardFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
- WEBCORE_EXPORT const AtomicString& standardFontFamily(UScriptCode = USCRIPT_COMMON) const;
-
- WEBCORE_EXPORT void setFixedFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
- WEBCORE_EXPORT const AtomicString& fixedFontFamily(UScriptCode = USCRIPT_COMMON) const;
-
- WEBCORE_EXPORT void setSerifFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
- WEBCORE_EXPORT const AtomicString& serifFontFamily(UScriptCode = USCRIPT_COMMON) const;
-
- WEBCORE_EXPORT void setSansSerifFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
- WEBCORE_EXPORT const AtomicString& sansSerifFontFamily(UScriptCode = USCRIPT_COMMON) const;
-
- WEBCORE_EXPORT void setCursiveFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
- WEBCORE_EXPORT const AtomicString& cursiveFontFamily(UScriptCode = USCRIPT_COMMON) const;
-
- WEBCORE_EXPORT void setFantasyFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
- WEBCORE_EXPORT const AtomicString& fantasyFontFamily(UScriptCode = USCRIPT_COMMON) const;
-
- WEBCORE_EXPORT void setPictographFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
- WEBCORE_EXPORT const AtomicString& pictographFontFamily(UScriptCode = USCRIPT_COMMON) const;
-
- WEBCORE_EXPORT static bool defaultTextAutosizingEnabled();
- WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
-
- // Only set by Layout Tests.
- WEBCORE_EXPORT void setMediaTypeOverride(const String&);
- const String& mediaTypeOverride() const { return m_mediaTypeOverride; }
-
- // Unlike areImagesEnabled, this only suppresses the network load of
- // the image URL. A cached image will still be rendered if requested.
- WEBCORE_EXPORT void setLoadsImagesAutomatically(bool);
- bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; }
-
- // Clients that execute script should call ScriptController::canExecuteScripts()
- // instead of this function. ScriptController::canExecuteScripts() checks the
- // HTML sandbox, plug-in sandboxing, and other important details.
- bool isScriptEnabled() const { return m_isScriptEnabled; }
- WEBCORE_EXPORT void setScriptEnabled(bool);
-
SETTINGS_GETTERS_AND_SETTERS
- WEBCORE_EXPORT void setJavaEnabled(bool);
- bool isJavaEnabled() const { return m_isJavaEnabled; }
- // This settings is only consulted if isJavaEnabled() returns true;
- WEBCORE_EXPORT void setJavaEnabledForLocalFiles(bool);
- bool isJavaEnabledForLocalFiles() const { return m_isJavaEnabledForLocalFiles; }
-
- WEBCORE_EXPORT void setImagesEnabled(bool);
- bool areImagesEnabled() const { return m_areImagesEnabled; }
-
- WEBCORE_EXPORT void setPreferMIMETypeForImages(bool);
- bool preferMIMETypeForImages() const { return m_preferMIMETypeForImages; }
-
- WEBCORE_EXPORT void setPluginsEnabled(bool);
- bool arePluginsEnabled() const { return m_arePluginsEnabled; }
-
- WEBCORE_EXPORT void setDNSPrefetchingEnabled(bool);
- bool dnsPrefetchingEnabled() const { return m_dnsPrefetchingEnabled; }
-
- WEBCORE_EXPORT void setUserStyleSheetLocation(const URL&);
- const URL& userStyleSheetLocation() const { return m_userStyleSheetLocation; }
-
- WEBCORE_EXPORT void setNeedsAdobeFrameReloadingQuirk(bool);
- bool needsAcrobatFrameReloadingQuirk() const { return m_needsAdobeFrameReloadingQuirk; }
-
- WEBCORE_EXPORT void setMinimumDOMTimerInterval(Seconds); // Initialized to DOMTimer::defaultMinimumInterval().
- Seconds minimumDOMTimerInterval() const { return m_minimumDOMTimerInterval; }
-
- WEBCORE_EXPORT void setLayoutInterval(Seconds);
- Seconds layoutInterval() const { return m_layoutInterval; }
-
- bool hiddenPageDOMTimerThrottlingEnabled() const { return m_hiddenPageDOMTimerThrottlingEnabled; }
- WEBCORE_EXPORT void setHiddenPageDOMTimerThrottlingEnabled(bool);
- bool hiddenPageDOMTimerThrottlingAutoIncreases() const { return m_hiddenPageDOMTimerThrottlingAutoIncreases; }
- WEBCORE_EXPORT void setHiddenPageDOMTimerThrottlingAutoIncreases(bool);
-
- WEBCORE_EXPORT void setUsesPageCache(bool);
- bool usesPageCache() const { return m_usesPageCache; }
-
- void setFontRenderingMode(FontRenderingMode mode);
- FontRenderingMode fontRenderingMode() const;
-
- WEBCORE_EXPORT void setShowTiledScrollingIndicator(bool);
- bool showTiledScrollingIndicator() const { return m_showTiledScrollingIndicator; }
-
-#if ENABLE(RESOURCE_USAGE)
- bool resourceUsageOverlayVisible() const { return m_resourceUsageOverlayVisible; }
- WEBCORE_EXPORT void setResourceUsageOverlayVisible(bool);
-#endif
-
-#if PLATFORM(WIN)
- static void setShouldUseHighResolutionTimers(bool);
- static bool shouldUseHighResolutionTimers() { return gShouldUseHighResolutionTimers; }
-#endif
-
- static bool isPostLoadCPUUsageMeasurementEnabled();
- static bool isPostBackgroundingCPUUsageMeasurementEnabled();
- static bool isPerActivityStateCPUUsageMeasurementEnabled();
-
- static bool isPostLoadMemoryUsageMeasurementEnabled();
- static bool isPostBackgroundingMemoryUsageMeasurementEnabled();
-
- static bool globalConstRedeclarationShouldThrow();
-
- WEBCORE_EXPORT void setBackgroundShouldExtendBeyondPage(bool);
- bool backgroundShouldExtendBeyondPage() const { return m_backgroundShouldExtendBeyondPage; }
-
-#if USE(AVFOUNDATION)
- WEBCORE_EXPORT static void setAVFoundationEnabled(bool flag);
- static bool isAVFoundationEnabled() { return gAVFoundationEnabled; }
- WEBCORE_EXPORT static void setAVFoundationNSURLSessionEnabled(bool flag);
- static bool isAVFoundationNSURLSessionEnabled() { return gAVFoundationNSURLSessionEnabled; }
-#endif
-
-#if PLATFORM(COCOA)
- WEBCORE_EXPORT static void setQTKitEnabled(bool flag);
- static bool isQTKitEnabled() { return gQTKitEnabled; }
-#else
- static bool isQTKitEnabled() { return false; }
-#endif
-
-#if USE(GSTREAMER)
- WEBCORE_EXPORT static void setGStreamerEnabled(bool flag);
- static bool isGStreamerEnabled() { return gGStreamerEnabled; }
-#endif
-
- static const unsigned defaultMaximumHTMLParserDOMTreeDepth = 512;
- static const unsigned defaultMaximumRenderTreeDepth = 512;
-
- WEBCORE_EXPORT static void setMockScrollbarsEnabled(bool flag);
- WEBCORE_EXPORT static bool mockScrollbarsEnabled();
-
- WEBCORE_EXPORT static void setUsesOverlayScrollbars(bool flag);
- static bool usesOverlayScrollbars();
-
- WEBCORE_EXPORT static void setUsesMockScrollAnimator(bool);
- static bool usesMockScrollAnimator();
-
-#if ENABLE(TOUCH_EVENTS)
- void setTouchEventEmulationEnabled(bool enabled) { m_touchEventEmulationEnabled = enabled; }
- bool isTouchEventEmulationEnabled() const { return m_touchEventEmulationEnabled; }
-#endif
-
- WEBCORE_EXPORT void setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy);
- SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy() const { return m_storageBlockingPolicy; }
-
- WEBCORE_EXPORT void setScrollingPerformanceLoggingEnabled(bool);
- bool scrollingPerformanceLoggingEnabled() { return m_scrollingPerformanceLoggingEnabled; }
-
- WEBCORE_EXPORT static void setShouldRespectPriorityInCSSAttributeSetters(bool);
- static bool shouldRespectPriorityInCSSAttributeSetters();
-
- void setTimeWithoutMouseMovementBeforeHidingControls(Seconds time) { m_timeWithoutMouseMovementBeforeHidingControls = time; }
- Seconds timeWithoutMouseMovementBeforeHidingControls() const { return m_timeWithoutMouseMovementBeforeHidingControls; }
-
- bool hiddenPageCSSAnimationSuspensionEnabled() const { return m_hiddenPageCSSAnimationSuspensionEnabled; }
- WEBCORE_EXPORT void setHiddenPageCSSAnimationSuspensionEnabled(bool);
-
- WEBCORE_EXPORT void setFontFallbackPrefersPictographs(bool);
- bool fontFallbackPrefersPictographs() const { return m_fontFallbackPrefersPictographs; }
-
- static bool lowPowerVideoAudioBufferSizeEnabled() { return gLowPowerVideoAudioBufferSizeEnabled; }
- WEBCORE_EXPORT static void setLowPowerVideoAudioBufferSizeEnabled(bool);
-
- static bool resourceLoadStatisticsEnabled() { return gResourceLoadStatisticsEnabledEnabled; }
- WEBCORE_EXPORT static void setResourceLoadStatisticsEnabled(bool);
-
-#if PLATFORM(IOS)
- WEBCORE_EXPORT static void setAudioSessionCategoryOverride(unsigned);
- static unsigned audioSessionCategoryOverride();
-
- WEBCORE_EXPORT static void setNetworkDataUsageTrackingEnabled(bool);
- static bool networkDataUsageTrackingEnabled();
-
- WEBCORE_EXPORT static void setNetworkInterfaceName(const String&);
- static const String& networkInterfaceName();
-
-#if HAVE(AVKIT)
- static void setAVKitEnabled(bool flag) { gAVKitEnabled = flag; }
-#endif
- static bool avKitEnabled() { return gAVKitEnabled; }
-
- static void setShouldOptOutOfNetworkStateObservation(bool flag) { gShouldOptOutOfNetworkStateObservation = flag; }
- static bool shouldOptOutOfNetworkStateObservation() { return gShouldOptOutOfNetworkStateObservation; }
-#endif
-
-#if USE(AUDIO_SESSION)
- static void setShouldManageAudioSessionCategory(bool flag) { gManageAudioSession = flag; }
- static bool shouldManageAudioSessionCategory() { return gManageAudioSession; }
-#endif
-
- static void setCustomPasteboardDataEnabled(bool enabled) { gCustomPasteboardDataEnabled = enabled; }
- static bool customPasteboardDataEnabled() { return gCustomPasteboardDataEnabled; }
- WEBCORE_EXPORT static bool defaultCustomPasteboardDataEnabled();
-
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
- void setMediaKeysStorageDirectory(const String& directory) { m_mediaKeysStorageDirectory = directory; }
- const String& mediaKeysStorageDirectory() const { return m_mediaKeysStorageDirectory; }
-#endif
-
-#if ENABLE(MEDIA_STREAM)
- void setMediaDeviceIdentifierStorageDirectory(const String& directory) { m_mediaDeviceIdentifierStorageDirectory = directory; }
- const String& mediaDeviceIdentifierStorageDirectory() const { return m_mediaDeviceIdentifierStorageDirectory; }
-
- static bool mockCaptureDevicesEnabled();
- WEBCORE_EXPORT static void setMockCaptureDevicesEnabled(bool);
-
- bool mediaCaptureRequiresSecureConnection() const;
- WEBCORE_EXPORT static void setMediaCaptureRequiresSecureConnection(bool);
-#endif
-
-#if ENABLE(APPLE_PAY)
- bool applePayEnabled() const { return m_applePayEnabled; }
- void setApplePayEnabled(bool applePayEnabled) { m_applePayEnabled = applePayEnabled; }
-
- bool applePayCapabilityDisclosureAllowed() const { return m_applePayCapabilityDisclosureAllowed; }
- void setApplePayCapabilityDisclosureAllowed(bool applePayCapabilityDisclosureAllowed) { m_applePayCapabilityDisclosureAllowed = applePayCapabilityDisclosureAllowed; }
-#endif
-
- WEBCORE_EXPORT void setForcePendingWebGLPolicy(bool);
- bool isForcePendingWebGLPolicy() const { return m_forcePendingWebGLPolicy; }
-
WEBCORE_EXPORT FrameFlattening effectiveFrameFlattening();
- WEBCORE_EXPORT static void setAllowsAnySSLCertificate(bool);
- static bool allowsAnySSLCertificate();
-
- WEBCORE_EXPORT static const String& defaultMediaContentTypesRequiringHardwareSupport();
- WEBCORE_EXPORT void setMediaContentTypesRequiringHardwareSupport(const Vector<ContentType>&);
- WEBCORE_EXPORT void setMediaContentTypesRequiringHardwareSupport(const String&);
- const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const { return m_mediaContentTypesRequiringHardwareSupport; }
-
private:
explicit Settings(Page*);
- void initializeDefaultFontFamilies();
-
- Page* m_page;
-
- String m_mediaTypeOverride;
- URL m_userStyleSheetLocation;
- const std::unique_ptr<FontGenericFamilies> m_fontGenericFamilies;
- SecurityOrigin::StorageBlockingPolicy m_storageBlockingPolicy;
- Seconds m_layoutInterval;
- Seconds m_minimumDOMTimerInterval;
-
SETTINGS_MEMBER_VARIABLES
- bool m_isJavaEnabled : 1;
- bool m_isJavaEnabledForLocalFiles : 1;
- bool m_loadsImagesAutomatically : 1;
- bool m_areImagesEnabled : 1;
- bool m_preferMIMETypeForImages : 1;
- bool m_arePluginsEnabled : 1;
- bool m_isScriptEnabled : 1;
- bool m_needsAdobeFrameReloadingQuirk : 1;
- bool m_usesPageCache : 1;
- unsigned m_fontRenderingMode : 1;
- bool m_showTiledScrollingIndicator : 1;
- bool m_backgroundShouldExtendBeyondPage : 1;
- bool m_dnsPrefetchingEnabled : 1;
-
-#if ENABLE(TOUCH_EVENTS)
- bool m_touchEventEmulationEnabled : 1;
-#endif
- bool m_scrollingPerformanceLoggingEnabled : 1;
-
- Seconds m_timeWithoutMouseMovementBeforeHidingControls;
-
- Timer m_setImageLoadingSettingsTimer;
- void imageLoadingSettingsTimerFired();
-
- bool m_hiddenPageDOMTimerThrottlingEnabled : 1;
- bool m_hiddenPageCSSAnimationSuspensionEnabled : 1;
- bool m_fontFallbackPrefersPictographs : 1;
-
- bool m_forcePendingWebGLPolicy : 1;
-
-#if ENABLE(RESOURCE_USAGE)
- bool m_resourceUsageOverlayVisible { false };
-#endif
-
- bool m_hiddenPageDOMTimerThrottlingAutoIncreases { false };
-
-#if USE(AVFOUNDATION)
- WEBCORE_EXPORT static bool gAVFoundationEnabled;
- WEBCORE_EXPORT static bool gAVFoundationNSURLSessionEnabled;
-#endif
-
-#if PLATFORM(COCOA)
- WEBCORE_EXPORT static bool gQTKitEnabled;
-#endif
-
-#if USE(GSTREAMER)
- WEBCORE_EXPORT static bool gGStreamerEnabled;
-#endif
-
- static bool gMockScrollbarsEnabled;
- static bool gUsesOverlayScrollbars;
- static bool gMockScrollAnimatorEnabled;
-
-#if PLATFORM(WIN)
- static bool gShouldUseHighResolutionTimers;
-#endif
- static bool gShouldRespectPriorityInCSSAttributeSetters;
-#if PLATFORM(IOS)
- static bool gNetworkDataUsageTrackingEnabled;
- WEBCORE_EXPORT static bool gAVKitEnabled;
- WEBCORE_EXPORT static bool gShouldOptOutOfNetworkStateObservation;
-#endif
- WEBCORE_EXPORT static bool gManageAudioSession;
- WEBCORE_EXPORT static bool gCustomPasteboardDataEnabled;
-
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
- String m_mediaKeysStorageDirectory;
-#endif
-
-#if ENABLE(MEDIA_STREAM)
- String m_mediaDeviceIdentifierStorageDirectory;
- static bool gMockCaptureDevicesEnabled;
- static bool gMediaCaptureRequiresSecureConnection;
-#endif
-
-#if ENABLE(APPLE_PAY)
- bool m_applePayEnabled { false };
- bool m_applePayCapabilityDisclosureAllowed { true };
-#endif
-
- static bool gLowPowerVideoAudioBufferSizeEnabled;
- static bool gResourceLoadStatisticsEnabledEnabled;
- static bool gAllowsAnySSLCertificate;
-
- Vector<ContentType> m_mediaContentTypesRequiringHardwareSupport;
};
-inline bool Settings::isPostLoadCPUUsageMeasurementEnabled()
-{
-#if PLATFORM(COCOA)
- return true;
-#else
- return false;
-#endif
-}
-
-inline bool Settings::isPostBackgroundingCPUUsageMeasurementEnabled()
-{
-#if PLATFORM(MAC)
- return true;
-#else
- return false;
-#endif
-}
-
-inline bool Settings::isPerActivityStateCPUUsageMeasurementEnabled()
-{
-#if PLATFORM(MAC)
- return true;
-#else
- return false;
-#endif
-}
-
-inline bool Settings::isPostLoadMemoryUsageMeasurementEnabled()
-{
-#if PLATFORM(COCOA)
- return true;
-#else
- return false;
-#endif
-}
-
-inline bool Settings::isPostBackgroundingMemoryUsageMeasurementEnabled()
-{
-#if PLATFORM(MAC)
- return true;
-#else
- return false;
-#endif
-}
-
} // namespace WebCore
Copied: trunk/Source/WebCore/page/SettingsBase.cpp (from rev 223331, trunk/Source/WebCore/page/Settings.cpp) (0 => 223332)
--- trunk/Source/WebCore/page/SettingsBase.cpp (rev 0)
+++ trunk/Source/WebCore/page/SettingsBase.cpp 2017-10-16 02:59:07 UTC (rev 223332)
@@ -0,0 +1,741 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SettingsBase.h"
+
+#include "AudioSession.h"
+#include "BackForwardController.h"
+#include "CachedResourceLoader.h"
+#include "CookieStorage.h"
+#include "DOMTimer.h"
+#include "Database.h"
+#include "Document.h"
+#include "FontCascade.h"
+#include "FontGenericFamilies.h"
+#include "FrameTree.h"
+#include "FrameView.h"
+#include "HTMLMediaElement.h"
+#include "HistoryItem.h"
+#include "MainFrame.h"
+#include "Page.h"
+#include "PageCache.h"
+#include "RuntimeApplicationChecks.h"
+#include "Settings.h"
+#include "StorageMap.h"
+#include <limits>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/StdLibExtras.h>
+
+#if PLATFORM(COCOA)
+#include <wtf/spi/darwin/dyldSPI.h>
+#endif
+
+#if ENABLE(MEDIA_STREAM) && USE(AVFOUNDATION)
+#include "RealtimeMediaSourceCenterMac.h"
+#endif
+
+#if ENABLE(MEDIA_STREAM)
+#include "MockRealtimeMediaSourceCenter.h"
+#endif
+
+namespace WebCore {
+
+static void setImageLoadingSettings(Page* page)
+{
+ if (!page)
+ return;
+
+ for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ if (!frame->document())
+ continue;
+ frame->document()->cachedResourceLoader().setImagesEnabled(page->settings().areImagesEnabled());
+ frame->document()->cachedResourceLoader().setAutoLoadImages(page->settings().loadsImagesAutomatically());
+ }
+}
+
+static void invalidateAfterGenericFamilyChange(Page* page)
+{
+ invalidateFontCascadeCache();
+ if (page)
+ page->setNeedsRecalcStyleInAllFrames();
+}
+
+#if USE(AVFOUNDATION)
+bool SettingsBase::gAVFoundationEnabled = true;
+bool SettingsBase::gAVFoundationNSURLSessionEnabled = true;
+#endif
+
+#if PLATFORM(COCOA)
+bool SettingsBase::gQTKitEnabled = false;
+#endif
+
+#if USE(GSTREAMER)
+bool SettingsBase::gGStreamerEnabled = true;
+#endif
+
+bool SettingsBase::gMockScrollbarsEnabled = false;
+bool SettingsBase::gUsesOverlayScrollbars = false;
+bool SettingsBase::gMockScrollAnimatorEnabled = false;
+
+#if ENABLE(MEDIA_STREAM)
+bool SettingsBase::gMockCaptureDevicesEnabled = false;
+bool SettingsBase::gMediaCaptureRequiresSecureConnection = true;
+#endif
+
+#if PLATFORM(WIN)
+bool SettingsBase::gShouldUseHighResolutionTimers = true;
+#endif
+
+bool SettingsBase::gShouldRespectPriorityInCSSAttributeSetters = false;
+bool SettingsBase::gLowPowerVideoAudioBufferSizeEnabled = false;
+bool SettingsBase::gResourceLoadStatisticsEnabledEnabled = false;
+bool SettingsBase::gAllowsAnySSLCertificate = false;
+
+#if PLATFORM(IOS)
+bool SettingsBase::gNetworkDataUsageTrackingEnabled = false;
+bool SettingsBase::gAVKitEnabled = false;
+bool SettingsBase::gShouldOptOutOfNetworkStateObservation = false;
+#endif
+bool SettingsBase::gManageAudioSession = false;
+bool SettingsBase::gCustomPasteboardDataEnabled = false;
+
+bool SettingsBase::defaultCustomPasteboardDataEnabled()
+{
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110300
+ return IOSApplication::isMobileSafari() || dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_11_3;
+#elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
+ return MacApplication::isSafari() || dyld_get_program_sdk_version() > DYLD_MACOSX_VERSION_10_13;
+#elif PLATFORM(MAC)
+ return MacApplication::isSafari();
+#else
+ return false;
+#endif
+}
+
+
+// This amount of time must have elapsed before we will even consider scheduling a layout without a delay.
+// FIXME: For faster machines this value can really be lowered to 200. 250 is adequate, but a little high
+// for dual G5s. :)
+static const Seconds layoutScheduleThreshold = 250_ms;
+
+SettingsBase::SettingsBase(Page* page)
+ : m_page(nullptr)
+ , m_fontGenericFamilies(std::make_unique<FontGenericFamilies>())
+ , m_layoutInterval(layoutScheduleThreshold)
+ , m_minimumDOMTimerInterval(DOMTimer::defaultMinimumInterval())
+ , m_isJavaEnabled(false)
+ , m_isJavaEnabledForLocalFiles(true)
+ , m_loadsImagesAutomatically(false)
+ , m_areImagesEnabled(true)
+ , m_preferMIMETypeForImages(false)
+ , m_arePluginsEnabled(false)
+ , m_isScriptEnabled(false)
+ , m_needsAdobeFrameReloadingQuirk(false)
+ , m_usesPageCache(false)
+ , m_fontRenderingMode(0)
+ , m_showTiledScrollingIndicator(false)
+ , m_backgroundShouldExtendBeyondPage(false)
+ , m_dnsPrefetchingEnabled(false)
+#if ENABLE(TOUCH_EVENTS)
+ , m_touchEventEmulationEnabled(false)
+#endif
+ , m_scrollingPerformanceLoggingEnabled(false)
+ , m_setImageLoadingSettingsTimer(*this, &SettingsBase::imageLoadingSettingsTimerFired)
+ , m_hiddenPageDOMTimerThrottlingEnabled(false)
+ , m_hiddenPageCSSAnimationSuspensionEnabled(false)
+ , m_fontFallbackPrefersPictographs(false)
+ , m_forcePendingWebGLPolicy(false)
+{
+ // A Frame may not have been created yet, so we initialize the AtomicString
+ // hash before trying to use it.
+ AtomicString::init();
+ initializeDefaultFontFamilies();
+ m_page = page; // Page is not yet fully initialized when constructing Settings, so keeping m_page null over initializeDefaultFontFamilies() call.
+}
+
+SettingsBase::~SettingsBase()
+{
+}
+
+#if !PLATFORM(COCOA)
+void SettingsBase::initializeDefaultFontFamilies()
+{
+ // Other platforms can set up fonts from a client, but on Mac, we want it in WebCore to share code between WebKit1 and WebKit2.
+}
+#endif
+
+const AtomicString& SettingsBase::standardFontFamily(UScriptCode script) const
+{
+ return m_fontGenericFamilies->standardFontFamily(script);
+}
+
+void SettingsBase::setStandardFontFamily(const AtomicString& family, UScriptCode script)
+{
+ bool changes = m_fontGenericFamilies->setStandardFontFamily(family, script);
+ if (changes)
+ invalidateAfterGenericFamilyChange(m_page);
+}
+
+const AtomicString& SettingsBase::fixedFontFamily(UScriptCode script) const
+{
+ return m_fontGenericFamilies->fixedFontFamily(script);
+}
+
+void SettingsBase::setFixedFontFamily(const AtomicString& family, UScriptCode script)
+{
+ bool changes = m_fontGenericFamilies->setFixedFontFamily(family, script);
+ if (changes)
+ invalidateAfterGenericFamilyChange(m_page);
+}
+
+const AtomicString& SettingsBase::serifFontFamily(UScriptCode script) const
+{
+ return m_fontGenericFamilies->serifFontFamily(script);
+}
+
+void SettingsBase::setSerifFontFamily(const AtomicString& family, UScriptCode script)
+{
+ bool changes = m_fontGenericFamilies->setSerifFontFamily(family, script);
+ if (changes)
+ invalidateAfterGenericFamilyChange(m_page);
+}
+
+const AtomicString& SettingsBase::sansSerifFontFamily(UScriptCode script) const
+{
+ return m_fontGenericFamilies->sansSerifFontFamily(script);
+}
+
+void SettingsBase::setSansSerifFontFamily(const AtomicString& family, UScriptCode script)
+{
+ bool changes = m_fontGenericFamilies->setSansSerifFontFamily(family, script);
+ if (changes)
+ invalidateAfterGenericFamilyChange(m_page);
+}
+
+const AtomicString& SettingsBase::cursiveFontFamily(UScriptCode script) const
+{
+ return m_fontGenericFamilies->cursiveFontFamily(script);
+}
+
+void SettingsBase::setCursiveFontFamily(const AtomicString& family, UScriptCode script)
+{
+ bool changes = m_fontGenericFamilies->setCursiveFontFamily(family, script);
+ if (changes)
+ invalidateAfterGenericFamilyChange(m_page);
+}
+
+const AtomicString& SettingsBase::fantasyFontFamily(UScriptCode script) const
+{
+ return m_fontGenericFamilies->fantasyFontFamily(script);
+}
+
+void SettingsBase::setFantasyFontFamily(const AtomicString& family, UScriptCode script)
+{
+ bool changes = m_fontGenericFamilies->setFantasyFontFamily(family, script);
+ if (changes)
+ invalidateAfterGenericFamilyChange(m_page);
+}
+
+const AtomicString& SettingsBase::pictographFontFamily(UScriptCode script) const
+{
+ return m_fontGenericFamilies->pictographFontFamily(script);
+}
+
+void SettingsBase::setPictographFontFamily(const AtomicString& family, UScriptCode script)
+{
+ bool changes = m_fontGenericFamilies->setPictographFontFamily(family, script);
+ if (changes)
+ invalidateAfterGenericFamilyChange(m_page);
+}
+
+float SettingsBase::defaultMinimumZoomFontSize()
+{
+ return 15;
+}
+
+#if !PLATFORM(IOS)
+bool SettingsBase::defaultTextAutosizingEnabled()
+{
+ return false;
+}
+#endif
+
+void SettingsBase::setMediaTypeOverride(const String& mediaTypeOverride)
+{
+ if (m_mediaTypeOverride == mediaTypeOverride)
+ return;
+
+ m_mediaTypeOverride = mediaTypeOverride;
+
+ if (!m_page)
+ return;
+
+ FrameView* view = m_page->mainFrame().view();
+ ASSERT(view);
+
+ view->setMediaType(mediaTypeOverride);
+ m_page->setNeedsRecalcStyleInAllFrames();
+}
+
+void SettingsBase::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
+{
+ m_loadsImagesAutomatically = loadsImagesAutomatically;
+
+ // Changing this setting to true might immediately start new loads for images that had previously had loading disabled.
+ // If this happens while a WebView is being dealloc'ed, and we don't know the WebView is being dealloc'ed, these new loads
+ // can cause crashes downstream when the WebView memory has actually been free'd.
+ // One example where this can happen is in Mac apps that subclass WebView then do work in their overridden dealloc methods.
+ // Starting these loads synchronously is not important. By putting it on a 0-delay, properly closing the Page cancels them
+ // before they have a chance to really start.
+ // See http://webkit.org/b/60572 for more discussion.
+ m_setImageLoadingSettingsTimer.startOneShot(0_s);
+}
+
+void SettingsBase::imageLoadingSettingsTimerFired()
+{
+ setImageLoadingSettings(m_page);
+}
+
+void SettingsBase::setScriptEnabled(bool isScriptEnabled)
+{
+ if (m_isScriptEnabled == isScriptEnabled)
+ return;
+
+ m_isScriptEnabled = isScriptEnabled;
+
+ if (!m_page)
+ return;
+
+#if PLATFORM(IOS)
+ m_page->setNeedsRecalcStyleInAllFrames();
+#endif
+}
+
+void SettingsBase::setJavaEnabled(bool isJavaEnabled)
+{
+ m_isJavaEnabled = isJavaEnabled;
+}
+
+void SettingsBase::setJavaEnabledForLocalFiles(bool isJavaEnabledForLocalFiles)
+{
+ m_isJavaEnabledForLocalFiles = isJavaEnabledForLocalFiles;
+}
+
+void SettingsBase::setImagesEnabled(bool areImagesEnabled)
+{
+ m_areImagesEnabled = areImagesEnabled;
+
+ // See comment in setLoadsImagesAutomatically.
+ m_setImageLoadingSettingsTimer.startOneShot(0_s);
+}
+
+void SettingsBase::setPreferMIMETypeForImages(bool preferMIMETypeForImages)
+{
+ m_preferMIMETypeForImages = preferMIMETypeForImages;
+}
+
+void SettingsBase::setForcePendingWebGLPolicy(bool forced)
+{
+ m_forcePendingWebGLPolicy = forced;
+}
+
+void SettingsBase::setPluginsEnabled(bool arePluginsEnabled)
+{
+ if (m_arePluginsEnabled == arePluginsEnabled)
+ return;
+
+ m_arePluginsEnabled = arePluginsEnabled;
+ Page::refreshPlugins(false);
+}
+
+void SettingsBase::setUserStyleSheetLocation(const URL& userStyleSheetLocation)
+{
+ if (m_userStyleSheetLocation == userStyleSheetLocation)
+ return;
+
+ m_userStyleSheetLocation = userStyleSheetLocation;
+
+ if (m_page)
+ m_page->userStyleSheetLocationChanged();
+}
+
+// FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need to phase it out once Adobe
+// can fix the bug from their end.
+void SettingsBase::setNeedsAdobeFrameReloadingQuirk(bool shouldNotReloadIFramesForUnchangedSRC)
+{
+ m_needsAdobeFrameReloadingQuirk = shouldNotReloadIFramesForUnchangedSRC;
+}
+
+void SettingsBase::setMinimumDOMTimerInterval(Seconds interval)
+{
+ auto oldTimerInterval = std::exchange(m_minimumDOMTimerInterval, interval);
+
+ if (!m_page)
+ return;
+
+ for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ if (frame->document())
+ frame->document()->adjustMinimumDOMTimerInterval(oldTimerInterval);
+ }
+}
+
+void SettingsBase::setLayoutInterval(Seconds layoutInterval)
+{
+ // FIXME: It seems weird that this function may disregard the specified layout interval.
+ // We should either expose layoutScheduleThreshold or better communicate this invariant.
+ m_layoutInterval = std::max(layoutInterval, layoutScheduleThreshold);
+}
+
+void SettingsBase::setUsesPageCache(bool usesPageCache)
+{
+ if (m_usesPageCache == usesPageCache)
+ return;
+
+ m_usesPageCache = usesPageCache;
+
+ if (!m_page)
+ return;
+
+ if (!m_usesPageCache)
+ PageCache::singleton().pruneToSizeNow(0, PruningReason::None);
+}
+
+void SettingsBase::setFontRenderingMode(FontRenderingMode mode)
+{
+ if (fontRenderingMode() == mode)
+ return;
+ m_fontRenderingMode = static_cast<int>(mode);
+ if (m_page)
+ m_page->setNeedsRecalcStyleInAllFrames();
+}
+
+FontRenderingMode SettingsBase::fontRenderingMode() const
+{
+ return static_cast<FontRenderingMode>(m_fontRenderingMode);
+}
+
+void SettingsBase::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
+{
+ if (m_dnsPrefetchingEnabled == dnsPrefetchingEnabled)
+ return;
+
+ m_dnsPrefetchingEnabled = dnsPrefetchingEnabled;
+ if (m_page)
+ m_page->dnsPrefetchingStateChanged();
+}
+
+void SettingsBase::setShowTiledScrollingIndicator(bool enabled)
+{
+ if (m_showTiledScrollingIndicator == enabled)
+ return;
+
+ m_showTiledScrollingIndicator = enabled;
+}
+
+#if ENABLE(RESOURCE_USAGE)
+void SettingsBase::setResourceUsageOverlayVisible(bool visible)
+{
+ if (m_resourceUsageOverlayVisible == visible)
+ return;
+
+ m_resourceUsageOverlayVisible = visible;
+ if (m_page)
+ m_page->setResourceUsageOverlayVisible(visible);
+}
+#endif
+
+#if PLATFORM(WIN)
+void SettingsBase::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
+{
+ gShouldUseHighResolutionTimers = shouldUseHighResolutionTimers;
+}
+#endif
+
+void SettingsBase::setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy enabled)
+{
+ if (m_storageBlockingPolicy == enabled)
+ return;
+
+ m_storageBlockingPolicy = enabled;
+ if (m_page)
+ m_page->storageBlockingStateChanged();
+}
+
+void SettingsBase::setBackgroundShouldExtendBeyondPage(bool shouldExtend)
+{
+ if (m_backgroundShouldExtendBeyondPage == shouldExtend)
+ return;
+
+ m_backgroundShouldExtendBeyondPage = shouldExtend;
+
+ if (m_page)
+ m_page->mainFrame().view()->updateExtendBackgroundIfNecessary();
+}
+
+#if USE(AVFOUNDATION)
+void SettingsBase::setAVFoundationEnabled(bool enabled)
+{
+ if (gAVFoundationEnabled == enabled)
+ return;
+
+ gAVFoundationEnabled = enabled;
+ HTMLMediaElement::resetMediaEngines();
+}
+
+void SettingsBase::setAVFoundationNSURLSessionEnabled(bool enabled)
+{
+ if (gAVFoundationNSURLSessionEnabled == enabled)
+ return;
+
+ gAVFoundationNSURLSessionEnabled = enabled;
+}
+#endif
+
+#if PLATFORM(COCOA)
+void SettingsBase::setQTKitEnabled(bool enabled)
+{
+ if (gQTKitEnabled == enabled)
+ return;
+
+ gQTKitEnabled = enabled;
+ HTMLMediaElement::resetMediaEngines();
+}
+#endif
+
+#if USE(GSTREAMER)
+void SettingsBase::setGStreamerEnabled(bool enabled)
+{
+ if (gGStreamerEnabled == enabled)
+ return;
+
+ gGStreamerEnabled = enabled;
+ HTMLMediaElement::resetMediaEngines();
+}
+#endif
+
+#if ENABLE(MEDIA_STREAM)
+bool SettingsBase::mockCaptureDevicesEnabled()
+{
+ return gMockCaptureDevicesEnabled;
+}
+
+void SettingsBase::setMockCaptureDevicesEnabled(bool enabled)
+{
+ gMockCaptureDevicesEnabled = enabled;
+ MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled(enabled);
+}
+
+bool SettingsBase::mediaCaptureRequiresSecureConnection() const
+{
+ return gMediaCaptureRequiresSecureConnection;
+}
+
+void SettingsBase::setMediaCaptureRequiresSecureConnection(bool mediaCaptureRequiresSecureConnection)
+{
+ gMediaCaptureRequiresSecureConnection = mediaCaptureRequiresSecureConnection;
+}
+#endif
+
+void SettingsBase::setScrollingPerformanceLoggingEnabled(bool enabled)
+{
+ m_scrollingPerformanceLoggingEnabled = enabled;
+
+ if (m_page && m_page->mainFrame().view())
+ m_page->mainFrame().view()->setScrollingPerformanceLoggingEnabled(enabled);
+}
+
+// It's very important that this setting doesn't change in the middle of a document's lifetime.
+// The Mac port uses this flag when registering and deregistering platform-dependent scrollbar
+// objects. Therefore, if this changes at an unexpected time, deregistration may not happen
+// correctly, which may cause the platform to follow dangling pointers.
+void SettingsBase::setMockScrollbarsEnabled(bool flag)
+{
+ gMockScrollbarsEnabled = flag;
+ // FIXME: This should update scroll bars in existing pages.
+}
+
+bool SettingsBase::mockScrollbarsEnabled()
+{
+ return gMockScrollbarsEnabled;
+}
+
+void SettingsBase::setUsesOverlayScrollbars(bool flag)
+{
+ gUsesOverlayScrollbars = flag;
+ // FIXME: This should update scroll bars in existing pages.
+}
+
+bool SettingsBase::usesOverlayScrollbars()
+{
+ return gUsesOverlayScrollbars;
+}
+
+void SettingsBase::setUsesMockScrollAnimator(bool flag)
+{
+ gMockScrollAnimatorEnabled = flag;
+}
+
+bool SettingsBase::usesMockScrollAnimator()
+{
+ return gMockScrollAnimatorEnabled;
+}
+
+void SettingsBase::setShouldRespectPriorityInCSSAttributeSetters(bool flag)
+{
+ gShouldRespectPriorityInCSSAttributeSetters = flag;
+}
+
+bool SettingsBase::shouldRespectPriorityInCSSAttributeSetters()
+{
+ return gShouldRespectPriorityInCSSAttributeSetters;
+}
+
+void SettingsBase::setHiddenPageDOMTimerThrottlingEnabled(bool flag)
+{
+ if (m_hiddenPageDOMTimerThrottlingEnabled == flag)
+ return;
+ m_hiddenPageDOMTimerThrottlingEnabled = flag;
+ if (m_page)
+ m_page->hiddenPageDOMTimerThrottlingStateChanged();
+}
+
+void SettingsBase::setHiddenPageDOMTimerThrottlingAutoIncreases(bool flag)
+{
+ if (m_hiddenPageDOMTimerThrottlingAutoIncreases == flag)
+ return;
+ m_hiddenPageDOMTimerThrottlingAutoIncreases = flag;
+ if (m_page)
+ m_page->hiddenPageDOMTimerThrottlingStateChanged();
+}
+
+void SettingsBase::setHiddenPageCSSAnimationSuspensionEnabled(bool flag)
+{
+ if (m_hiddenPageCSSAnimationSuspensionEnabled == flag)
+ return;
+ m_hiddenPageCSSAnimationSuspensionEnabled = flag;
+ if (m_page)
+ m_page->hiddenPageCSSAnimationSuspensionStateChanged();
+}
+
+void SettingsBase::setFontFallbackPrefersPictographs(bool preferPictographs)
+{
+ if (m_fontFallbackPrefersPictographs == preferPictographs)
+ return;
+
+ m_fontFallbackPrefersPictographs = preferPictographs;
+ if (m_page)
+ m_page->setNeedsRecalcStyleInAllFrames();
+}
+
+void SettingsBase::setLowPowerVideoAudioBufferSizeEnabled(bool flag)
+{
+ gLowPowerVideoAudioBufferSizeEnabled = flag;
+}
+
+void SettingsBase::setResourceLoadStatisticsEnabled(bool flag)
+{
+ gResourceLoadStatisticsEnabledEnabled = flag;
+}
+
+#if PLATFORM(IOS)
+void SettingsBase::setAudioSessionCategoryOverride(unsigned sessionCategory)
+{
+ AudioSession::sharedSession().setCategoryOverride(static_cast<AudioSession::CategoryType>(sessionCategory));
+}
+
+unsigned SettingsBase::audioSessionCategoryOverride()
+{
+ return AudioSession::sharedSession().categoryOverride();
+}
+
+void SettingsBase::setNetworkDataUsageTrackingEnabled(bool trackingEnabled)
+{
+ gNetworkDataUsageTrackingEnabled = trackingEnabled;
+}
+
+bool SettingsBase::networkDataUsageTrackingEnabled()
+{
+ return gNetworkDataUsageTrackingEnabled;
+}
+
+static String& sharedNetworkInterfaceNameGlobal()
+{
+ static NeverDestroyed<String> networkInterfaceName;
+ return networkInterfaceName;
+}
+
+void SettingsBase::setNetworkInterfaceName(const String& networkInterfaceName)
+{
+ sharedNetworkInterfaceNameGlobal() = networkInterfaceName;
+}
+
+const String& SettingsBase::networkInterfaceName()
+{
+ return sharedNetworkInterfaceNameGlobal();
+}
+#endif
+
+bool SettingsBase::globalConstRedeclarationShouldThrow()
+{
+#if PLATFORM(MAC)
+ return !MacApplication::isIBooks();
+#elif PLATFORM(IOS)
+ return !IOSApplication::isIBooks();
+#else
+ return true;
+#endif
+}
+
+void SettingsBase::setAllowsAnySSLCertificate(bool allowAnySSLCertificate)
+{
+ gAllowsAnySSLCertificate = allowAnySSLCertificate;
+}
+
+bool SettingsBase::allowsAnySSLCertificate()
+{
+ return gAllowsAnySSLCertificate;
+}
+
+#if !PLATFORM(COCOA)
+const String& SettingsBase::defaultMediaContentTypesRequiringHardwareSupport()
+{
+ return emptyString();
+}
+#endif
+
+void SettingsBase::setMediaContentTypesRequiringHardwareSupport(const String& contentTypes)
+{
+ m_mediaContentTypesRequiringHardwareSupport.shrink(0);
+ for (auto type : StringView(contentTypes).split(':'))
+ m_mediaContentTypesRequiringHardwareSupport.append(ContentType { type.toString() });
+}
+
+void SettingsBase::setMediaContentTypesRequiringHardwareSupport(const Vector<ContentType>& contentTypes)
+{
+ m_mediaContentTypesRequiringHardwareSupport = contentTypes;
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/page/SettingsBase.h (from rev 223331, trunk/Source/WebCore/page/Settings.h) (0 => 223332)
--- trunk/Source/WebCore/page/SettingsBase.h (rev 0)
+++ trunk/Source/WebCore/page/SettingsBase.h 2017-10-16 02:59:07 UTC (rev 223332)
@@ -0,0 +1,487 @@
+/*
+ * Copyright (C) 2003-2016 Apple Inc. All rights reserved.
+ * (C) 2006 Graham Dennis ([email protected])
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ClipboardAccessPolicy.h"
+#include "ContentType.h"
+#include "EditingBehaviorTypes.h"
+#include "IntSize.h"
+#include "SecurityOrigin.h"
+#include "SettingsMacros.h"
+#include "TextFlags.h"
+#include "Timer.h"
+#include "URL.h"
+#include "WritingMode.h"
+#include <runtime/RuntimeFlags.h>
+#include <unicode/uscript.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/AtomicStringHash.h>
+
+#if ENABLE(DATA_DETECTION)
+#include "DataDetection.h"
+#endif
+
+namespace WebCore {
+
+class FontGenericFamilies;
+class Page;
+
+enum EditableLinkBehavior {
+ EditableLinkDefaultBehavior,
+ EditableLinkAlwaysLive,
+ EditableLinkOnlyLiveWithShiftKey,
+ EditableLinkLiveWhenNotFocused,
+ EditableLinkNeverLive
+};
+
+enum TextDirectionSubmenuInclusionBehavior {
+ TextDirectionSubmenuNeverIncluded,
+ TextDirectionSubmenuAutomaticallyIncluded,
+ TextDirectionSubmenuAlwaysIncluded
+};
+
+enum DebugOverlayRegionFlags {
+ NonFastScrollableRegion = 1 << 0,
+ WheelEventHandlerRegion = 1 << 1,
+};
+
+enum class UserInterfaceDirectionPolicy {
+ Content,
+ System
+};
+
+enum PDFImageCachingPolicy {
+ PDFImageCachingEnabled,
+ PDFImageCachingBelowMemoryLimit,
+ PDFImageCachingDisabled,
+ PDFImageCachingClipBoundsOnly,
+#if PLATFORM(IOS)
+ PDFImageCachingDefault = PDFImageCachingBelowMemoryLimit
+#else
+ PDFImageCachingDefault = PDFImageCachingEnabled
+#endif
+};
+
+enum FrameFlattening {
+ FrameFlatteningDisabled,
+ FrameFlatteningEnabledForNonFullScreenIFrames,
+ FrameFlatteningFullyEnabled
+};
+
+typedef unsigned DebugOverlayRegions;
+
+class SettingsBase {
+ WTF_MAKE_NONCOPYABLE(SettingsBase); WTF_MAKE_FAST_ALLOCATED;
+public:
+ ~SettingsBase();
+
+ enum class FontLoadTimingOverride { None, Block, Swap, Failure };
+
+ enum class ForcedAccessibilityValue { System, On, Off };
+ static const SettingsBase::ForcedAccessibilityValue defaultForcedColorsAreInvertedAccessibilityValue = ForcedAccessibilityValue::System;
+ static const SettingsBase::ForcedAccessibilityValue defaultForcedDisplayIsMonochromeAccessibilityValue = ForcedAccessibilityValue::System;
+ static const SettingsBase::ForcedAccessibilityValue defaultForcedPrefersReducedMotionAccessibilityValue = ForcedAccessibilityValue::System;
+
+ WEBCORE_EXPORT void setStandardFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
+ WEBCORE_EXPORT const AtomicString& standardFontFamily(UScriptCode = USCRIPT_COMMON) const;
+
+ WEBCORE_EXPORT void setFixedFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
+ WEBCORE_EXPORT const AtomicString& fixedFontFamily(UScriptCode = USCRIPT_COMMON) const;
+
+ WEBCORE_EXPORT void setSerifFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
+ WEBCORE_EXPORT const AtomicString& serifFontFamily(UScriptCode = USCRIPT_COMMON) const;
+
+ WEBCORE_EXPORT void setSansSerifFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
+ WEBCORE_EXPORT const AtomicString& sansSerifFontFamily(UScriptCode = USCRIPT_COMMON) const;
+
+ WEBCORE_EXPORT void setCursiveFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
+ WEBCORE_EXPORT const AtomicString& cursiveFontFamily(UScriptCode = USCRIPT_COMMON) const;
+
+ WEBCORE_EXPORT void setFantasyFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
+ WEBCORE_EXPORT const AtomicString& fantasyFontFamily(UScriptCode = USCRIPT_COMMON) const;
+
+ WEBCORE_EXPORT void setPictographFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
+ WEBCORE_EXPORT const AtomicString& pictographFontFamily(UScriptCode = USCRIPT_COMMON) const;
+
+ WEBCORE_EXPORT static bool defaultTextAutosizingEnabled();
+ WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
+
+ // Only set by Layout Tests.
+ WEBCORE_EXPORT void setMediaTypeOverride(const String&);
+ const String& mediaTypeOverride() const { return m_mediaTypeOverride; }
+
+ // Unlike areImagesEnabled, this only suppresses the network load of
+ // the image URL. A cached image will still be rendered if requested.
+ WEBCORE_EXPORT void setLoadsImagesAutomatically(bool);
+ bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; }
+
+ // Clients that execute script should call ScriptController::canExecuteScripts()
+ // instead of this function. ScriptController::canExecuteScripts() checks the
+ // HTML sandbox, plug-in sandboxing, and other important details.
+ bool isScriptEnabled() const { return m_isScriptEnabled; }
+ WEBCORE_EXPORT void setScriptEnabled(bool);
+
+
+ WEBCORE_EXPORT void setJavaEnabled(bool);
+ bool isJavaEnabled() const { return m_isJavaEnabled; }
+
+ // This settings is only consulted if isJavaEnabled() returns true;
+ WEBCORE_EXPORT void setJavaEnabledForLocalFiles(bool);
+ bool isJavaEnabledForLocalFiles() const { return m_isJavaEnabledForLocalFiles; }
+
+ WEBCORE_EXPORT void setImagesEnabled(bool);
+ bool areImagesEnabled() const { return m_areImagesEnabled; }
+
+ WEBCORE_EXPORT void setPreferMIMETypeForImages(bool);
+ bool preferMIMETypeForImages() const { return m_preferMIMETypeForImages; }
+
+ WEBCORE_EXPORT void setPluginsEnabled(bool);
+ bool arePluginsEnabled() const { return m_arePluginsEnabled; }
+
+ WEBCORE_EXPORT void setDNSPrefetchingEnabled(bool);
+ bool dnsPrefetchingEnabled() const { return m_dnsPrefetchingEnabled; }
+
+ WEBCORE_EXPORT void setUserStyleSheetLocation(const URL&);
+ const URL& userStyleSheetLocation() const { return m_userStyleSheetLocation; }
+
+ WEBCORE_EXPORT void setNeedsAdobeFrameReloadingQuirk(bool);
+ bool needsAcrobatFrameReloadingQuirk() const { return m_needsAdobeFrameReloadingQuirk; }
+
+ WEBCORE_EXPORT void setMinimumDOMTimerInterval(Seconds); // Initialized to DOMTimer::defaultMinimumInterval().
+ Seconds minimumDOMTimerInterval() const { return m_minimumDOMTimerInterval; }
+
+ WEBCORE_EXPORT void setLayoutInterval(Seconds);
+ Seconds layoutInterval() const { return m_layoutInterval; }
+
+ bool hiddenPageDOMTimerThrottlingEnabled() const { return m_hiddenPageDOMTimerThrottlingEnabled; }
+ WEBCORE_EXPORT void setHiddenPageDOMTimerThrottlingEnabled(bool);
+ bool hiddenPageDOMTimerThrottlingAutoIncreases() const { return m_hiddenPageDOMTimerThrottlingAutoIncreases; }
+ WEBCORE_EXPORT void setHiddenPageDOMTimerThrottlingAutoIncreases(bool);
+
+ WEBCORE_EXPORT void setUsesPageCache(bool);
+ bool usesPageCache() const { return m_usesPageCache; }
+
+ void setFontRenderingMode(FontRenderingMode mode);
+ FontRenderingMode fontRenderingMode() const;
+
+ WEBCORE_EXPORT void setShowTiledScrollingIndicator(bool);
+ bool showTiledScrollingIndicator() const { return m_showTiledScrollingIndicator; }
+
+#if ENABLE(RESOURCE_USAGE)
+ bool resourceUsageOverlayVisible() const { return m_resourceUsageOverlayVisible; }
+ WEBCORE_EXPORT void setResourceUsageOverlayVisible(bool);
+#endif
+
+#if PLATFORM(WIN)
+ static void setShouldUseHighResolutionTimers(bool);
+ static bool shouldUseHighResolutionTimers() { return gShouldUseHighResolutionTimers; }
+#endif
+
+ static bool isPostLoadCPUUsageMeasurementEnabled();
+ static bool isPostBackgroundingCPUUsageMeasurementEnabled();
+ static bool isPerActivityStateCPUUsageMeasurementEnabled();
+
+ static bool isPostLoadMemoryUsageMeasurementEnabled();
+ static bool isPostBackgroundingMemoryUsageMeasurementEnabled();
+
+ static bool globalConstRedeclarationShouldThrow();
+
+ WEBCORE_EXPORT void setBackgroundShouldExtendBeyondPage(bool);
+ bool backgroundShouldExtendBeyondPage() const { return m_backgroundShouldExtendBeyondPage; }
+
+#if USE(AVFOUNDATION)
+ WEBCORE_EXPORT static void setAVFoundationEnabled(bool flag);
+ static bool isAVFoundationEnabled() { return gAVFoundationEnabled; }
+ WEBCORE_EXPORT static void setAVFoundationNSURLSessionEnabled(bool flag);
+ static bool isAVFoundationNSURLSessionEnabled() { return gAVFoundationNSURLSessionEnabled; }
+#endif
+
+#if PLATFORM(COCOA)
+ WEBCORE_EXPORT static void setQTKitEnabled(bool flag);
+ static bool isQTKitEnabled() { return gQTKitEnabled; }
+#else
+ static bool isQTKitEnabled() { return false; }
+#endif
+
+#if USE(GSTREAMER)
+ WEBCORE_EXPORT static void setGStreamerEnabled(bool flag);
+ static bool isGStreamerEnabled() { return gGStreamerEnabled; }
+#endif
+
+ static const unsigned defaultMaximumHTMLParserDOMTreeDepth = 512;
+ static const unsigned defaultMaximumRenderTreeDepth = 512;
+
+ WEBCORE_EXPORT static void setMockScrollbarsEnabled(bool flag);
+ WEBCORE_EXPORT static bool mockScrollbarsEnabled();
+
+ WEBCORE_EXPORT static void setUsesOverlayScrollbars(bool flag);
+ static bool usesOverlayScrollbars();
+
+ WEBCORE_EXPORT static void setUsesMockScrollAnimator(bool);
+ static bool usesMockScrollAnimator();
+
+#if ENABLE(TOUCH_EVENTS)
+ void setTouchEventEmulationEnabled(bool enabled) { m_touchEventEmulationEnabled = enabled; }
+ bool isTouchEventEmulationEnabled() const { return m_touchEventEmulationEnabled; }
+#endif
+
+ WEBCORE_EXPORT void setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy);
+ SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy() const { return m_storageBlockingPolicy; }
+
+ WEBCORE_EXPORT void setScrollingPerformanceLoggingEnabled(bool);
+ bool scrollingPerformanceLoggingEnabled() { return m_scrollingPerformanceLoggingEnabled; }
+
+ WEBCORE_EXPORT static void setShouldRespectPriorityInCSSAttributeSetters(bool);
+ static bool shouldRespectPriorityInCSSAttributeSetters();
+
+ void setTimeWithoutMouseMovementBeforeHidingControls(Seconds time) { m_timeWithoutMouseMovementBeforeHidingControls = time; }
+ Seconds timeWithoutMouseMovementBeforeHidingControls() const { return m_timeWithoutMouseMovementBeforeHidingControls; }
+
+ bool hiddenPageCSSAnimationSuspensionEnabled() const { return m_hiddenPageCSSAnimationSuspensionEnabled; }
+ WEBCORE_EXPORT void setHiddenPageCSSAnimationSuspensionEnabled(bool);
+
+ WEBCORE_EXPORT void setFontFallbackPrefersPictographs(bool);
+ bool fontFallbackPrefersPictographs() const { return m_fontFallbackPrefersPictographs; }
+
+ static bool lowPowerVideoAudioBufferSizeEnabled() { return gLowPowerVideoAudioBufferSizeEnabled; }
+ WEBCORE_EXPORT static void setLowPowerVideoAudioBufferSizeEnabled(bool);
+
+ static bool resourceLoadStatisticsEnabled() { return gResourceLoadStatisticsEnabledEnabled; }
+ WEBCORE_EXPORT static void setResourceLoadStatisticsEnabled(bool);
+
+#if PLATFORM(IOS)
+ WEBCORE_EXPORT static void setAudioSessionCategoryOverride(unsigned);
+ static unsigned audioSessionCategoryOverride();
+
+ WEBCORE_EXPORT static void setNetworkDataUsageTrackingEnabled(bool);
+ static bool networkDataUsageTrackingEnabled();
+
+ WEBCORE_EXPORT static void setNetworkInterfaceName(const String&);
+ static const String& networkInterfaceName();
+
+#if HAVE(AVKIT)
+ static void setAVKitEnabled(bool flag) { gAVKitEnabled = flag; }
+#endif
+ static bool avKitEnabled() { return gAVKitEnabled; }
+
+ static void setShouldOptOutOfNetworkStateObservation(bool flag) { gShouldOptOutOfNetworkStateObservation = flag; }
+ static bool shouldOptOutOfNetworkStateObservation() { return gShouldOptOutOfNetworkStateObservation; }
+#endif
+
+#if USE(AUDIO_SESSION)
+ static void setShouldManageAudioSessionCategory(bool flag) { gManageAudioSession = flag; }
+ static bool shouldManageAudioSessionCategory() { return gManageAudioSession; }
+#endif
+
+ static void setCustomPasteboardDataEnabled(bool enabled) { gCustomPasteboardDataEnabled = enabled; }
+ static bool customPasteboardDataEnabled() { return gCustomPasteboardDataEnabled; }
+ WEBCORE_EXPORT static bool defaultCustomPasteboardDataEnabled();
+
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+ void setMediaKeysStorageDirectory(const String& directory) { m_mediaKeysStorageDirectory = directory; }
+ const String& mediaKeysStorageDirectory() const { return m_mediaKeysStorageDirectory; }
+#endif
+
+#if ENABLE(MEDIA_STREAM)
+ void setMediaDeviceIdentifierStorageDirectory(const String& directory) { m_mediaDeviceIdentifierStorageDirectory = directory; }
+ const String& mediaDeviceIdentifierStorageDirectory() const { return m_mediaDeviceIdentifierStorageDirectory; }
+
+ static bool mockCaptureDevicesEnabled();
+ WEBCORE_EXPORT static void setMockCaptureDevicesEnabled(bool);
+
+ bool mediaCaptureRequiresSecureConnection() const;
+ WEBCORE_EXPORT static void setMediaCaptureRequiresSecureConnection(bool);
+#endif
+
+#if ENABLE(APPLE_PAY)
+ bool applePayEnabled() const { return m_applePayEnabled; }
+ void setApplePayEnabled(bool applePayEnabled) { m_applePayEnabled = applePayEnabled; }
+
+ bool applePayCapabilityDisclosureAllowed() const { return m_applePayCapabilityDisclosureAllowed; }
+ void setApplePayCapabilityDisclosureAllowed(bool applePayCapabilityDisclosureAllowed) { m_applePayCapabilityDisclosureAllowed = applePayCapabilityDisclosureAllowed; }
+#endif
+
+ WEBCORE_EXPORT void setForcePendingWebGLPolicy(bool);
+ bool isForcePendingWebGLPolicy() const { return m_forcePendingWebGLPolicy; }
+
+ WEBCORE_EXPORT static void setAllowsAnySSLCertificate(bool);
+ static bool allowsAnySSLCertificate();
+
+ WEBCORE_EXPORT static const String& defaultMediaContentTypesRequiringHardwareSupport();
+ WEBCORE_EXPORT void setMediaContentTypesRequiringHardwareSupport(const Vector<ContentType>&);
+ WEBCORE_EXPORT void setMediaContentTypesRequiringHardwareSupport(const String&);
+ const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const { return m_mediaContentTypesRequiringHardwareSupport; }
+
+protected:
+ explicit SettingsBase(Page*);
+
+ void initializeDefaultFontFamilies();
+
+ Page* m_page;
+
+ String m_mediaTypeOverride { "screen" };
+ URL m_userStyleSheetLocation;
+ const std::unique_ptr<FontGenericFamilies> m_fontGenericFamilies;
+ SecurityOrigin::StorageBlockingPolicy m_storageBlockingPolicy { SecurityOrigin::AllowAllStorage };
+ Seconds m_layoutInterval;
+ Seconds m_minimumDOMTimerInterval;
+
+ bool m_isJavaEnabled : 1;
+ bool m_isJavaEnabledForLocalFiles : 1;
+ bool m_loadsImagesAutomatically : 1;
+ bool m_areImagesEnabled : 1;
+ bool m_preferMIMETypeForImages : 1;
+ bool m_arePluginsEnabled : 1;
+ bool m_isScriptEnabled : 1;
+ bool m_needsAdobeFrameReloadingQuirk : 1;
+ bool m_usesPageCache : 1;
+ unsigned m_fontRenderingMode : 1;
+ bool m_showTiledScrollingIndicator : 1;
+ bool m_backgroundShouldExtendBeyondPage : 1;
+ bool m_dnsPrefetchingEnabled : 1;
+
+#if ENABLE(TOUCH_EVENTS)
+ bool m_touchEventEmulationEnabled : 1;
+#endif
+ bool m_scrollingPerformanceLoggingEnabled : 1;
+
+ Seconds m_timeWithoutMouseMovementBeforeHidingControls { 3_s };
+
+ Timer m_setImageLoadingSettingsTimer;
+ void imageLoadingSettingsTimerFired();
+
+ bool m_hiddenPageDOMTimerThrottlingEnabled : 1;
+ bool m_hiddenPageCSSAnimationSuspensionEnabled : 1;
+ bool m_fontFallbackPrefersPictographs : 1;
+
+ bool m_forcePendingWebGLPolicy : 1;
+
+#if ENABLE(RESOURCE_USAGE)
+ bool m_resourceUsageOverlayVisible { false };
+#endif
+
+ bool m_hiddenPageDOMTimerThrottlingAutoIncreases { false };
+
+#if USE(AVFOUNDATION)
+ WEBCORE_EXPORT static bool gAVFoundationEnabled;
+ WEBCORE_EXPORT static bool gAVFoundationNSURLSessionEnabled;
+#endif
+
+#if PLATFORM(COCOA)
+ WEBCORE_EXPORT static bool gQTKitEnabled;
+#endif
+
+#if USE(GSTREAMER)
+ WEBCORE_EXPORT static bool gGStreamerEnabled;
+#endif
+
+ static bool gMockScrollbarsEnabled;
+ static bool gUsesOverlayScrollbars;
+ static bool gMockScrollAnimatorEnabled;
+
+#if PLATFORM(WIN)
+ static bool gShouldUseHighResolutionTimers;
+#endif
+ static bool gShouldRespectPriorityInCSSAttributeSetters;
+#if PLATFORM(IOS)
+ static bool gNetworkDataUsageTrackingEnabled;
+ WEBCORE_EXPORT static bool gAVKitEnabled;
+ WEBCORE_EXPORT static bool gShouldOptOutOfNetworkStateObservation;
+#endif
+ WEBCORE_EXPORT static bool gManageAudioSession;
+ WEBCORE_EXPORT static bool gCustomPasteboardDataEnabled;
+
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+ String m_mediaKeysStorageDirectory;
+#endif
+
+#if ENABLE(MEDIA_STREAM)
+ String m_mediaDeviceIdentifierStorageDirectory;
+ static bool gMockCaptureDevicesEnabled;
+ static bool gMediaCaptureRequiresSecureConnection;
+#endif
+
+#if ENABLE(APPLE_PAY)
+ bool m_applePayEnabled { false };
+ bool m_applePayCapabilityDisclosureAllowed { true };
+#endif
+
+ static bool gLowPowerVideoAudioBufferSizeEnabled;
+ static bool gResourceLoadStatisticsEnabledEnabled;
+ static bool gAllowsAnySSLCertificate;
+
+ Vector<ContentType> m_mediaContentTypesRequiringHardwareSupport;
+};
+
+inline bool SettingsBase::isPostLoadCPUUsageMeasurementEnabled()
+{
+#if PLATFORM(COCOA)
+ return true;
+#else
+ return false;
+#endif
+}
+
+inline bool SettingsBase::isPostBackgroundingCPUUsageMeasurementEnabled()
+{
+#if PLATFORM(MAC)
+ return true;
+#else
+ return false;
+#endif
+}
+
+inline bool SettingsBase::isPerActivityStateCPUUsageMeasurementEnabled()
+{
+#if PLATFORM(MAC)
+ return true;
+#else
+ return false;
+#endif
+}
+
+inline bool SettingsBase::isPostLoadMemoryUsageMeasurementEnabled()
+{
+#if PLATFORM(COCOA)
+ return true;
+#else
+ return false;
+#endif
+}
+
+inline bool SettingsBase::isPostBackgroundingMemoryUsageMeasurementEnabled()
+{
+#if PLATFORM(MAC)
+ return true;
+#else
+ return false;
+#endif
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm (from rev 223331, trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm) (0 => 223332)
--- trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm (rev 0)
+++ trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm 2017-10-16 02:59:07 UTC (rev 223332)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SettingsBase.h"
+
+#include <wtf/NeverDestroyed.h>
+
+#if PLATFORM(IOS)
+#include "Device.h"
+#include <pal/spi/ios/UIKitSPI.h>
+#include <wtf/SoftLinking.h>
+#endif
+
+#if PLATFORM(IOS)
+SOFT_LINK_FRAMEWORK(UIKit)
+SOFT_LINK_CLASS(UIKit, UIApplication)
+#endif
+
+namespace WebCore {
+
+static inline const char* sansSerifTraditionalHanFontFamily()
+{
+ return "PingFang TC";
+}
+
+static inline const char* sansSerifSimplifiedHanFontFamily()
+{
+ return "PingFang SC";
+}
+
+#if PLATFORM(MAC)
+
+static bool osakaMonoIsInstalled()
+{
+ int _one_ = 1;
+ RetainPtr<CFNumberRef> yes = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one));
+ CFTypeRef keys[] = { kCTFontEnabledAttribute, kCTFontNameAttribute };
+ CFTypeRef values[] = { yes.get(), CFSTR("Osaka-Mono") };
+ RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(values), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
+ RetainPtr<CFSetRef> mandatoryAttributes = adoptCF(CFSetCreate(kCFAllocatorDefault, keys, WTF_ARRAY_LENGTH(keys), &kCFTypeSetCallBacks));
+ return adoptCF(CTFontDescriptorCreateMatchingFontDescriptor(descriptor.get(), mandatoryAttributes.get()));
+}
+
+void SettingsBase::initializeDefaultFontFamilies()
+{
+ setStandardFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);
+ setSerifFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);
+ setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+ setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+ setCursiveFontFamily("Kaiti TC", USCRIPT_TRADITIONAL_HAN);
+
+ setStandardFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN);
+ setSerifFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN);
+ setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+ setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+ setCursiveFontFamily("Kaiti SC", USCRIPT_SIMPLIFIED_HAN);
+
+ setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+ setFixedFontFamily(osakaMonoIsInstalled() ? "Osaka-Mono" : "Hiragino Sans", USCRIPT_KATAKANA_OR_HIRAGANA);
+ setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+ setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+
+ setStandardFontFamily("AppleMyungjo", USCRIPT_HANGUL);
+ setSerifFontFamily("AppleMyungjo", USCRIPT_HANGUL);
+ setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
+ setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
+
+ setStandardFontFamily("Times", USCRIPT_COMMON);
+ setFixedFontFamily("Courier", USCRIPT_COMMON);
+ setSerifFontFamily("Times", USCRIPT_COMMON);
+ setSansSerifFontFamily("Helvetica", USCRIPT_COMMON);
+}
+
+#else
+
+void SettingsBase::initializeDefaultFontFamilies()
+{
+ // There is no serif Chinese font in default iOS installation.
+ setStandardFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+ setSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+ setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+ setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+
+ // There is no serif Chinese font in default iOS installation.
+ setStandardFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+ setSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+ setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+ setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+
+ setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+ setFixedFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+ setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+ setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+
+ // There is no serif Korean font in default iOS installation.
+ setStandardFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
+ setSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
+ setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
+ setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
+
+ setStandardFontFamily("Times", USCRIPT_COMMON);
+ setFixedFontFamily("Courier", USCRIPT_COMMON);
+ setSerifFontFamily("Times", USCRIPT_COMMON);
+ setSansSerifFontFamily("Helvetica", USCRIPT_COMMON);
+}
+
+bool SettingsBase::defaultTextAutosizingEnabled()
+{
+ return !deviceHasIPadCapability() || [[getUIApplicationClass() sharedApplication] _isClassic];
+}
+
+#endif
+
+const String& SettingsBase::defaultMediaContentTypesRequiringHardwareSupport()
+{
+ static NeverDestroyed<String> defaultMediaContentTypes { "video/mp4;codecs=hvc1:video/mp4;codecs=hev1" };
+ return defaultMediaContentTypes;
+}
+
+} // namespace WebCore
Deleted: trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm (223331 => 223332)
--- trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm 2017-10-16 01:55:16 UTC (rev 223331)
+++ trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm 2017-10-16 02:59:07 UTC (rev 223332)
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Settings.h"
-
-#include <wtf/NeverDestroyed.h>
-
-#if PLATFORM(IOS)
-#include "Device.h"
-#include <pal/spi/ios/UIKitSPI.h>
-#include <wtf/SoftLinking.h>
-#endif
-
-#if PLATFORM(IOS)
-SOFT_LINK_FRAMEWORK(UIKit)
-SOFT_LINK_CLASS(UIKit, UIApplication)
-#endif
-
-namespace WebCore {
-
-static inline const char* sansSerifTraditionalHanFontFamily()
-{
- return "PingFang TC";
-}
-
-static inline const char* sansSerifSimplifiedHanFontFamily()
-{
- return "PingFang SC";
-}
-
-#if PLATFORM(MAC)
-
-static bool osakaMonoIsInstalled()
-{
- int _one_ = 1;
- RetainPtr<CFNumberRef> yes = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one));
- CFTypeRef keys[] = { kCTFontEnabledAttribute, kCTFontNameAttribute };
- CFTypeRef values[] = { yes.get(), CFSTR("Osaka-Mono") };
- RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(values), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
- RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
- RetainPtr<CFSetRef> mandatoryAttributes = adoptCF(CFSetCreate(kCFAllocatorDefault, keys, WTF_ARRAY_LENGTH(keys), &kCFTypeSetCallBacks));
- return adoptCF(CTFontDescriptorCreateMatchingFontDescriptor(descriptor.get(), mandatoryAttributes.get()));
-}
-
-void Settings::initializeDefaultFontFamilies()
-{
- setStandardFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);
- setSerifFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);
- setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
- setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
- setCursiveFontFamily("Kaiti TC", USCRIPT_TRADITIONAL_HAN);
-
- setStandardFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN);
- setSerifFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN);
- setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
- setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
- setCursiveFontFamily("Kaiti SC", USCRIPT_SIMPLIFIED_HAN);
-
- setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
- setFixedFontFamily(osakaMonoIsInstalled() ? "Osaka-Mono" : "Hiragino Sans", USCRIPT_KATAKANA_OR_HIRAGANA);
- setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
- setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
-
- setStandardFontFamily("AppleMyungjo", USCRIPT_HANGUL);
- setSerifFontFamily("AppleMyungjo", USCRIPT_HANGUL);
- setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
- setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
-
- setStandardFontFamily("Times", USCRIPT_COMMON);
- setFixedFontFamily("Courier", USCRIPT_COMMON);
- setSerifFontFamily("Times", USCRIPT_COMMON);
- setSansSerifFontFamily("Helvetica", USCRIPT_COMMON);
-}
-
-#else
-
-void Settings::initializeDefaultFontFamilies()
-{
- // There is no serif Chinese font in default iOS installation.
- setStandardFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
- setSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
- setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
- setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
-
- // There is no serif Chinese font in default iOS installation.
- setStandardFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
- setSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
- setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
- setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
-
- setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
- setFixedFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
- setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
- setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
-
- // There is no serif Korean font in default iOS installation.
- setStandardFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
- setSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
- setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
- setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
-
- setStandardFontFamily("Times", USCRIPT_COMMON);
- setFixedFontFamily("Courier", USCRIPT_COMMON);
- setSerifFontFamily("Times", USCRIPT_COMMON);
- setSansSerifFontFamily("Helvetica", USCRIPT_COMMON);
-}
-
-bool Settings::defaultTextAutosizingEnabled()
-{
- return !deviceHasIPadCapability() || [[getUIApplicationClass() sharedApplication] _isClassic];
-}
-
-#endif
-
-const String& Settings::defaultMediaContentTypesRequiringHardwareSupport()
-{
- static NeverDestroyed<String> defaultMediaContentTypes { "video/mp4;codecs=hvc1:video/mp4;codecs=hev1" };
- return defaultMediaContentTypes;
-}
-
-} // namespace WebCore