Title: [114707] trunk/Source/WebCore
Revision
114707
Author
[email protected]
Date
2012-04-19 17:50:19 -0700 (Thu, 19 Apr 2012)

Log Message

Focus ring on wikipedia gets blobs when you type
https://bugs.webkit.org/show_bug.cgi?id=84407
<rdar://problem/11011847>

Reviewed by Dan Bernstein.

Make it possible to override the focus ring visible rect from layer drawing code.

* platform/graphics/mac/WebLayer.mm:
(drawLayerContents):
Call ThemeMac::setFocusRingClipRect to set the focus ring clip rect while drawing.

* platform/mac/ThemeMac.h:
* platform/mac/ThemeMac.mm:
(-[WebCoreFlippedView _focusRingVisibleRect]):
If there's an active focus ring visible rect, use it. Otherwise, fall back to the previous behavior
and just return the view's visible rect.

(WebCore::ThemeMac::setFocusRingClipRect):
Update the focus clip rect.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114706 => 114707)


--- trunk/Source/WebCore/ChangeLog	2012-04-20 00:48:27 UTC (rev 114706)
+++ trunk/Source/WebCore/ChangeLog	2012-04-20 00:50:19 UTC (rev 114707)
@@ -1,3 +1,26 @@
+2012-04-19  Anders Carlsson  <[email protected]>
+
+        Focus ring on wikipedia gets blobs when you type
+        https://bugs.webkit.org/show_bug.cgi?id=84407
+        <rdar://problem/11011847>
+
+        Reviewed by Dan Bernstein.
+
+        Make it possible to override the focus ring visible rect from layer drawing code.
+
+        * platform/graphics/mac/WebLayer.mm:
+        (drawLayerContents):
+        Call ThemeMac::setFocusRingClipRect to set the focus ring clip rect while drawing.
+
+        * platform/mac/ThemeMac.h:
+        * platform/mac/ThemeMac.mm:
+        (-[WebCoreFlippedView _focusRingVisibleRect]):
+        If there's an active focus ring visible rect, use it. Otherwise, fall back to the previous behavior
+        and just return the view's visible rect.
+
+        (WebCore::ThemeMac::setFocusRingClipRect):
+        Update the focus clip rect.
+
 2012-04-19  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r114690.

Modified: trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm (114706 => 114707)


--- trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2012-04-20 00:48:27 UTC (rev 114706)
+++ trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2012-04-20 00:50:19 UTC (rev 114707)
@@ -32,6 +32,7 @@
 #import "GraphicsContext.h"
 #import "GraphicsLayerCA.h"
 #import "PlatformCALayer.h"
+#import "ThemeMac.h"
 #import <objc/objc-runtime.h>
 #import <QuartzCore/QuartzCore.h>
 #import <wtf/UnusedParam.h>
@@ -79,6 +80,9 @@
     // smaller than the layer bounds (e.g. tiled layers)
     FloatRect clipBounds = CGContextGetClipBoundingBox(context);
 
+    // The focus ring machinery needs to know the exact clip rect in a flipped, non-transformed coordinate system.
+    ThemeMac::setFocusRingClipRect(FloatRect(clipBounds.x(), layerBounds.size.height - clipBounds.maxY(), clipBounds.width(), clipBounds.height()));
+
 #if !defined(BUILDING_ON_SNOW_LEOPARD)
     __block GraphicsContext* ctx = &graphicsContext;
 
@@ -97,6 +101,8 @@
     layerContents->platformCALayerPaintContents(graphicsContext, clip);
 #endif
 
+    ThemeMac::setFocusRingClipRect(FloatRect());
+
     [NSGraphicsContext restoreGraphicsState];
 
     // Re-fetch the layer owner, since <rdar://problem/9125151> indicates that it might have been destroyed during painting.

Modified: trunk/Source/WebCore/platform/mac/ThemeMac.h (114706 => 114707)


--- trunk/Source/WebCore/platform/mac/ThemeMac.h	2012-04-20 00:48:27 UTC (rev 114706)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.h	2012-04-20 00:50:19 UTC (rev 114707)
@@ -52,6 +52,7 @@
 
     // FIXME: Once RenderThemeMac is converted over to use Theme then this can be internal to ThemeMac.
     static NSView* ensuredView(ScrollView*);
+    static void setFocusRingClipRect(const FloatRect&);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (114706 => 114707)


--- trunk/Source/WebCore/platform/mac/ThemeMac.mm	2012-04-20 00:48:27 UTC (rev 114706)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm	2012-04-20 00:50:19 UTC (rev 114707)
@@ -36,6 +36,8 @@
 
 using namespace std;
 
+NSRect focusRingClipRect;
+
 // This is a view whose sole purpose is to tell AppKit that it's flipped.
 @interface WebCoreFlippedView : NSControl
 @end
@@ -59,7 +61,13 @@
 
 - (NSRect)_focusRingVisibleRect
 {
-    return [self visibleRect];
+    if (NSIsEmptyRect(focusRingClipRect))
+        return [self visibleRect];
+
+    NSRect rect = focusRingClipRect;
+    rect.origin.y = [self bounds].size.height - NSMaxY(rect);
+
+    return rect;
 }
 
 - (NSView *)_focusRingClipAncestor
@@ -584,7 +592,12 @@
 
     return flippedView;
 }
-    
+
+void ThemeMac::setFocusRingClipRect(const FloatRect& rect)
+{
+    focusRingClipRect = rect;
+}
+
 // Theme overrides
 
 int ThemeMac::baselinePositionAdjustment(ControlPart part) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to