Title: [185272] trunk/Source/WebCore
- Revision
- 185272
- Author
- [email protected]
- Date
- 2015-06-05 16:16:26 -0700 (Fri, 05 Jun 2015)
Log Message
Lingering checkbox animations when rapidly switching between views on WK1
https://bugs.webkit.org/show_bug.cgi?id=145715
<rdar://problem/17381121>
Reviewed by Simon Fraser.
On WK1, the NSView we use for NSButtonCells is parented in the ScrollView.
Our checkbox and radiobutton animations cause AppKit to create a CALayer which
is parented into that view. As we render the animations, we see the CALayer getting
drawn also.
The fix was to use an unparented layer on WK1 when drawing these controls, the same
way WK2 does. This technique may apply to all controls, but restricting it
to just the buttons at the moment is less risky.
This only happens during the swap between a checked and non-checked state,
and we have no way to test it :(
* platform/mac/ThemeMac.h: New optional parameter to ensuredView.
* platform/mac/ThemeMac.mm:
(WebCore::paintToggleButton): If we're on Yosemite or highter, use an unparented view.
(WebCore::ThemeMac::ensuredView): Return either a parented or unparented view.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (185271 => 185272)
--- trunk/Source/WebCore/ChangeLog 2015-06-05 22:59:16 UTC (rev 185271)
+++ trunk/Source/WebCore/ChangeLog 2015-06-05 23:16:26 UTC (rev 185272)
@@ -1,3 +1,28 @@
+2015-06-05 Dean Jackson <[email protected]>
+
+ Lingering checkbox animations when rapidly switching between views on WK1
+ https://bugs.webkit.org/show_bug.cgi?id=145715
+ <rdar://problem/17381121>
+
+ Reviewed by Simon Fraser.
+
+ On WK1, the NSView we use for NSButtonCells is parented in the ScrollView.
+ Our checkbox and radiobutton animations cause AppKit to create a CALayer which
+ is parented into that view. As we render the animations, we see the CALayer getting
+ drawn also.
+
+ The fix was to use an unparented layer on WK1 when drawing these controls, the same
+ way WK2 does. This technique may apply to all controls, but restricting it
+ to just the buttons at the moment is less risky.
+
+ This only happens during the swap between a checked and non-checked state,
+ and we have no way to test it :(
+
+ * platform/mac/ThemeMac.h: New optional parameter to ensuredView.
+ * platform/mac/ThemeMac.mm:
+ (WebCore::paintToggleButton): If we're on Yosemite or highter, use an unparented view.
+ (WebCore::ThemeMac::ensuredView): Return either a parented or unparented view.
+
2015-06-05 Matt Rajca <[email protected]>
MediaSessions should keep track of their participating media elements.
Modified: trunk/Source/WebCore/platform/mac/ThemeMac.h (185271 => 185272)
--- trunk/Source/WebCore/platform/mac/ThemeMac.h 2015-06-05 22:59:16 UTC (rev 185271)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.h 2015-06-05 23:16:26 UTC (rev 185272)
@@ -56,7 +56,7 @@
virtual void inflateControlPaintRect(ControlPart, const ControlStates*, FloatRect&, float zoomFactor) const;
// FIXME: Once RenderThemeMac is converted over to use Theme then this can be internal to ThemeMac.
- static NSView* ensuredView(ScrollView*, const ControlStates*);
+ static NSView* ensuredView(ScrollView*, const ControlStates*, bool useUnparentedView = false);
static void setFocusRingClipRect(const FloatRect&);
};
Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (185271 => 185272)
--- trunk/Source/WebCore/platform/mac/ThemeMac.mm 2015-06-05 22:59:16 UTC (rev 185271)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm 2015-06-05 23:16:26 UTC (rev 185272)
@@ -417,19 +417,22 @@
}
LocalCurrentGraphicsContext localContext(context);
- NSView *view = ThemeMac::ensuredView(scrollView, controlStates);
+ bool useUnparentedView = false;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ useUnparentedView = true;
+#endif
+ NSView *view = ThemeMac::ensuredView(scrollView, controlStates, useUnparentedView);
+
bool isAnimating = false;
bool needsRepaint = false;
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
if ([toggleButtonCell _stateAnimationRunning]) {
- // AppKit's drawWithFrame appears to render the cell centered in the
- // provided rectangle/frame, so we need to manually position the
- // animated cell at the correct location.
context->translate(inflatedRect.x(), inflatedRect.y());
context->scale(FloatSize(1, -1));
context->translate(0, -inflatedRect.height());
+
[toggleButtonCell _renderCurrentAnimationFrameInContext:context->platformContext() atLocation:NSMakePoint(0, 0)];
isAnimating = [toggleButtonCell _stateAnimationRunning];
} else
@@ -639,10 +642,12 @@
// This will ensure that we always return a valid NSView, even if ScrollView doesn't have an associated document NSView.
// If the ScrollView doesn't have an NSView, we will return a fake NSView set up in the way AppKit expects.
-NSView *ThemeMac::ensuredView(ScrollView* scrollView, const ControlStates* controlStates)
+NSView *ThemeMac::ensuredView(ScrollView* scrollView, const ControlStates* controlStates, bool useUnparentedView)
{
- if (NSView *documentView = scrollView->documentView())
- return documentView;
+ if (!useUnparentedView) {
+ if (NSView *documentView = scrollView->documentView())
+ return documentView;
+ }
// Use a fake view.
static WebCoreThemeView *themeView = [[WebCoreThemeView alloc] init];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes