Title: [170343] trunk/Source/WebCore
Revision
170343
Author
[email protected]
Date
2014-06-23 19:24:12 -0700 (Mon, 23 Jun 2014)

Log Message

[Mac] Don't draw focus rings if we are animating controls
https://bugs.webkit.org/show_bug.cgi?id=134232
<rdar://problem/17381121>

Reviewed by Tim Horton.

Controls in native apps do not draw their focus rings as they
animate (in Yosemite). Turn this off for WebKit too. It turns
out that when we were drawing them, they were in the wrong
place anyway.

Since we don't animate controls when testing, we can't really test this.

* platform/mac/ThemeMac.mm:
(WebCore::paintToggleButton): Only draw the focus ring if the
NSButtonCell is not animating.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170342 => 170343)


--- trunk/Source/WebCore/ChangeLog	2014-06-24 02:18:39 UTC (rev 170342)
+++ trunk/Source/WebCore/ChangeLog	2014-06-24 02:24:12 UTC (rev 170343)
@@ -1,3 +1,22 @@
+2014-06-23  Dean Jackson  <[email protected]>
+
+        [Mac] Don't draw focus rings if we are animating controls
+        https://bugs.webkit.org/show_bug.cgi?id=134232
+        <rdar://problem/17381121>
+
+        Reviewed by Tim Horton.
+
+        Controls in native apps do not draw their focus rings as they
+        animate (in Yosemite). Turn this off for WebKit too. It turns
+        out that when we were drawing them, they were in the wrong
+        place anyway.
+
+        Since we don't animate controls when testing, we can't really test this.
+
+        * platform/mac/ThemeMac.mm:
+        (WebCore::paintToggleButton): Only draw the focus ring if the
+        NSButtonCell is not animating.
+
 2014-06-23  Krzysztof Czech  <[email protected]>
 
         [ATK] Remove some unnecessary code from WebKitAccessibleWrapperAtk

Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (170342 => 170343)


--- trunk/Source/WebCore/platform/mac/ThemeMac.mm	2014-06-24 02:18:39 UTC (rev 170342)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm	2014-06-24 02:24:12 UTC (rev 170343)
@@ -426,6 +426,9 @@
     LocalCurrentGraphicsContext localContext(context);
     NSView *view = ThemeMac::ensuredView(scrollView, controlStates);
 
+    bool isAnimating = false;
+    bool needsRepaint = false;
+
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
     if ([toggleButtonCell _stateAnimationRunning]) {
         // AppKit's drawWithFrame appears to render the cell centered in the
@@ -435,20 +438,18 @@
         context->scale(FloatSize(1, -1));
         context->translate(0, -inflatedRect.height());
         [toggleButtonCell _renderCurrentAnimationFrameInContext:context->platformContext() atLocation:NSMakePoint(0, 0)];
+        isAnimating = [toggleButtonCell _stateAnimationRunning];
     } else
         [toggleButtonCell drawWithFrame:NSRect(inflatedRect) inView:view];
 #else
     [toggleButtonCell drawWithFrame:NSRect(inflatedRect) inView:view];
 #endif
 
-    bool needsRepaint = false;
-    if (controlStates->states() & ControlStates::FocusState)
+    if (!isAnimating && (controlStates->states() & ControlStates::FocusState))
         needsRepaint = drawCellFocusRing(toggleButtonCell, inflatedRect, view);
     [toggleButtonCell setControlView:nil];
 
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
-    needsRepaint |= [toggleButtonCell _stateAnimationRunning];
-#endif
+    needsRepaint |= isAnimating;
     controlStates->setNeedsRepaint(needsRepaint);
     if (needsRepaint)
         controlStates->setPlatformControl(toggleButtonCell);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to