From 1c86256f83da00ecd51fe107b075c36738f0d8bf Mon Sep 17 00:00:00 2001 From: cacaodev Date: Thu, 2 Mar 2017 11:21:57 +0100 Subject: [PATCH] Add CPCSSAnimationFeature to CPCompatibility constants --- AppKit/CPCompatibility.j | 2 +- AppKit/CoreAnimation/CPViewAnimator.j | 2 +- AppKit/CoreAnimation/_CPObjectAnimator.j | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/AppKit/CPCompatibility.j b/AppKit/CPCompatibility.j index 3b5389020..d58471fe7 100644 --- a/AppKit/CPCompatibility.j +++ b/AppKit/CPCompatibility.j @@ -81,7 +81,7 @@ CPFileAPIFeature = 31; CPAltEnterTextAreaFeature = 32; - +CPCSSAnimationFeature = 33; /* When an absolutely positioned div (CPView) with an absolutely positioned canvas in it (CPView with drawRect:) moves things on top of the canvas (subviews) don't redraw correctly. E.g. if you have a bunch of text fields in a CPBox in a sheet which animates in, some of the text fields might not be visible because the CPBox has a canvas at the bottom and the box moved form offscreen to onscreen. This bug is probably very related: https://bugs.webkit.org/show_bug.cgi?id=67203 diff --git a/AppKit/CoreAnimation/CPViewAnimator.j b/AppKit/CoreAnimation/CPViewAnimator.j index 3937f4a1e..961f79a17 100644 --- a/AppKit/CoreAnimation/CPViewAnimator.j +++ b/AppKit/CoreAnimation/CPViewAnimator.j @@ -80,7 +80,7 @@ var DEFAULT_CSS_PROPERTIES = nil, var animation = [_target animationForKey:aKeyPath], context = [CPAnimationContext currentContext]; - if (!animation || ![animation isKindOfClass:[CAAnimation class]] || (![context duration] && ![animation duration]) || ![_CPObjectAnimator supportsCSSAnimations]) + if (!animation || ![animation isKindOfClass:[CAAnimation class]] || (![context duration] && ![animation duration]) || !CPFeatureIsCompatible(CPCSSAnimationFeature)) { if (fallback) fallback(); diff --git a/AppKit/CoreAnimation/_CPObjectAnimator.j b/AppKit/CoreAnimation/_CPObjectAnimator.j index 4bd34444e..944327057 100644 --- a/AppKit/CoreAnimation/_CPObjectAnimator.j +++ b/AppKit/CoreAnimation/_CPObjectAnimator.j @@ -20,12 +20,13 @@ var _supportsCSSAnimations = null; id _target; } -+ (BOOL)supportsCSSAnimations ++ (BOOL)initialize { - if (_supportsCSSAnimations === null) - _supportsCSSAnimations = CPBrowserCSSProperty("animation"); + if ([self class] !== [_CPObjectAnimator class]) + return; - return _supportsCSSAnimations; + var compat = (CPBrowserCSSProperty("animation") !== nil); + CPSetPlatformFeature(CPCSSAnimationFeature, compat); } - (id)initWithTarget:(id)aTarget @@ -77,7 +78,7 @@ var _supportsCSSAnimations = null; var animation = [_target animationForKey:aKeyPath], context = [CPAnimationContext currentContext]; - if (!animation || ![animation isKindOfClass:[CAAnimation class]] || (![context duration] && ![animation duration]) || ![_CPObjectAnimator supportsCSSAnimations]) + if (!animation || ![animation isKindOfClass:[CAAnimation class]] || (![context duration] && ![animation duration]) || !CPFeatureIsCompatible(CPCSSAnimationFeature)) [_target setValue:aTargetValue forKey:aKeyPath]; else {