Changeset 28523 in webkit


Ignore:
Timestamp:
Dec 7, 2007 11:24:19 AM (16 years ago)
Author:
mitz@apple.com
Message:

WebCore:

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.
Location:
trunk
Files:
4 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r28519 r28523  
     12007-12-07  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        - repaint test for <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
     6
     7        * fast/repaint/focus-ring.html: Added.
     8        * platform/mac/fast/repaint/focus-ring-expected.checksum: Added.
     9        * platform/mac/fast/repaint/focus-ring-expected.png: Added.
     10        * platform/mac/fast/repaint/focus-ring-expected.txt: Added.
     11
    1122007-12-07  Dan Bernstein  <mitz@apple.com>
    213
  • trunk/WebCore/ChangeLog

    r28521 r28523  
     12007-12-07  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        - WebCore part of fixing <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
     6
     7        Test: fast/repaint/focus-ring.html
     8
     9        * editing/SelectionController.cpp:
     10        (WebCore::SelectionController::caretRepaintRect): Changed to return just
     11        the caret rect without any padding.
     12        (WebCore::SelectionController::recomputeCaretRect): Changed to repaint
     13        just the caret rect without any padding.
     14        * platform/graphics/GraphicsContext.h: Removed setFocusRingClip() and
     15        clearFocusRingClip().
     16        * platform/graphics/cairo/GraphicsContextCairo.cpp: Ditto.
     17        * platform/graphics/cg/GraphicsContextCG.cpp: Ditto.
     18        * platform/graphics/cg/GraphicsContextPlatformPrivate.h: Removed
     19        m_focusRingClip member.
     20        * platform/graphics/mac/GraphicsContextMac.mm:
     21        (WebCore::GraphicsContext::drawFocusRing): Changed to call
     22        wkDrawFocusRing() once without setting up additional clip. On Leopard,
     23        wkDrawFocusRing() respects the context clip now. On Tiger, a
     24        transparency layer is used to apply clipping to the focus ring.
     25        * platform/graphics/qt/GraphicsContextQt.cpp: Removed focus ring clip
     26        methods and member.
     27        * platform/graphics/wx/GraphicsContextWx.cpp: Ditto.
     28        * platform/mac/WebCoreSystemInterface.h: Removed the clipRect argument
     29        to wkDrawFocusRing().
     30        * platform/mac/WebCoreSystemInterface.mm: Ditto.
     31        * rendering/RenderLayer.cpp:
     32        (WebCore::setClip): Removed call to set the focus ring clip.
     33        (WebCore::restoreClip): Removed call to reset the focus ring clip.
     34
    1352007-12-07  Darin Adler  <darin@apple.com>
    236
  • trunk/WebCore/editing/SelectionController.cpp

    r27818 r28523  
    705705}
    706706
    707 static IntRect repaintRectForCaret(IntRect caret)
    708 {
    709     if (caret.isEmpty())
    710         return IntRect();
    711     caret.inflate(1);
    712     return caret;
    713 }
    714 
    715707IntRect SelectionController::caretRepaintRect() const
    716708{
    717     return repaintRectForCaret(caretRect());
     709    return caretRect();
    718710}
    719711
     
    736728        return false;
    737729
    738     v->updateContents(repaintRectForCaret(oldRect), false);
    739     v->updateContents(repaintRectForCaret(newRect), false);
     730    v->updateContents(oldRect, false);
     731    v->updateContents(newRect, false);
    740732    return true;
    741733}
  • trunk/WebCore/platform/graphics/GraphicsContext.h

    r28298 r28523  
    165165        void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
    166166
    167         // Functions to work around bugs in focus ring clipping on Mac.
    168         void setFocusRingClip(const IntRect&);
    169         void clearFocusRingClip();
    170 
    171167        int textDrawingMode();
    172168        void setTextDrawingMode(int);
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r27905 r28523  
    440440    cairo_stroke(cr);
    441441    cairo_restore(cr);
    442 }
    443 
    444 void GraphicsContext::setFocusRingClip(const IntRect&)
    445 {
    446     // hopefully a no-op. Comment in CG version says that it exists
    447     // to work around bugs in Mac focus ring clipping
    448 }
    449 
    450 void GraphicsContext::clearFocusRingClip()
    451 {
    452     // hopefully a no-op. Comment in CG version says that it exists
    453     // to work around bugs in Mac focus ring clipping
    454442}
    455443
  • trunk/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r27700 r28523  
    7373}
    7474
    75 void GraphicsContext::setFocusRingClip(const IntRect& r)
    76 {
    77     // This method only exists to work around bugs in Mac focus ring clipping.
    78     m_data->m_focusRingClip = r;
    79 }
    80 
    81 void GraphicsContext::clearFocusRingClip()
    82 {
    83     // This method only exists to work around bugs in Mac focus ring clipping.
    84     m_data->m_focusRingClip = IntRect();
    85 }
    86 
    8775CGContextRef GraphicsContext::platformContext() const
    8876{
  • trunk/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivate.h

    r27700 r28523  
    8080
    8181    CGContextRef m_cgContext;
    82     IntRect m_focusRingClip; // Work around CG bug in focus ring clipping.
    8382    bool m_userToDeviceTransformKnownToBeIdentity;
    8483};
  • trunk/WebCore/platform/graphics/mac/GraphicsContextMac.mm

    r27060 r28523  
    5656
    5757    CGContextRef context = platformContext();
    58 
    59     // FIXME: This works only inside a NSView's drawRect method. The view must be
    60     // focused and this context must be the current NSGraphicsContext.
    61     ASSERT(context == [[NSGraphicsContext currentContext] graphicsPort]);
    62     NSView* view = [NSView focusView];
    63     ASSERT(view);
    64 
    65     const NSRect* drawRects;
    66 #ifdef __LP64__
    67     long count;
    68 #else
    69     int count;
     58#ifdef BUILDING_ON_TIGER
     59    CGContextBeginTransparencyLayer(context, NULL);
    7060#endif
    71     [view getRectsBeingDrawn:&drawRects count:&count];
    72 
    73     // We have to pass in our own clip rectangles here because a bug in CG
    74     // seems to inflate the clip (thus allowing the focus ring to paint
    75     // slightly outside the clip).
    76     NSRect transformedClipRect = [view convertRect:m_data->m_focusRingClip toView:nil];
    77     for (int i = 0; i < count; ++i) {
    78         NSRect transformedRect = [view convertRect:drawRects[i] toView:nil];
    79         NSRect rectToUse = NSIntersectionRect(transformedRect, transformedClipRect);
    80         if (!NSIsEmptyRect(rectToUse)) {
    81             CGContextBeginPath(context);
    82             CGContextAddPath(context, focusRingPath);
    83             wkDrawFocusRing(context, *(CGRect *)&rectToUse, colorRef, radius);
    84         }
    85     }
    86 
     61    CGContextBeginPath(context);
     62    CGContextAddPath(context, focusRingPath);
     63    wkDrawFocusRing(context, colorRef, radius);
     64#ifdef BUILDING_ON_TIGER
     65    CGContextEndTransparencyLayer(context);
     66#endif
    8767    CGColorRelease(colorRef);
    8868
  • trunk/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r28352 r28523  
    217217    QPainter* redirect;
    218218
    219     IntRect focusRingClip;
    220219    TextShadow shadow;
    221220
     
    567566}
    568567
    569 void GraphicsContext::setFocusRingClip(const IntRect& rect)
    570 {
    571     if (paintingDisabled())
    572         return;
    573 
    574     m_data->focusRingClip = rect;
    575 }
    576 
    577 void GraphicsContext::clearFocusRingClip()
    578 {
    579     if (paintingDisabled())
    580         return;
    581 
    582     m_data->focusRingClip = IntRect();
    583 }
    584 
    585568void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing)
    586569{
  • trunk/WebCore/platform/graphics/wx/GraphicsContextWx.cpp

    r27469 r28523  
    9494    wxWindowDC* context;
    9595#endif
    96     IntRect focusRect;
    9796    int mswDCStateID;
    9897    wxRegion gtkCurrentClipRgn;
     
    102101GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate() :
    103102    context(0),
    104     focusRect(IntRect()),
    105103    mswDCStateID(0),
    106104    gtkCurrentClipRgn(wxRegion()),
     
    330328}
    331329
    332 void GraphicsContext::setFocusRingClip(const IntRect& r)
    333 {
    334     m_data->focusRect = r;
    335 }
    336 
    337 void GraphicsContext::clearFocusRingClip()
    338 {
    339     m_data->focusRect = IntRect();
    340 }
    341 
    342330void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing)
    343331{
  • trunk/WebCore/platform/mac/WebCoreSystemInterface.h

    r27384 r28523  
    9191extern void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
    9292extern void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
    93 extern void (*wkDrawFocusRing)(CGContextRef, CGRect clipRect, CGColorRef, int radius);
     93extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
    9494extern BOOL (*wkFontSmoothingModeIsLCD)(int mode);
    9595extern OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
  • trunk/WebCore/platform/mac/WebCoreSystemInterface.mm

    r27384 r28523  
    3636void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
    3737void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
    38 void (*wkDrawFocusRing)(CGContextRef, CGRect clipRect, CGColorRef, int radius);
     38void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
    3939BOOL (*wkFontSmoothingModeIsLCD)(int mode);
    4040OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
  • trunk/WebCore/rendering/RenderLayer.cpp

    r27951 r28523  
    14401440static void setClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)
    14411441{
    1442     // Work around bugs in focus ring clipping on Mac.
    1443     p->setFocusRingClip(clipRect);
    14441442    if (paintDirtyRect == clipRect)
    14451443        return;
     
    14501448static void restoreClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)
    14511449{
    1452     // Work around bugs in focus ring clipping on Mac.
    1453     p->clearFocusRingClip();
    14541450    if (paintDirtyRect == clipRect)
    14551451        return;
  • trunk/WebKitLibraries/ChangeLog

    r28072 r28523  
     12007-12-07  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        - updated system interface for fixing <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
     6
     7        * WebKitSystemInterface.h:
     8        * libWebKitSystemInterfaceLeopard.a:
     9        * libWebKitSystemInterfaceTiger.a:
     10
    1112007-11-27  John Sullivan  <sullivan@apple.com>
    212
  • trunk/WebKitLibraries/WebKitSystemInterface.h

    r28039 r28523  
    9696void WKDrawCapsLockIndicator(CGContextRef, CGRect);
    9797
    98 void WKDrawFocusRing(CGContextRef context, CGRect clipRect, CGColorRef color, int radius);
    99     // Ignore the context's clipping.
     98void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
    10099    // The CG context's current path is the focus ring's path.
    101100    // A color of 0 means "use system focus ring color".
Note: See TracChangeset for help on using the changeset viewer.