Changeset 69766 in webkit


Ignore:
Timestamp:
Oct 14, 2010 8:40:46 AM (13 years ago)
Author:
dbates@webkit.org
Message:

2010-10-14 Daniel Bates <dbates@rim.com>

Reviewed by Darin Adler.

Only draw focus ring in RenderInline and RenderImage if the theme
is not able to draw a focus ring
https://bugs.webkit.org/show_bug.cgi?id=47632

Fixes an issue where RenderInline::paintOutline() and RenderImage::paintFocusRings()
would draw a focus ring regardless of whether the port-specific theme is able to
draw a focus ring. Instead, these methods should only draw a focus ring if the
theme is unable to draw a focus ring.

Also, extracted common focus ring drawing code from RenderObject::paintOutline()
and RenderInline::paintOutline() into RenderObject::paintFocusRing().

Tests: fast/forms/textfield-focus-ring.html

fast/images/imagemap-focus-ring.html
fast/inline/inline-focus-ring.html

  • rendering/RenderImage.cpp: (WebCore::RenderImage::paintFocusRings): Modified to only draw a focus ring if the the theme does not draw one.
  • rendering/RenderInline.cpp: (WebCore::RenderInline::paintOutline): Modified to call RenderObject::paintFocusRing().
  • rendering/RenderObject.cpp:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::paintFocusRing): Added. (WebCore::RenderObject::paintOutline): Modified to call RenderObject::paintFocusRing().
  • rendering/RenderObject.h:

2010-10-14 Daniel Bates <dbates@rim.com>

Reviewed by Darin Adler.

Only draw focus ring in RenderInline and RenderImage if the theme
is not able to draw a focus ring
https://bugs.webkit.org/show_bug.cgi?id=47632

Pixel tests to ensure that we don't regress focus ring drawing for RenderObject
(fast/forms/textfield-focus-ring.html), RenderImage (fast/images/imagemap-focus-ring.html)
and RenderInline (fast/inline/inline-focus-ring.html) on ports that support focus
ring drawing.

  • fast/forms/textfield-focus-ring.html: Added.
  • fast/images/imagemap-focus-ring.html: Added.
  • fast/inline/inline-focus-ring.html: Added.
  • platform/mac/fast/forms/textfield-focus-ring-expected.checksum: Added.
  • platform/mac/fast/forms/textfield-focus-ring-expected.png: Added.
  • platform/mac/fast/forms/textfield-focus-ring-expected.txt: Added.
  • platform/mac/fast/images/imagemap-focus-ring-expected.checksum: Added.
  • platform/mac/fast/images/imagemap-focus-ring-expected.png: Added.
  • platform/mac/fast/images/imagemap-focus-ring-expected.txt: Added.
  • platform/mac/fast/inline/inline-focus-ring-expected.checksum: Added.
  • platform/mac/fast/inline/inline-focus-ring-expected.png: Added.
  • platform/mac/fast/inline/inline-focus-ring-expected.txt: Added.
Location:
trunk
Files:
12 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r69765 r69766  
     12010-10-14  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Only draw focus ring in RenderInline and RenderImage if the theme
     6        is not able to draw a focus ring
     7        https://bugs.webkit.org/show_bug.cgi?id=47632
     8
     9        Pixel tests to ensure that we don't regress focus ring drawing for RenderObject
     10        (fast/forms/textfield-focus-ring.html), RenderImage (fast/images/imagemap-focus-ring.html)
     11        and RenderInline (fast/inline/inline-focus-ring.html) on ports that support focus
     12        ring drawing.
     13
     14        * fast/forms/textfield-focus-ring.html: Added.
     15        * fast/images/imagemap-focus-ring.html: Added.
     16        * fast/inline/inline-focus-ring.html: Added.
     17        * platform/mac/fast/forms/textfield-focus-ring-expected.checksum: Added.
     18        * platform/mac/fast/forms/textfield-focus-ring-expected.png: Added.
     19        * platform/mac/fast/forms/textfield-focus-ring-expected.txt: Added.
     20        * platform/mac/fast/images/imagemap-focus-ring-expected.checksum: Added.
     21        * platform/mac/fast/images/imagemap-focus-ring-expected.png: Added.
     22        * platform/mac/fast/images/imagemap-focus-ring-expected.txt: Added.
     23        * platform/mac/fast/inline/inline-focus-ring-expected.checksum: Added.
     24        * platform/mac/fast/inline/inline-focus-ring-expected.png: Added.
     25        * platform/mac/fast/inline/inline-focus-ring-expected.txt: Added.
     26
    1272010-10-14  Stephen White  <senorblanco@chromium.org>
    228
  • trunk/WebCore/ChangeLog

    r69763 r69766  
     12010-10-14  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Only draw focus ring in RenderInline and RenderImage if the theme
     6        is not able to draw a focus ring
     7        https://bugs.webkit.org/show_bug.cgi?id=47632
     8
     9        Fixes an issue where RenderInline::paintOutline() and RenderImage::paintFocusRings()
     10        would draw a focus ring regardless of whether the port-specific theme is able to
     11        draw a focus ring. Instead, these methods should only draw a focus ring if the
     12        theme is unable to draw a focus ring.
     13
     14        Also, extracted common focus ring drawing code from RenderObject::paintOutline()
     15        and RenderInline::paintOutline() into RenderObject::paintFocusRing().
     16
     17        Tests: fast/forms/textfield-focus-ring.html
     18               fast/images/imagemap-focus-ring.html
     19               fast/inline/inline-focus-ring.html
     20
     21        * rendering/RenderImage.cpp:
     22        (WebCore::RenderImage::paintFocusRings): Modified to only draw a focus ring if the
     23        the theme does not draw one.
     24        * rendering/RenderInline.cpp:
     25        (WebCore::RenderInline::paintOutline): Modified to call RenderObject::paintFocusRing().
     26        * rendering/RenderObject.cpp:
     27        * rendering/RenderObject.cpp:
     28        (WebCore::RenderObject::paintFocusRing): Added.
     29        (WebCore::RenderObject::paintOutline): Modified to call RenderObject::paintFocusRing().
     30        * rendering/RenderObject.h:
     31
    1322010-10-14  Pavel Feldman  <pfeldman@chromium.org>
    233
  • trunk/WebCore/rendering/RenderImage.cpp

    r69423 r69766  
    324324    RefPtr<HTMLCollection> areas = mapElement->areas();
    325325    unsigned numAreas = areas->length();
     326
     327    if (theme()->supportsFocusRing(style))
     328        return; // The theme draws the focus ring.
    326329   
    327330    // FIXME: Clip the paths to the image bounding box.
  • trunk/WebCore/rendering/RenderInline.cpp

    r69220 r69766  
    994994    RenderStyle* styleToUse = style();
    995995    if (styleToUse->outlineStyleIsAuto() || hasOutlineAnnotation()) {
    996         int ow = styleToUse->outlineWidth();
    997         Color oc = styleToUse->visitedDependentColor(CSSPropertyOutlineColor);
    998 
    999         Vector<IntRect> focusRingRects;
    1000         addFocusRingRects(focusRingRects, tx, ty);
    1001         if (styleToUse->outlineStyleIsAuto())
    1002             graphicsContext->drawFocusRing(focusRingRects, ow, styleToUse->outlineOffset(), oc);
    1003         else
    1004             addPDFURLRect(graphicsContext, unionRect(focusRingRects));
     996        if (!theme()->supportsFocusRing(styleToUse)) {
     997            // Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
     998            paintFocusRing(graphicsContext, tx, ty, styleToUse);
     999        }
    10051000    }
    10061001
  • trunk/WebCore/rendering/RenderObject.cpp

    r68911 r69766  
    11521152}
    11531153#endif
     1154   
     1155void RenderObject::paintFocusRing(GraphicsContext* context, int tx, int ty, RenderStyle* style)
     1156{
     1157    Vector<IntRect> focusRingRects;
     1158    addFocusRingRects(focusRingRects, tx, ty);
     1159    if (style->outlineStyleIsAuto())
     1160        context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
     1161    else
     1162        addPDFURLRect(context, unionRect(focusRingRects));
     1163}       
    11541164
    11551165void RenderObject::addPDFURLRect(GraphicsContext* context, const IntRect& rect)
     
    11821192        if (!theme()->supportsFocusRing(styleToUse)) {
    11831193            // Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
    1184             Vector<IntRect> focusRingRects;
    1185             addFocusRingRects(focusRingRects, tx, ty);
    1186             if (styleToUse->outlineStyleIsAuto())
    1187                 graphicsContext->drawFocusRing(focusRingRects, ow, offset, oc);
    1188             else
    1189                 addPDFURLRect(graphicsContext, unionRect(focusRingRects));
     1194            paintFocusRing(graphicsContext, tx, ty, styleToUse);
    11901195        }
    11911196    }
  • trunk/WebCore/rendering/RenderObject.h

    r69642 r69766  
    752752    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
    753753
     754    void paintFocusRing(GraphicsContext*, int tx, int ty, RenderStyle*);
    754755    void paintOutline(GraphicsContext*, int tx, int ty, int w, int h);
    755756    void addPDFURLRect(GraphicsContext*, const IntRect&);
Note: See TracChangeset for help on using the changeset viewer.