Skip to content
Permalink
Browse files
[Settings] Remove all custom code from Settings.h/cpp
https://bugs.webkit.org/show_bug.cgi?id=178330

Reviewed by Simon Fraser.

Source/WebCore:

Removes the two remaining functions out of Settings paving the way
for the file to be generated.

- pageDestroyed was moved down into SettingsBase.
- effectiveFrameFlattening was moved to FrameView (to reduce the need
  for additional includes, the FrameFlattening enum was converted to
  an enum class to allow it to be forward declared).

Also moves default values into SettingsDefaultValues.h

* WebCore.xcodeproj/project.pbxproj:

    Add new files.

* page/FrameView.cpp:
* page/FrameView.h:

    Move effectiveFrameFlattening function here from Settings.

* page/Settings.cpp:
* page/Settings.h:

    Move effectiveFrameFlattening, pageDestroyed and default values out.

* page/Settings.in:

    Update for turning FrameFlattening into an enum class.

* page/SettingsBase.h:

    Turn FrameFlattening into an enum class and move pageDestroyed here.

* page/SettingsDefaultValues.h: Added.

    Move all the default values from Settings here.

* rendering/RenderFrameSet.cpp:
* rendering/RenderIFrame.cpp:
* rendering/RenderView.cpp:

    Get effectiveFrameFlattening from the FrameView.

* testing/InternalSettings.cpp:
* testing/InternalSettings.h:

    Update now that FrameFlattening is an enum class.

Source/WebKit:

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetFrameFlatteningEnabled):
(WKPreferencesGetFrameFlatteningEnabled):
* UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_get_enable_frame_flattening):
(webkit_settings_set_enable_frame_flattening):
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setFrameFlatteningEnabled):

    Update for naming changes of FrameFlattening now that it is an enum class.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::contentsSizeChanged const):

    Ge the effectiveFrameFlattening from the FrameView, rather than the Settings.

Source/WebKitLegacy/mac:

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):

    Update for naming changes of FrameFlattening now that it is an enum class.

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::notifyPreferencesChanged):

    Update for naming changes of FrameFlattening now that it is an enum class.


Canonical link: https://commits.webkit.org/194576@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Oct 16, 2017
1 parent af7926f commit f7675109890c778c612d4c3d4653dc6d04a07f09
@@ -1,3 +1,57 @@
2017-10-16 Sam Weinig <sam@webkit.org>

[Settings] Remove all custom code from Settings.h/cpp
https://bugs.webkit.org/show_bug.cgi?id=178330

Reviewed by Simon Fraser.

Removes the two remaining functions out of Settings paving the way
for the file to be generated.

- pageDestroyed was moved down into SettingsBase.
- effectiveFrameFlattening was moved to FrameView (to reduce the need
for additional includes, the FrameFlattening enum was converted to
an enum class to allow it to be forward declared).

Also moves default values into SettingsDefaultValues.h

* WebCore.xcodeproj/project.pbxproj:

Add new files.

* page/FrameView.cpp:
* page/FrameView.h:

Move effectiveFrameFlattening function here from Settings.

* page/Settings.cpp:
* page/Settings.h:

Move effectiveFrameFlattening, pageDestroyed and default values out.

* page/Settings.in:

Update for turning FrameFlattening into an enum class.

* page/SettingsBase.h:

Turn FrameFlattening into an enum class and move pageDestroyed here.

* page/SettingsDefaultValues.h: Added.

Move all the default values from Settings here.

* rendering/RenderFrameSet.cpp:
* rendering/RenderIFrame.cpp:
* rendering/RenderView.cpp:

Get effectiveFrameFlattening from the FrameView.

* testing/InternalSettings.cpp:
* testing/InternalSettings.h:

Update now that FrameFlattening is an enum class.

2017-10-16 Maureen Daum <mdaum@apple.com>

If we fail to delete any database file, don't remove its information from the tracker database
@@ -11504,6 +11504,7 @@
7C6579ED1E00856600E3A27A /* JSApplePayShippingMethod.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSApplePayShippingMethod.cpp; sourceTree = "<group>"; };
7C6579EE1E00856600E3A27A /* JSApplePayShippingMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSApplePayShippingMethod.h; sourceTree = "<group>"; };
7C6752BA1B06E82000C279CB /* NonElementParentNode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NonElementParentNode.idl; sourceTree = "<group>"; };
7C6EFEEA1F946A2E00FFAD41 /* SettingsDefaultValues.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SettingsDefaultValues.h; sourceTree = "<group>"; };
7C73FB05191EF416007DE061 /* UserMessageHandlersNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandlersNamespace.cpp; sourceTree = "<group>"; };
7C73FB06191EF417007DE061 /* UserMessageHandlersNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandlersNamespace.h; sourceTree = "<group>"; };
7C73FB09191EF49F007DE061 /* UserMessageHandlersNamespace.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = UserMessageHandlersNamespace.idl; sourceTree = "<group>"; };
@@ -19920,6 +19921,7 @@
BC59DEF8169DEDC30016AC34 /* Settings.in */,
7CC6609B1F93057900D500E9 /* SettingsBase.cpp */,
7CC660991F93057800D500E9 /* SettingsBase.h */,
7C6EFEEA1F946A2E00FFAD41 /* SettingsDefaultValues.h */,
5C688AA21D38126F000B54FA /* SocketProvider.cpp */,
5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */,
626CDE0C1140424C001E5A68 /* SpatialNavigation.cpp */,
@@ -566,9 +566,21 @@ void FrameView::setMarginHeight(LayoutUnit h)
m_margins.setHeight(h);
}

FrameFlattening FrameView::effectiveFrameFlattening() const
{
#if PLATFORM(IOS)
// On iOS when async frame scrolling is enabled, it does not make sense to use full frame flattening.
// In that case, we just consider that frame flattening is disabled. This allows people to test
// frame scrolling on iOS by enabling "Async Frame Scrolling" via the Safari menu.
if (frame().settings().asyncFrameScrollingEnabled() && frame().settings().frameFlattening() == FrameFlattening::FullyEnabled)
return FrameFlattening::Disabled;
#endif
return frame().settings().frameFlattening();
}

bool FrameView::frameFlatteningEnabled() const
{
return frame().settings().effectiveFrameFlattening() != FrameFlatteningDisabled;
return effectiveFrameFlattening() != FrameFlattening::Disabled;
}

bool FrameView::isFrameFlatteningValidForThisFrame() const
@@ -61,6 +61,8 @@ class RenderStyle;
class RenderView;
class RenderWidget;

enum class FrameFlattening;

Pagination::Mode paginationModeForRenderStyle(const RenderStyle&);

class FrameView final : public ScrollView {
@@ -635,6 +637,8 @@ class FrameView final : public ScrollView {

void setSpeculativeTilingDelayDisabledForTesting(bool disabled) { m_speculativeTilingDelayDisabledForTesting = disabled; }

WEBCORE_EXPORT FrameFlattening effectiveFrameFlattening() const;

protected:
bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) final;
void scrollContentsSlowPath(const IntRect& updateRect) final;
@@ -26,97 +26,11 @@
#include "config.h"
#include "Settings.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 "StorageMap.h"
#include <limits>
#include <wtf/NeverDestroyed.h>
#include <wtf/StdLibExtras.h>
#include "SettingsDefaultValues.h"

namespace WebCore {

// NOTEs
// 1) EditingMacBehavior comprises Tiger, Leopard, SnowLeopard and iOS builds, as well as QtWebKit when built on Mac;
// 2) EditingWindowsBehavior comprises Win32 build;
// 3) EditingUnixBehavior comprises all unix-based systems, but Darwin/MacOS (and then abusing the terminology);
// 99) MacEditingBehavior is used as a fallback.
static EditingBehaviorType editingBehaviorTypeForPlatform()
{
return
#if PLATFORM(IOS)
EditingIOSBehavior
#elif OS(DARWIN)
EditingMacBehavior
#elif OS(WINDOWS)
EditingWindowsBehavior
#elif OS(UNIX)
EditingUnixBehavior
#else
// Fallback
EditingMacBehavior
#endif
;
}

#if PLATFORM(COCOA)
static const bool defaultYouTubeFlashPluginReplacementEnabled = true;
#else
static const bool defaultYouTubeFlashPluginReplacementEnabled = false;
#endif

#if PLATFORM(IOS)
static const bool defaultFixedBackgroundsPaintRelativeToDocument = true;
static const bool defaultAcceleratedCompositingForFixedPositionEnabled = true;
static const bool defaultAllowsInlineMediaPlayback = false;
static const bool defaultInlineMediaPlaybackRequiresPlaysInlineAttribute = true;
static const bool defaultVideoPlaybackRequiresUserGesture = true;
static const bool defaultAudioPlaybackRequiresUserGesture = true;
static const bool defaultMediaDataLoadsAutomatically = false;
static const bool defaultShouldRespectImageOrientation = true;
static const bool defaultImageSubsamplingEnabled = true;
static const bool defaultScrollingTreeIncludesFrames = true;
static const bool defaultMediaControlsScaleWithPageZoom = true;
static const bool defaultQuickTimePluginReplacementEnabled = true;
#else
static const bool defaultFixedBackgroundsPaintRelativeToDocument = false;
static const bool defaultAcceleratedCompositingForFixedPositionEnabled = false;
static const bool defaultAllowsInlineMediaPlayback = true;
static const bool defaultInlineMediaPlaybackRequiresPlaysInlineAttribute = false;
static const bool defaultVideoPlaybackRequiresUserGesture = false;
static const bool defaultAudioPlaybackRequiresUserGesture = false;
static const bool defaultMediaDataLoadsAutomatically = true;
static const bool defaultShouldRespectImageOrientation = false;
static const bool defaultImageSubsamplingEnabled = false;
static const bool defaultScrollingTreeIncludesFrames = false;
static const bool defaultMediaControlsScaleWithPageZoom = true;
static const bool defaultQuickTimePluginReplacementEnabled = false;
#endif

static const bool defaultRequiresUserGestureToLoadVideo = true;
static const bool defaultAllowsPictureInPictureMediaPlayback = true;

static const double defaultIncrementalRenderingSuppressionTimeoutInSeconds = 5;
#if USE(UNIFIED_TEXT_CHECKING)
static const bool defaultUnifiedTextCheckerEnabled = true;
#else
static const bool defaultUnifiedTextCheckerEnabled = false;
#endif
static const bool defaultSmartInsertDeleteEnabled = true;
static const bool defaultSelectTrailingWhitespaceEnabled = false;

Ref<Settings> Settings::create(Page* page)
{
return adoptRef(*new Settings(page));
@@ -134,16 +48,4 @@ Settings::~Settings()

SETTINGS_SETTER_BODIES

FrameFlattening Settings::effectiveFrameFlattening()
{
#if PLATFORM(IOS)
// On iOS when async frame scrolling is enabled, it does not make sense to use full frame flattening.
// In that case, we just consider that frame flattening is disabled. This allows people to test
// frame scrolling on iOS by enabling "Async Frame Scrolling" via the Safari menu.
if (asyncFrameScrollingEnabled() && frameFlattening() == FrameFlatteningFullyEnabled)
return FrameFlatteningDisabled;
#endif
return frameFlattening();
}

} // namespace WebCore
@@ -27,6 +27,8 @@
#pragma once

#include "SettingsBase.h"
#include "SettingsMacros.h"
#include <wtf/RefCounted.h>

namespace WebCore {

@@ -36,18 +38,12 @@ class Settings : public SettingsBase, public RefCounted<Settings> {
static Ref<Settings> create(Page*);
~Settings();

void pageDestroyed() { m_page = nullptr; }

SETTINGS_GETTERS_AND_SETTERS


WEBCORE_EXPORT FrameFlattening effectiveFrameFlattening();

private:
explicit Settings(Page*);

SETTINGS_MEMBER_VARIABLES

};

} // namespace WebCore
@@ -175,7 +175,7 @@ snapshotAllPlugIns initial=false
autostartOriginPlugInSnapshottingEnabled initial=true
primaryPlugInSnapshotDetectionEnabled initial=true
maximumPlugInSnapshotAttempts type=unsigned, initial=20
frameFlattening type=FrameFlattening, initial=FrameFlatteningDisabled
frameFlattening type=FrameFlattening, initial=FrameFlattening::Disabled
asyncFrameScrollingEnabled initial=false

webSecurityEnabled initial=true
@@ -31,7 +31,7 @@
#include "EditingBehaviorTypes.h"
#include "IntSize.h"
#include "SecurityOrigin.h"
#include "SettingsMacros.h"
#include "StorageMap.h"
#include "TextFlags.h"
#include "Timer.h"
#include "URL.h"
@@ -88,10 +88,10 @@ enum PDFImageCachingPolicy {
#endif
};

enum FrameFlattening {
FrameFlatteningDisabled,
FrameFlatteningEnabledForNonFullScreenIFrames,
FrameFlatteningFullyEnabled
enum class FrameFlattening {
Disabled,
EnabledForNonFullScreenIFrames,
FullyEnabled
};

typedef unsigned DebugOverlayRegions;
@@ -101,6 +101,8 @@ class SettingsBase {
public:
~SettingsBase();

void pageDestroyed() { m_page = nullptr; }

enum class FontLoadTimingOverride { None, Block, Swap, Failure };

enum class ForcedAccessibilityValue { System, On, Off };

0 comments on commit f767510

Please sign in to comment.