[Settings] Remove all custom code from Settings.h/cpp
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Oct 2017 20:33:32 +0000 (20:33 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Oct 2017 20:33:32 +0000 (20:33 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223432 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/page/Settings.in
Source/WebCore/page/SettingsBase.h
Source/WebCore/page/SettingsDefaultValues.h [new file with mode: 0644]
Source/WebCore/rendering/RenderFrameSet.cpp
Source/WebCore/rendering/RenderIFrame.cpp
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferencesDefinitions.h
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp
Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebView.cpp

index 2c951ed..bb67f97 100644 (file)
@@ -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
index e60d141..95352f9 100644 (file)
                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>"; };
                                BC59DEF8169DEDC30016AC34 /* Settings.in */,
                                7CC6609B1F93057900D500E9 /* SettingsBase.cpp */,
                                7CC660991F93057800D500E9 /* SettingsBase.h */,
+                               7C6EFEEA1F946A2E00FFAD41 /* SettingsDefaultValues.h */,
                                5C688AA21D38126F000B54FA /* SocketProvider.cpp */,
                                5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */,
                                626CDE0C1140424C001E5A68 /* SpatialNavigation.cpp */,
index 1757c16..3b5529a 100644 (file)
@@ -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
index f0c5ba6..b40d2b2 100644 (file)
@@ -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 @@ public:
 
     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;
index 1c7ba4e..62ad5dd 100644 (file)
 #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
index 4b8099c..bec1a88 100644 (file)
@@ -27,6 +27,8 @@
 #pragma once
 
 #include "SettingsBase.h"
+#include "SettingsMacros.h"
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
@@ -36,18 +38,12 @@ public:
     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
index edc5504..047efc2 100644 (file)
@@ -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
index 3af20e0..18694bb 100644 (file)
@@ -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 };
diff --git a/Source/WebCore/page/SettingsDefaultValues.h b/Source/WebCore/page/SettingsDefaultValues.h
new file mode 100644 (file)
index 0000000..066ae87
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+#include "EditingBehaviorTypes.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.
+inline EditingBehaviorType editingBehaviorTypeForPlatform()
+{
+#if PLATFORM(IOS)
+    return EditingIOSBehavior;
+#elif OS(DARWIN)
+    return EditingMacBehavior;
+#elif OS(WINDOWS)
+    return EditingWindowsBehavior;
+#elif OS(UNIX)
+    return EditingUnixBehavior;
+#else
+    // Fallback
+    return 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;
+
+}
index 3ec12eb..41c8711 100644 (file)
@@ -651,7 +651,7 @@ void RenderFrameSet::positionFramesWithFlattening()
 
 bool RenderFrameSet::flattenFrameSet() const
 {
-    return settings().effectiveFrameFlattening() != FrameFlatteningDisabled;
+    return view().frameView().effectiveFrameFlattening() != FrameFlattening::Disabled;
 }
 
 void RenderFrameSet::startResizing(GridAxis& axis, int position)
index 76bb567..b8bb907 100644 (file)
@@ -78,7 +78,7 @@ bool RenderIFrame::isFullScreenIFrame() const
 
 bool RenderIFrame::flattenFrame() const
 {
-    if (settings().effectiveFrameFlattening() == FrameFlatteningDisabled)
+    if (view().frameView().effectiveFrameFlattening() == FrameFlattening::Disabled)
         return false;
 
     if (style().width().isFixed() && style().height().isFixed()) {
@@ -89,7 +89,7 @@ bool RenderIFrame::flattenFrame() const
         if (style().width().value() <= 0 || style().height().value() <= 0)
             return false;
         // Do not flatten "fullscreen" iframes or they could become larger than the viewport.
-        if (settings().effectiveFrameFlattening() <= FrameFlatteningEnabledForNonFullScreenIFrames && isFullScreenIFrame())
+        if (view().frameView().effectiveFrameFlattening() <= FrameFlattening::EnabledForNonFullScreenIFrames && isFullScreenIFrame())
             return false;
     }
 
index ce346b8..3c3d9c7 100644 (file)
@@ -59,7 +59,7 @@ namespace WebCore {
 struct FrameFlatteningLayoutDisallower {
     FrameFlatteningLayoutDisallower(FrameView& frameView)
         : m_frameView(frameView)
-        , m_disallowLayout(frameView.frame().settings().effectiveFrameFlattening() != FrameFlatteningDisabled)
+        , m_disallowLayout(frameView.effectiveFrameFlattening() != FrameFlattening::Disabled)
     {
         if (m_disallowLayout)
             m_frameView.startDisallowingLayout();
index 1468e20..2f7a432 100644 (file)
@@ -819,26 +819,11 @@ ExceptionOr<void> InternalSettings::setSystemLayoutDirection(const String& direc
     return Exception { InvalidAccessError };
 }
 
-static FrameFlattening internalSettingsToWebCoreValue(InternalSettings::FrameFlatteningValue value)
-{
-    switch (value) {
-    case InternalSettings::FrameFlatteningValue::Disabled:
-        return FrameFlatteningDisabled;
-    case InternalSettings::FrameFlatteningValue::EnabledForNonFullScreenIFrames:
-        return FrameFlatteningEnabledForNonFullScreenIFrames;
-    case InternalSettings::FrameFlatteningValue::FullyEnabled:
-        return FrameFlatteningFullyEnabled;
-    }
-
-    ASSERT_NOT_REACHED();
-    return FrameFlatteningDisabled;
-}
-
-ExceptionOr<void> InternalSettings::setFrameFlattening(const FrameFlatteningValue& frameFlattening)
+ExceptionOr<void> InternalSettings::setFrameFlattening(FrameFlatteningValue frameFlattening)
 {
     if (!m_page)
         return Exception { InvalidAccessError };
-    settings().setFrameFlattening(internalSettingsToWebCoreValue(frameFlattening));
+    settings().setFrameFlattening(frameFlattening);
     return { };
 }
 
index 8b491b7..ab6412b 100644 (file)
@@ -101,8 +101,8 @@ public:
     ExceptionOr<void> setShouldManageAudioSessionCategory(bool);
     ExceptionOr<void> setCustomPasteboardDataEnabled(bool);
 
-    enum class FrameFlatteningValue { Disabled, EnabledForNonFullScreenIFrames, FullyEnabled };
-    ExceptionOr<void> setFrameFlattening(const FrameFlatteningValue&);
+    using FrameFlatteningValue = FrameFlattening;
+    ExceptionOr<void> setFrameFlattening(FrameFlatteningValue);
     
     static void setAllowsAnySSLCertificate(bool);
 
index 6b91e19..538cd2b 100644 (file)
@@ -1,3 +1,27 @@
+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.
+
+        * 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.
+
 2017-10-16  Chris Dumez  <cdumez@apple.com>
 
         [WK2][NetworkSession] Add support for resuming downloads
index 7e598a5..793daf0 100644 (file)
@@ -60,7 +60,7 @@
 #if PLATFORM(IOS)
 #define DEFAULT_ALLOWS_PICTURE_IN_PICTURE_MEDIA_PLAYBACK true
 #define DEFAULT_BACKSPACE_KEY_NAVIGATION_ENABLED false
-#define DEFAULT_FRAME_FLATTENING FrameFlatteningFullyEnabled
+#define DEFAULT_FRAME_FLATTENING FrameFlattening::FullyEnabled
 #define DEFAULT_SHOULD_PRINT_BACKGROUNDS true
 #define DEFAULT_TEXT_AREAS_ARE_RESIZABLE false
 #define DEFAULT_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY false
@@ -78,7 +78,7 @@
 #else
 #define DEFAULT_ALLOWS_PICTURE_IN_PICTURE_MEDIA_PLAYBACK false
 #define DEFAULT_BACKSPACE_KEY_NAVIGATION_ENABLED true
-#define DEFAULT_FRAME_FLATTENING FrameFlatteningDisabled
+#define DEFAULT_FRAME_FLATTENING FrameFlattening::Disabled
 #define DEFAULT_SHOULD_PRINT_BACKGROUNDS false
 #define DEFAULT_TEXT_AREAS_ARE_RESIZABLE true
 #define DEFAULT_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY true
index afc8df5..b6516f7 100644 (file)
@@ -145,13 +145,13 @@ bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef preferencesRef)
 void WKPreferencesSetFrameFlatteningEnabled(WKPreferencesRef preferencesRef, bool frameFlatteningEnabled)
 {
     // FIXME: Expose more frame flattening values.
-    toImpl(preferencesRef)->setFrameFlattening(frameFlatteningEnabled ? WebCore::FrameFlatteningFullyEnabled : WebCore::FrameFlatteningDisabled);
+    toImpl(preferencesRef)->setFrameFlattening(frameFlatteningEnabled ? static_cast<uint32_t>(WebCore::FrameFlattening::FullyEnabled) : static_cast<uint32_t>(WebCore::FrameFlattening::Disabled));
 }
 
 bool WKPreferencesGetFrameFlatteningEnabled(WKPreferencesRef preferencesRef)
 {
     // FIXME: Expose more frame flattening values.
-    return toImpl(preferencesRef)->frameFlattening() != WebCore::FrameFlatteningDisabled;
+    return toImpl(preferencesRef)->frameFlattening() != static_cast<uint32_t>(WebCore::FrameFlattening::Disabled);
 }
 
 void WKPreferencesSetPluginsEnabled(WKPreferencesRef preferencesRef, bool pluginsEnabled)
index 3ab45ab..947eb42 100644 (file)
@@ -1620,7 +1620,7 @@ gboolean webkit_settings_get_enable_frame_flattening(WebKitSettings* settings)
     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
 
     // FIXME: Expose more frame flattening values.
-    return settings->priv->preferences->frameFlattening() != WebCore::FrameFlatteningDisabled;
+    return settings->priv->preferences->frameFlattening() != static_cast<uint32_t>(WebCore::FrameFlattening::Disabled);
 }
 
 /**
@@ -1635,12 +1635,12 @@ void webkit_settings_set_enable_frame_flattening(WebKitSettings* settings, gbool
     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
 
     WebKitSettingsPrivate* priv = settings->priv;
-    bool currentValue = priv->preferences->frameFlattening() != WebCore::FrameFlatteningDisabled;
+    bool currentValue = priv->preferences->frameFlattening() != static_cast<uint32_t>(WebCore::FrameFlattening::Disabled);
     if (currentValue == enabled)
         return;
 
     // FIXME: Expose more frame flattening values.
-    priv->preferences->setFrameFlattening(enabled ? WebCore::FrameFlatteningFullyEnabled : WebCore::FrameFlatteningDisabled);
+    priv->preferences->setFrameFlattening(enabled ? static_cast<uint32_t>(WebCore::FrameFlattening::FullyEnabled) : static_cast<uint32_t>(WebCore::FrameFlattening::Disabled));
     g_object_notify(G_OBJECT(settings), "enable-frame-flattening");
 }
 
index 93dae41..345179d 100644 (file)
@@ -300,7 +300,7 @@ void InjectedBundle::setFrameFlatteningEnabled(WebPageGroupProxy* pageGroup, boo
 {
     const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
     for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
-        (*iter)->settings().setFrameFlattening(enabled ? FrameFlatteningFullyEnabled : FrameFlatteningDisabled);
+        (*iter)->settings().setFrameFlattening(enabled ? FrameFlattening::FullyEnabled : FrameFlattening::Disabled);
 }
 
 void InjectedBundle::setAsyncFrameScrollingEnabled(WebPageGroupProxy* pageGroup, bool enabled)
index aba932d..2daa819 100644 (file)
@@ -566,7 +566,9 @@ PlatformPageClient WebChromeClient::platformPageClient() const
 
 void WebChromeClient::contentsSizeChanged(Frame& frame, const IntSize& size) const
 {
-    if (m_page.corePage()->settings().effectiveFrameFlattening() == FrameFlatteningDisabled) {
+    FrameView* frameView = frame.view();
+
+    if (frameView && frameView->effectiveFrameFlattening() == FrameFlattening::Disabled) {
         WebFrame* largestFrame = findLargestFrameInFrameSet(m_page);
         if (largestFrame != m_cachedFrameSetLargestFrame.get()) {
             m_cachedFrameSetLargestFrame = largestFrame;
@@ -581,7 +583,6 @@ void WebChromeClient::contentsSizeChanged(Frame& frame, const IntSize& size) con
 
     m_page.drawingArea()->mainFrameContentSizeChanged(size);
 
-    FrameView* frameView = frame.view();
     if (frameView && !frameView->delegatesScrolling())  {
         bool hasHorizontalScrollbar = frameView->horizontalScrollbar();
         bool hasVerticalScrollbar = frameView->verticalScrollbar();
index 0d244d4..014bcfb 100644 (file)
@@ -1,3 +1,15 @@
+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.
+
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        
+            Update for naming changes of FrameFlattening now that it is an enum class.
+
 2017-10-13  Alex Christensen  <achristensen@webkit.org>
 
         Remove Editor::simplifyMarkup
index a78df6e..903b7c2 100644 (file)
@@ -517,9 +517,9 @@ public:
         [NSNumber numberWithBool:YES],  WebKitLargeImageAsyncDecodingEnabledPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey,
 #if PLATFORM(IOS)
-        [NSNumber numberWithUnsignedInt:FrameFlatteningFullyEnabled], WebKitFrameFlatteningPreferenceKey,
+        [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::FullyEnabled)], WebKitFrameFlatteningPreferenceKey,
 #else
-        [NSNumber numberWithUnsignedInt:FrameFlatteningDisabled], WebKitFrameFlatteningPreferenceKey,
+        [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::Disabled)], WebKitFrameFlatteningPreferenceKey,
 #endif
         [NSNumber numberWithBool:NO], WebKitAsyncFrameScrollingEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitSpatialNavigationEnabledPreferenceKey,
index 7f2f6bc..0387e1b 100644 (file)
@@ -1,3 +1,15 @@
+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.
+
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+            
+            Update for naming changes of FrameFlattening now that it is an enum class.
+
 2017-10-11  Chris Dumez  <cdumez@apple.com>
 
         Modernize Geolocation code
index 761eae0..23b80d6 100644 (file)
@@ -5421,7 +5421,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
     hr = prefsPrivate->isFrameFlatteningEnabled(&enabled);
     if (FAILED(hr))
         return hr;
-    settings.setFrameFlattening(enabled ? FrameFlatteningFullyEnabled : FrameFlatteningDisabled);
+    settings.setFrameFlattening(enabled ? FrameFlattening::FullyEnabled : FrameFlattening::Disabled);
 
     hr = prefsPrivate->acceleratedCompositingEnabled(&enabled);
     if (FAILED(hr))