Add separate settings and preferences to enable/disable async decoding for large...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Nov 2016 23:48:00 +0000 (23:48 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Nov 2016 23:48:00 +0000 (23:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165177

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-11-30
Reviewed by Simon Fraser.
Source/WebCore:

Instead of having the async image decoding be controlled by one setting,
two separate settings are added:
    largeImageAsyncDecodingEnabled
    animatedImageAsyncDecodingEnabled

And an existing setting is removed:
    asyncImageDecodingEnabled

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::load):
* loader/cache/CachedImage.h:
* page/Settings.in:
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::internalStartAnimation):
* platform/graphics/BitmapImage.h:
* platform/graphics/ImageObserver.h:

Source/WebKit/mac:

Hook up the async image decoding settings for WebKit1.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences largeImageAsyncDecodingEnabled]):
(-[WebPreferences setLargeImageAsyncDecodingEnabled:]):
(-[WebPreferences animatedImageAsyncDecodingEnabled]):
(-[WebPreferences setAnimatedImageAsyncDecodingEnabled:]):
(-[WebPreferences asyncImageDecodingEnabled]): Deleted.
(-[WebPreferences setAsyncImageDecodingEnabled:]): Deleted.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Hook up the async image decoding settings for WebKit2.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _largeImageAsyncDecodingEnabled]):
(-[WKPreferences _setLargeImageAsyncDecodingEnabled:]):
(-[WKPreferences _animatedImageAsyncDecodingEnabled]):
(-[WKPreferences _setAnimatedImageAsyncDecodingEnabled:]):
(-[WKPreferences _asyncImageDecodingEnabled]): Deleted.
(-[WKPreferences _setAsyncImageDecodingEnabled:]): Deleted.
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Pref and a menu item to toggle async image decoding settings for WebKits 1 and 2.

* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController validateMenuItem:]):
(-[SettingsController toggleLargeImageAsyncDecodingEnabled:]):
(-[SettingsController largeImageAsyncDecodingEnabled]):
(-[SettingsController toggleAnimatedImageAsyncDecodingEnabled:]):
(-[SettingsController animatedImageAsyncDecodingEnabled]):
(-[SettingsController toggleAsyncImageDecodingEnabled:]): Deleted.
(-[SettingsController asyncImageDecodingEnabled]): Deleted.
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController didChangeSettings]):
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController didChangeSettings]):

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

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/loader/cache/CachedImage.h
Source/WebCore/page/Settings.in
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/graphics/ImageObserver.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/MiniBrowser/mac/SettingsController.h
Tools/MiniBrowser/mac/SettingsController.m
Tools/MiniBrowser/mac/WK1BrowserWindowController.m
Tools/MiniBrowser/mac/WK2BrowserWindowController.m

index c7ac423..22a33e6 100644 (file)
@@ -1,3 +1,27 @@
+2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Add separate settings and preferences to enable/disable async decoding for large images and animated images
+        https://bugs.webkit.org/show_bug.cgi?id=165177
+
+        Reviewed by Simon Fraser.
+
+        Instead of having the async image decoding be controlled by one setting,
+        two separate settings are added:
+            largeImageAsyncDecodingEnabled
+            animatedImageAsyncDecodingEnabled
+            
+        And an existing setting is removed:
+            asyncImageDecodingEnabled
+
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::load):
+        * loader/cache/CachedImage.h:
+        * page/Settings.in:
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::internalStartAnimation):
+        * platform/graphics/BitmapImage.h:
+        * platform/graphics/ImageObserver.h:
+
 2016-11-30  Zalan Bujtas  <zalan@apple.com>
 
         ASSERTION FAILED: layoutState->m_renderer == this in WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage
index 2939e4d..4924166 100644 (file)
@@ -92,7 +92,8 @@ void CachedImage::load(CachedResourceLoader& loader)
 
     if (m_loader) {
         m_allowSubsampling = m_loader->frameLoader()->frame().settings().imageSubsamplingEnabled();
-        m_allowAsyncImageDecoding = m_loader->frameLoader()->frame().settings().asyncImageDecodingEnabled();
+        m_allowLargeImageAsyncDecoding = m_loader->frameLoader()->frame().settings().largeImageAsyncDecodingEnabled();
+        m_allowAnimatedImageAsyncDecoding = m_loader->frameLoader()->frame().settings().animatedImageAsyncDecodingEnabled();
         m_showDebugBackground = m_loader->frameLoader()->frame().settings().showDebugBorders();
     }
 }
index 106e392..dff1f64 100644 (file)
@@ -118,7 +118,8 @@ private:
 
     // ImageObserver
     bool allowSubsampling() const override { return m_allowSubsampling; }
-    bool allowAsyncImageDecoding() const override { return m_allowAsyncImageDecoding; }
+    bool allowLargeImageAsyncDecoding() const override { return m_allowLargeImageAsyncDecoding; }
+    bool allowAnimatedImageAsyncDecoding() const override { return m_allowAnimatedImageAsyncDecoding; }
     bool showDebugBackground() const override { return m_showDebugBackground; }
     void decodedSizeChanged(const Image*, long long delta) override;
     void didDraw(const Image*) override;
@@ -145,7 +146,8 @@ private:
 #else
     bool m_allowSubsampling { false };
 #endif
-    bool m_allowAsyncImageDecoding { true };
+    bool m_allowLargeImageAsyncDecoding { true };
+    bool m_allowAnimatedImageAsyncDecoding { true };
     bool m_showDebugBackground { false };
 };
 
index 51576ba..cf2056c 100644 (file)
@@ -289,7 +289,8 @@ forcedColorsAreInvertedAccessibilityValue type=ForcedAccessibilityValue, initial
 forcedDisplayIsMonochromeAccessibilityValue type=ForcedAccessibilityValue, initial=defaultForcedDisplayIsMonochromeAccessibilityValue
 forcedPrefersReducedMotionAccessibilityValue type=ForcedAccessibilityValue, initial=defaultForcedPrefersReducedMotionAccessibilityValue
 
-asyncImageDecodingEnabled initial=true
+largeImageAsyncDecodingEnabled initial=true
+animatedImageAsyncDecodingEnabled initial=true
 
 es6ModulesEnabled initial=false
 pointerLockEnabled initial=false
index 3dba562..0ac63fb 100644 (file)
@@ -278,7 +278,7 @@ BitmapImage::StartAnimationResult BitmapImage::internalStartAnimation()
     // it will be decoded on a separate work queue. When decoding nextFrame finishes, we will be notified
     // through the callback newFrameNativeImageAvailableAtIndex(). Otherwise, advanceAnimation() will be called
     // when the timer fires and m_currentFrame will be advanced to nextFrame since it is not being decoded.
-    if ((allowAsyncImageDecoding() && m_source.isAsyncDecodingRequired()) || isAsyncDecodingForcedForTesting()) {
+    if ((allowAnimatedImageAsyncDecoding() && m_source.isAsyncDecodingRequired()) || isAsyncDecodingForcedForTesting()) {
         if (!m_source.requestFrameAsyncDecodingAtIndex(nextFrame, m_currentSubsamplingLevel))
             LOG(Images, "BitmapImage %p %s - cachedFrameCount %ld nextFrame %ld", this, __FUNCTION__, ++m_cachedFrameCount, nextFrame);
         m_desiredFrameDecodeTimeForTesting = time + std::max(m_frameDecodingDurationForTesting, 0.0f);
index e023cb8..4124fa6 100644 (file)
@@ -134,7 +134,8 @@ protected:
     NativeImagePtr frameImageAtIndex(size_t, SubsamplingLevel = SubsamplingLevel::Default, const GraphicsContext* = nullptr);
 
     bool allowSubsampling() const { return imageObserver() && imageObserver()->allowSubsampling(); }
-    bool allowAsyncImageDecoding() const { return imageObserver() && imageObserver()->allowAsyncImageDecoding(); }
+    bool allowLargeImageAsyncDecoding() const { return imageObserver() && imageObserver()->allowLargeImageAsyncDecoding(); }
+    bool allowAnimatedImageAsyncDecoding() const { return imageObserver() && imageObserver()->allowAnimatedImageAsyncDecoding(); }
     bool showDebugBackground() const { return imageObserver() && imageObserver()->showDebugBackground(); }
 
     // Called to invalidate cached data. When |destroyAll| is true, we wipe out
index 55317da..e7ec7c7 100644 (file)
@@ -38,7 +38,8 @@ protected:
     virtual ~ImageObserver() {}
 public:
     virtual bool allowSubsampling() const = 0;
-    virtual bool allowAsyncImageDecoding() const = 0;
+    virtual bool allowLargeImageAsyncDecoding() const = 0;
+    virtual bool allowAnimatedImageAsyncDecoding() const = 0;
     virtual bool showDebugBackground() const = 0;
     virtual void decodedSizeChanged(const Image*, long long delta) = 0;
 
index 30a27c3..4a7d7f6 100644 (file)
@@ -1,3 +1,25 @@
+2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Add separate settings and preferences to enable/disable async decoding for large images and animated images
+        https://bugs.webkit.org/show_bug.cgi?id=165177
+
+        Reviewed by Simon Fraser.
+        
+        Hook up the async image decoding settings for WebKit1.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences largeImageAsyncDecodingEnabled]):
+        (-[WebPreferences setLargeImageAsyncDecodingEnabled:]):
+        (-[WebPreferences animatedImageAsyncDecodingEnabled]):
+        (-[WebPreferences setAnimatedImageAsyncDecodingEnabled:]):
+        (-[WebPreferences asyncImageDecodingEnabled]): Deleted.
+        (-[WebPreferences setAsyncImageDecodingEnabled:]): Deleted.
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2016-11-29  Andy Estes  <aestes@apple.com>
 
         [Cocoa] Enable two clang warnings recommended by Xcode
index 276b4ed..f3538ea 100644 (file)
 #define WebKitSuppressesIncrementalRenderingKey @"WebKitSuppressesIncrementalRendering"
 #define WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey @"WebKitSubpixelCSSOMElementMetricsEnabled"
 #define WebKitResourceLoadStatisticsEnabledPreferenceKey @"WebKitResourceLoadStatisticsEnabled"
-#define WebKitAsyncImageDecodingEnabledPreferenceKey @"WebKitAsyncImageDecodingEnabledEnabled"
+#define WebKitLargeImageAsyncDecodingEnabledPreferenceKey @"WebKitLargeImageAsyncDecodingEnabled"
+#define WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey @"WebKitAnimatedImageAsyncDecodingEnabled"
 #if TARGET_OS_IPHONE
 #define WebKitAudioSessionCategoryOverride @"WebKitAudioSessionCategoryOverride"
 #define WebKitAVKitEnabled @"WebKitAVKitEnabled"
index ef4fa10..0130524 100644 (file)
@@ -507,7 +507,8 @@ public:
         [NSNumber numberWithBool:NO],   WebKitAccelerated2dCanvasEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],  WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],  WebKitResourceLoadStatisticsEnabledPreferenceKey,
-        [NSNumber numberWithBool:YES],  WebKitAsyncImageDecodingEnabledPreferenceKey,
+        [NSNumber numberWithBool:YES],  WebKitLargeImageAsyncDecodingEnabledPreferenceKey,
+        [NSNumber numberWithBool:YES],  WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey,
 #if PLATFORM(IOS)
         [NSNumber numberWithBool:YES],  WebKitFrameFlatteningEnabledPreferenceKey,
 #else
@@ -1887,14 +1888,24 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:enabled forKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
 }
 
-- (BOOL)asyncImageDecodingEnabled
+- (BOOL)largeImageAsyncDecodingEnabled
 {
-    return [self _boolValueForKey:WebKitAsyncImageDecodingEnabledPreferenceKey];
+    return [self _boolValueForKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
 }
 
-- (void)setAsyncImageDecodingEnabled:(BOOL)enabled
+- (void)setLargeImageAsyncDecodingEnabled:(BOOL)enabled
 {
-    [self _setBoolValue:enabled forKey:WebKitAsyncImageDecodingEnabledPreferenceKey];
+    [self _setBoolValue:enabled forKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
+}
+
+- (BOOL)animatedImageAsyncDecodingEnabled
+{
+    return [self _boolValueForKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
+}
+
+- (void)setAnimatedImageAsyncDecodingEnabled:(BOOL)enabled
+{
+    [self _setBoolValue:enabled forKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
 }
 
 - (BOOL)canvasUsesAcceleratedDrawing
index 1a3c979..45bc2f5 100644 (file)
@@ -513,7 +513,8 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (BOOL)modernMediaControlsEnabled;
 
 @property (nonatomic) BOOL visualViewportEnabled;
-@property (nonatomic) BOOL asyncImageDecodingEnabled;
+@property (nonatomic) BOOL largeImageAsyncDecodingEnabled;
+@property (nonatomic) BOOL animatedImageAsyncDecodingEnabled;
 @property (nonatomic) BOOL javaScriptMarkupEnabled;
 @property (nonatomic) BOOL mediaDataLoadsAutomatically;
 @property (nonatomic) BOOL attachmentElementEnabled;
index dadc262..b322ae0 100644 (file)
@@ -2900,7 +2900,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
     settings.setShouldConvertInvalidURLsToBlank(shouldConvertInvalidURLsToBlank());
 
-    settings.setAsyncImageDecodingEnabled([preferences asyncImageDecodingEnabled]);
+    settings.setLargeImageAsyncDecodingEnabled([preferences largeImageAsyncDecodingEnabled]);
+    settings.setAnimatedImageAsyncDecodingEnabled([preferences animatedImageAsyncDecodingEnabled]);
 }
 
 static inline IMP getMethod(id o, SEL s)
index a1da3cf..f2b5ab1 100644 (file)
@@ -1,3 +1,26 @@
+2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Add separate settings and preferences to enable/disable async decoding for large images and animated images
+        https://bugs.webkit.org/show_bug.cgi?id=165177
+
+        Reviewed by Simon Fraser.
+        
+        Hook up the async image decoding settings for WebKit2.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _largeImageAsyncDecodingEnabled]):
+        (-[WKPreferences _setLargeImageAsyncDecodingEnabled:]):
+        (-[WKPreferences _animatedImageAsyncDecodingEnabled]):
+        (-[WKPreferences _setAnimatedImageAsyncDecodingEnabled:]):
+        (-[WKPreferences _asyncImageDecodingEnabled]): Deleted.
+        (-[WKPreferences _setAsyncImageDecodingEnabled:]): Deleted.
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-11-30  Chris Dumez  <cdumez@apple.com>
 
         [iOS][WK2] Turn on HTML interactive form validation feature
index feb2c51..cb776e5 100644 (file)
     macro(ApplePayCapabilityDisclosureAllowed, applePayCapabilityDisclosureAllowed, Bool, bool, true, "", "") \
     macro(VisualViewportEnabled, visualViewportEnabled, Bool, bool, false, "", "") \
     macro(NeedsStorageAccessFromFileURLsQuirk, needsStorageAccessFromFileURLsQuirk, Bool, bool, true, "", "") \
-    macro(AsyncImageDecodingEnabled, asyncImageDecodingEnabled, Bool, bool, true, "", "") \
+    macro(LargeImageAsyncDecodingEnabled, largeImageAsyncDecodingEnabled, Bool, bool, true, "", "") \
+    macro(AnimatedImageAsyncDecodingEnabled, animatedImageAsyncDecodingEnabled, Bool, bool, true, "", "") \
     macro(CustomElementsEnabled, customElementsEnabled, Bool, bool, true, "", "") \
     macro(EncryptedMediaAPIEnabled, encryptedMediaAPIEnabled, Bool, bool, false, "", "") \
     macro(IntersectionObserverEnabled, intersectionObserverEnabled, Bool, bool, false, "Intersection Observer", "Enable Intersection Observer support") \
index 3596c6d..88da5be 100644 (file)
@@ -325,14 +325,24 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setVisualViewportEnabled(_visualViewportEnabled);
 }
 
-- (BOOL)_asyncImageDecodingEnabled
+- (BOOL)_largeImageAsyncDecodingEnabled
 {
-    return _preferences->asyncImageDecodingEnabled();
+    return _preferences->largeImageAsyncDecodingEnabled();
 }
 
-- (void)_setAsyncImageDecodingEnabled:(BOOL)_asyncImageDecodingEnabled
+- (void)_setLargeImageAsyncDecodingEnabled:(BOOL)_largeImageAsyncDecodingEnabled
 {
-    _preferences->setAsyncImageDecodingEnabled(_asyncImageDecodingEnabled);
+    _preferences->setLargeImageAsyncDecodingEnabled(_largeImageAsyncDecodingEnabled);
+}
+
+- (BOOL)_animatedImageAsyncDecodingEnabled
+{
+    return _preferences->animatedImageAsyncDecodingEnabled();
+}
+
+- (void)_setAnimatedImageAsyncDecodingEnabled:(BOOL)_animatedImageAsyncDecodingEnabled
+{
+    _preferences->setAnimatedImageAsyncDecodingEnabled(_animatedImageAsyncDecodingEnabled);
 }
 
 - (BOOL)_textAutosizingEnabled
index 37abeca..ddabad1 100644 (file)
@@ -64,7 +64,8 @@ typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
 @property (nonatomic, setter=_setAcceleratedDrawingEnabled:) BOOL _acceleratedDrawingEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 @property (nonatomic, setter=_setDisplayListDrawingEnabled:) BOOL _displayListDrawingEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 @property (nonatomic, setter=_setVisualViewportEnabled:) BOOL _visualViewportEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
-@property (nonatomic, setter=_setAsyncImageDecodingEnabled:) BOOL _asyncImageDecodingEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic, setter=_setLargeImageAsyncDecodingEnabled:) BOOL _largeImageAsyncDecodingEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic, setter=_setAnimatedImageAsyncDecodingEnabled:) BOOL _animatedImageAsyncDecodingEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setTextAutosizingEnabled:) BOOL _textAutosizingEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 
 @property (nonatomic, setter=_setDeveloperExtrasEnabled:) BOOL _developerExtrasEnabled WK_API_AVAILABLE(macosx(10.11), ios(9.0));
index bce59a0..0043a0a 100644 (file)
@@ -242,7 +242,8 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page
     macro(WebKitMediaStreamEnabled, MediaStreamEnabled, mediaStreamEnabled) \
     macro(WebKitHTTPEquivEnabled, HttpEquivEnabled, httpEquivEnabled) \
     macro(WebKitVisualViewportEnabled, VisualViewportEnabled, visualViewportEnabled) \
-    macro(WebKitAsyncImageDecodingEnabled, AsyncImageDecodingEnabled, asyncImageDecodingEnabled) \
+    macro(WebKitLargeImageAsyncDecodingEnabled, LargeImageAsyncDecodingEnabled, largeImageAsyncDecodingEnabled) \
+    macro(WebKitAnimatedImageAsyncDecodingEnabled, AnimatedImageAsyncDecodingEnabled, animatedImageAsyncDecodingEnabled) \
     macro(WebKitES6ModulesEnabled, Es6ModulesEnabled, es6ModulesEnabled) \
     \
 
index 3b08e09..f5b4d34 100644 (file)
@@ -3219,7 +3219,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     m_viewportConfiguration.setCanIgnoreScalingConstraints(m_ignoreViewportScalingConstraints);
     setForceAlwaysUserScalable(m_forceAlwaysUserScalable || store.getBoolValueForKey(WebPreferencesKey::forceAlwaysUserScalableKey()));
 #endif
-    settings.setAsyncImageDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::asyncImageDecodingEnabledKey()));
+    settings.setLargeImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::largeImageAsyncDecodingEnabledKey()));
+    settings.setAnimatedImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::animatedImageAsyncDecodingEnabledKey()));
 }
 
 #if ENABLE(DATA_DETECTION)
index 81aa2e7..316d468 100644 (file)
@@ -1,3 +1,27 @@
+2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Add separate settings and preferences to enable/disable async decoding for large images and animated images
+        https://bugs.webkit.org/show_bug.cgi?id=165177
+
+        Reviewed by Simon Fraser.
+        
+        Pref and a menu item to toggle async image decoding settings for WebKits 1 and 2.
+
+        * MiniBrowser/mac/SettingsController.h:
+        * MiniBrowser/mac/SettingsController.m:
+        (-[SettingsController _populateMenu]):
+        (-[SettingsController validateMenuItem:]):
+        (-[SettingsController toggleLargeImageAsyncDecodingEnabled:]):
+        (-[SettingsController largeImageAsyncDecodingEnabled]):
+        (-[SettingsController toggleAnimatedImageAsyncDecodingEnabled:]):
+        (-[SettingsController animatedImageAsyncDecodingEnabled]):
+        (-[SettingsController toggleAsyncImageDecodingEnabled:]): Deleted.
+        (-[SettingsController asyncImageDecodingEnabled]): Deleted.
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController didChangeSettings]):
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController didChangeSettings]):
+
 2016-11-30  Jonathan Bedard  <jbedard@apple.com>
 
         Make it possible to use an existing simulator instance for one-off testing
index f8819d3..0e0862b 100644 (file)
@@ -50,7 +50,8 @@
 @property (nonatomic, readonly) BOOL displayListDrawingEnabled;
 @property (nonatomic, readonly) BOOL resourceLoadStatisticsEnabled;
 @property (nonatomic, readonly) BOOL visualViewportEnabled;
-@property (nonatomic, readonly) BOOL asyncImageDecodingEnabled;
+@property (nonatomic, readonly) BOOL largeImageAsyncDecodingEnabled;
+@property (nonatomic, readonly) BOOL animatedImageAsyncDecodingEnabled;
 @property (nonatomic, readonly) BOOL loadsAllSiteIcons;
 @property (nonatomic, readonly) BOOL usesGameControllerFramework;
 
index 15c7468..6c131d4 100644 (file)
@@ -56,7 +56,8 @@ static NSString * const UsePaginatedModePreferenceKey = @"UsePaginatedMode";
 static NSString * const EnableSubPixelCSSOMMetricsPreferenceKey = @"EnableSubPixelCSSOMMetrics";
 
 static NSString * const VisualViewportEnabledPreferenceKey = @"VisualViewportEnabled";
-static NSString * const AsyncImageDecodingEnabledPreferenceKey = @"AsyncImageDecodingEnabled";
+static NSString * const LargeImageAsyncDecodingEnabledPreferenceKey = @"LargeImageAsyncDecodingEnabled";
+static NSString * const AnimatedImageAsyncDecodingEnabledPreferenceKey = @"AnimatedImageAsyncDecodingEnabled";
 
 // This default name intentionally overlaps with the key that WebKit2 checks when creating a view.
 static NSString * const UseRemoteLayerTreeDrawingAreaPreferenceKey = @"WebKit2UseRemoteLayerTreeDrawingArea";
@@ -128,7 +129,8 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     [self _addItemWithTitle:@"Enable Display List Drawing" action:@selector(toggleDisplayListDrawingEnabled:) indented:NO];
     [self _addItemWithTitle:@"Enable Visual Viewport" action:@selector(toggleVisualViewportEnabled:) indented:NO];
     [self _addItemWithTitle:@"Enable Resource Load Statistics" action:@selector(toggleResourceLoadStatisticsEnabled:) indented:NO];
-    [self _addItemWithTitle:@"Enable Async Image Decoding" action:@selector(toggleAsyncImageDecodingEnabled:) indented:NO];
+    [self _addItemWithTitle:@"Enable Large Image Async Decoding" action:@selector(toggleLargeImageAsyncDecodingEnabled:) indented:NO];
+    [self _addItemWithTitle:@"Enable Animated Image Async Decoding" action:@selector(toggleAnimatedImageAsyncDecodingEnabled:) indented:NO];
 
     [self _addHeaderWithTitle:@"WebKit2-only Settings"];
 
@@ -203,8 +205,10 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
         [menuItem setState:[self displayListDrawingEnabled] ? NSOnState : NSOffState];
     else if (action == @selector(toggleResourceLoadStatisticsEnabled:))
         [menuItem setState:[self resourceLoadStatisticsEnabled] ? NSOnState : NSOffState];
-    else if (action == @selector(toggleAsyncImageDecodingEnabled:))
-        [menuItem setState:[self asyncImageDecodingEnabled] ? NSOnState : NSOffState];
+    else if (action == @selector(toggleLargeImageAsyncDecodingEnabled:))
+        [menuItem setState:[self largeImageAsyncDecodingEnabled] ? NSOnState : NSOffState];
+    else if (action == @selector(toggleAnimatedImageAsyncDecodingEnabled:))
+        [menuItem setState:[self animatedImageAsyncDecodingEnabled] ? NSOnState : NSOffState];
     else if (action == @selector(toggleVisualViewportEnabled:))
         [menuItem setState:[self visualViewportEnabled] ? NSOnState : NSOffState];
     else if (action == @selector(toggleShowTiledScrollingIndicator:))
@@ -412,14 +416,24 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     return [[NSUserDefaults standardUserDefaults] boolForKey:ResourceLoadStatisticsEnabledPreferenceKey];
 }
 
-- (void)toggleAsyncImageDecodingEnabled:(id)sender
+- (void)toggleLargeImageAsyncDecodingEnabled:(id)sender
 {
-    [self _toggleBooleanDefault:AsyncImageDecodingEnabledPreferenceKey];
+    [self _toggleBooleanDefault:LargeImageAsyncDecodingEnabledPreferenceKey];
 }
 
-- (BOOL)asyncImageDecodingEnabled
+- (BOOL)largeImageAsyncDecodingEnabled
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:AsyncImageDecodingEnabledPreferenceKey];
+    return [[NSUserDefaults standardUserDefaults] boolForKey:LargeImageAsyncDecodingEnabledPreferenceKey];
+}
+
+- (void)toggleAnimatedImageAsyncDecodingEnabled:(id)sender
+{
+    [self _toggleBooleanDefault:AnimatedImageAsyncDecodingEnabledPreferenceKey];
+}
+
+- (BOOL)animatedImageAsyncDecodingEnabled
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:AnimatedImageAsyncDecodingEnabledPreferenceKey];
 }
 
 - (void)toggleEnableSubPixelCSSOMMetrics:(id)sender
index 9142e33..83f40a5 100644 (file)
@@ -282,7 +282,8 @@ static BOOL areEssentiallyEqual(double a, double b)
     [[WebPreferences standardPreferences] setAcceleratedDrawingEnabled:settings.acceleratedDrawingEnabled];
     [[WebPreferences standardPreferences] setResourceLoadStatisticsEnabled:settings.resourceLoadStatisticsEnabled];
     [[WebPreferences standardPreferences] setVisualViewportEnabled:settings.visualViewportEnabled];
-    [[WebPreferences standardPreferences] setAsyncImageDecodingEnabled:settings.asyncImageDecodingEnabled];
+    [[WebPreferences standardPreferences] setLargeImageAsyncDecodingEnabled:settings.largeImageAsyncDecodingEnabled];
+    [[WebPreferences standardPreferences] setAnimatedImageAsyncDecodingEnabled:settings.animatedImageAsyncDecodingEnabled];
 
     BOOL useTransparentWindows = settings.useTransparentWindows;
     if (useTransparentWindows != !self.window.isOpaque) {
index 1456e24..b5898fb 100644 (file)
@@ -375,7 +375,8 @@ static BOOL areEssentiallyEqual(double a, double b)
     preferences._resourceUsageOverlayVisible = settings.resourceUsageOverlayVisible;
     preferences._displayListDrawingEnabled = settings.displayListDrawingEnabled;
     preferences._visualViewportEnabled = settings.visualViewportEnabled;
-    preferences._asyncImageDecodingEnabled = settings.asyncImageDecodingEnabled;
+    preferences._largeImageAsyncDecodingEnabled = settings.largeImageAsyncDecodingEnabled;
+    preferences._animatedImageAsyncDecodingEnabled = settings.animatedImageAsyncDecodingEnabled;
 
     _webView.configuration.websiteDataStore._resourceLoadStatisticsEnabled = settings.resourceLoadStatisticsEnabled;