Reviewed by Darin Adler.
- WebCore part of fixing <rdar://problem/
5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
Test: fast/repaint/focus-ring.html
* editing/SelectionController.cpp:
(WebCore::SelectionController::caretRepaintRect): Changed to return just
the caret rect without any padding.
(WebCore::SelectionController::recomputeCaretRect): Changed to repaint
just the caret rect without any padding.
* platform/graphics/GraphicsContext.h: Removed setFocusRingClip() and
clearFocusRingClip().
* platform/graphics/cairo/GraphicsContextCairo.cpp: Ditto.
* platform/graphics/cg/GraphicsContextCG.cpp: Ditto.
* platform/graphics/cg/GraphicsContextPlatformPrivate.h: Removed
m_focusRingClip member.
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::GraphicsContext::drawFocusRing): Changed to call
wkDrawFocusRing() once without setting up additional clip. On Leopard,
wkDrawFocusRing() respects the context clip now. On Tiger, a
transparency layer is used to apply clipping to the focus ring.
* platform/graphics/qt/GraphicsContextQt.cpp: Removed focus ring clip
methods and member.
* platform/graphics/wx/GraphicsContextWx.cpp: Ditto.
* platform/mac/WebCoreSystemInterface.h: Removed the clipRect argument
to wkDrawFocusRing().
* platform/mac/WebCoreSystemInterface.mm: Ditto.
* rendering/RenderLayer.cpp:
(WebCore::setClip): Removed call to set the focus ring clip.
(WebCore::restoreClip): Removed call to reset the focus ring clip.
WebKitLibraries:
Reviewed by Darin Adler.
- updated system interface for fixing <rdar://problem/
5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLeopard.a:
* libWebKitSystemInterfaceTiger.a:
LayoutTests:
Reviewed by Darin Adler.
- repaint test for <rdar://problem/
5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
* fast/repaint/focus-ring.html: Added.
* platform/mac/fast/repaint/focus-ring-expected.checksum: Added.
* platform/mac/fast/repaint/focus-ring-expected.png: Added.
* platform/mac/fast/repaint/focus-ring-expected.txt: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28523
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-12-07 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - repaint test for <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
+
+ * fast/repaint/focus-ring.html: Added.
+ * platform/mac/fast/repaint/focus-ring-expected.checksum: Added.
+ * platform/mac/fast/repaint/focus-ring-expected.png: Added.
+ * platform/mac/fast/repaint/focus-ring-expected.txt: Added.
+
2007-12-07 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
--- /dev/null
+<script>
+ if (window.layoutTestController)
+ layoutTestController.testRepaint();
+</script>
+<style>
+ div {
+ width: 100px;
+ height: 100px;
+ outline: auto;
+ outline-width: 10px;
+ background-color: lightyellow;
+ }
+</style>
+<div style="margin: 20px; "></div>
+<div style="position: absolute; top: 148px; left: 28px; clip: rect(-10px 50px 50px -10px)"></div>
--- /dev/null
+e7972d277234de94b7a67fefb444146c
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,20) size 784x560
+ RenderBlock {DIV} at (20,0) size 100x100 [bgcolor=#FFFFE0]
+layer at (28,148) size 100x100 backgroundClip at (28,148) size 50x50 clip at (18,138) size 60x60 outlineClip at (18,138) size 60x60
+ RenderBlock (positioned) {DIV} at (28,148) size 100x100 [bgcolor=#FFFFE0]
+2007-12-07 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - WebCore part of fixing <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
+
+ Test: fast/repaint/focus-ring.html
+
+ * editing/SelectionController.cpp:
+ (WebCore::SelectionController::caretRepaintRect): Changed to return just
+ the caret rect without any padding.
+ (WebCore::SelectionController::recomputeCaretRect): Changed to repaint
+ just the caret rect without any padding.
+ * platform/graphics/GraphicsContext.h: Removed setFocusRingClip() and
+ clearFocusRingClip().
+ * platform/graphics/cairo/GraphicsContextCairo.cpp: Ditto.
+ * platform/graphics/cg/GraphicsContextCG.cpp: Ditto.
+ * platform/graphics/cg/GraphicsContextPlatformPrivate.h: Removed
+ m_focusRingClip member.
+ * platform/graphics/mac/GraphicsContextMac.mm:
+ (WebCore::GraphicsContext::drawFocusRing): Changed to call
+ wkDrawFocusRing() once without setting up additional clip. On Leopard,
+ wkDrawFocusRing() respects the context clip now. On Tiger, a
+ transparency layer is used to apply clipping to the focus ring.
+ * platform/graphics/qt/GraphicsContextQt.cpp: Removed focus ring clip
+ methods and member.
+ * platform/graphics/wx/GraphicsContextWx.cpp: Ditto.
+ * platform/mac/WebCoreSystemInterface.h: Removed the clipRect argument
+ to wkDrawFocusRing().
+ * platform/mac/WebCoreSystemInterface.mm: Ditto.
+ * rendering/RenderLayer.cpp:
+ (WebCore::setClip): Removed call to set the focus ring clip.
+ (WebCore::restoreClip): Removed call to reset the focus ring clip.
+
2007-12-07 Darin Adler <darin@apple.com>
Reviewed by Antti Koivisto and Kevin Decker.
return caret;
}
-static IntRect repaintRectForCaret(IntRect caret)
-{
- if (caret.isEmpty())
- return IntRect();
- caret.inflate(1);
- return caret;
-}
-
IntRect SelectionController::caretRepaintRect() const
{
- return repaintRectForCaret(caretRect());
+ return caretRect();
}
bool SelectionController::recomputeCaretRect()
if (oldRect == newRect)
return false;
- v->updateContents(repaintRectForCaret(oldRect), false);
- v->updateContents(repaintRectForCaret(newRect), false);
+ v->updateContents(oldRect, false);
+ v->updateContents(newRect, false);
return true;
}
void clipOutEllipseInRect(const IntRect&);
void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
- // Functions to work around bugs in focus ring clipping on Mac.
- void setFocusRingClip(const IntRect&);
- void clearFocusRingClip();
-
int textDrawingMode();
void setTextDrawingMode(int);
cairo_restore(cr);
}
-void GraphicsContext::setFocusRingClip(const IntRect&)
-{
- // hopefully a no-op. Comment in CG version says that it exists
- // to work around bugs in Mac focus ring clipping
-}
-
-void GraphicsContext::clearFocusRingClip()
-{
- // hopefully a no-op. Comment in CG version says that it exists
- // to work around bugs in Mac focus ring clipping
-}
-
void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing)
{
if (paintingDisabled())
delete m_data;
}
-void GraphicsContext::setFocusRingClip(const IntRect& r)
-{
- // This method only exists to work around bugs in Mac focus ring clipping.
- m_data->m_focusRingClip = r;
-}
-
-void GraphicsContext::clearFocusRingClip()
-{
- // This method only exists to work around bugs in Mac focus ring clipping.
- m_data->m_focusRingClip = IntRect();
-}
-
CGContextRef GraphicsContext::platformContext() const
{
ASSERT(!paintingDisabled());
#endif
CGContextRef m_cgContext;
- IntRect m_focusRingClip; // Work around CG bug in focus ring clipping.
bool m_userToDeviceTransformKnownToBeIdentity;
};
CGPathAddRect(focusRingPath, 0, CGRectInset(rects[i], -offset, -offset));
CGContextRef context = platformContext();
-
- // FIXME: This works only inside a NSView's drawRect method. The view must be
- // focused and this context must be the current NSGraphicsContext.
- ASSERT(context == [[NSGraphicsContext currentContext] graphicsPort]);
- NSView* view = [NSView focusView];
- ASSERT(view);
-
- const NSRect* drawRects;
-#ifdef __LP64__
- long count;
-#else
- int count;
+#ifdef BUILDING_ON_TIGER
+ CGContextBeginTransparencyLayer(context, NULL);
+#endif
+ CGContextBeginPath(context);
+ CGContextAddPath(context, focusRingPath);
+ wkDrawFocusRing(context, colorRef, radius);
+#ifdef BUILDING_ON_TIGER
+ CGContextEndTransparencyLayer(context);
#endif
- [view getRectsBeingDrawn:&drawRects count:&count];
-
- // We have to pass in our own clip rectangles here because a bug in CG
- // seems to inflate the clip (thus allowing the focus ring to paint
- // slightly outside the clip).
- NSRect transformedClipRect = [view convertRect:m_data->m_focusRingClip toView:nil];
- for (int i = 0; i < count; ++i) {
- NSRect transformedRect = [view convertRect:drawRects[i] toView:nil];
- NSRect rectToUse = NSIntersectionRect(transformedRect, transformedClipRect);
- if (!NSIsEmptyRect(rectToUse)) {
- CGContextBeginPath(context);
- CGContextAddPath(context, focusRingPath);
- wkDrawFocusRing(context, *(CGRect *)&rectToUse, colorRef, radius);
- }
- }
-
CGColorRelease(colorRef);
CGPathRelease(focusRingPath);
QStack<TransparencyLayer> layers;
QPainter* redirect;
- IntRect focusRingClip;
TextShadow shadow;
// Only used by SVG for now.
}
}
-void GraphicsContext::setFocusRingClip(const IntRect& rect)
-{
- if (paintingDisabled())
- return;
-
- m_data->focusRingClip = rect;
-}
-
-void GraphicsContext::clearFocusRingClip()
-{
- if (paintingDisabled())
- return;
-
- m_data->focusRingClip = IntRect();
-}
-
void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing)
{
if (paintingDisabled())
#else
wxWindowDC* context;
#endif
- IntRect focusRect;
int mswDCStateID;
wxRegion gtkCurrentClipRgn;
wxRegion gtkPaintClipRgn;
GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate() :
context(0),
- focusRect(IntRect()),
mswDCStateID(0),
gtkCurrentClipRgn(wxRegion()),
gtkPaintClipRgn(wxRegion())
notImplemented();
}
-void GraphicsContext::setFocusRingClip(const IntRect& r)
-{
- m_data->focusRect = r;
-}
-
-void GraphicsContext::clearFocusRingClip()
-{
- m_data->focusRect = IntRect();
-}
-
void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing)
{
if (paintingDisabled())
extern void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
extern void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
extern void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
-extern void (*wkDrawFocusRing)(CGContextRef, CGRect clipRect, CGColorRef, int radius);
+extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
extern BOOL (*wkFontSmoothingModeIsLCD)(int mode);
extern OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
extern CGFontRef (*wkGetCGFontFromNSFont)(NSFont*);
void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
-void (*wkDrawFocusRing)(CGContextRef, CGRect clipRect, CGColorRef, int radius);
+void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
BOOL (*wkFontSmoothingModeIsLCD)(int mode);
OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
CGFontRef (*wkGetCGFontFromNSFont)(NSFont*);
static void setClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)
{
- // Work around bugs in focus ring clipping on Mac.
- p->setFocusRingClip(clipRect);
if (paintDirtyRect == clipRect)
return;
p->save();
static void restoreClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)
{
- // Work around bugs in focus ring clipping on Mac.
- p->clearFocusRingClip();
if (paintDirtyRect == clipRect)
return;
p->restore();
+2007-12-07 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - updated system interface for fixing <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
+
+ * WebKitSystemInterface.h:
+ * libWebKitSystemInterfaceLeopard.a:
+ * libWebKitSystemInterfaceTiger.a:
+
2007-11-27 John Sullivan <sullivan@apple.com>
Fixed 5614525, caused by a recent bug in WKGetExtensionsForMIMEType
void WKDrawCapsLockIndicator(CGContextRef, CGRect);
-void WKDrawFocusRing(CGContextRef context, CGRect clipRect, CGColorRef color, int radius);
- // Ignore the context's clipping.
+void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
// The CG context's current path is the focus ring's path.
// A color of 0 means "use system focus ring color".
// A radius of 0 means "use default focus ring radius".