Changeset 73490 in webkit


Ignore:
Timestamp:
Dec 7, 2010 8:49:57 PM (13 years ago)
Author:
dbates@webkit.org
Message:

2010-12-07 Daniel Bates <dbates@rim.com>

Reviewed by Martin Robinson.

Implement focus ring support for image maps
https://bugs.webkit.org/show_bug.cgi?id=50371

Implement GraphicsContext::drawFocusRing(const Path&, ...) so as to support
drawing a focus ring for image maps.

Tests: fast/images/imagemap-circle-focus-ring.html

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

  • platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::adjustFocusRingColor): Added. (WebCore::adjustFocusRingLineWidth): Added. (WebCore::focusRingStrokeStyle): Added. (WebCore::GraphicsContext::drawFocusRing): Moved code for determining focus ring- color, line width and stroke style into functions adjustFocusRingColor(), adjustFocusRingLineWidth(), and focusRingStrokeStyle(), respectively. Implemented GraphicsContext::drawFocusRing(const Path&, ...).

2010-12-07 Daniel Bates <dbates@rim.com>

Reviewed by Martin Robinson.

Implement focus ring support for image maps
https://bugs.webkit.org/show_bug.cgi?id=50371

Tests to ensure that we support drawing a focus ring for an image map.
In particular, that the GTK port can draw a focus ring for an image map.

  • fast/images/imagemap-circle-focus-ring.html: Added.
  • fast/images/imagemap-polygon-focus-ring.html: Added.
  • platform/gtk/fast/images/imagemap-circle-focus-ring-expected.checksum: Added.
  • platform/gtk/fast/images/imagemap-circle-focus-ring-expected.png: Added.
  • platform/gtk/fast/images/imagemap-circle-focus-ring-expected.txt: Added.
  • platform/gtk/fast/images/imagemap-focus-ring-expected.checksum: Rebase result since we now support drawing a focus ring for imagemaps.
  • platform/gtk/fast/images/imagemap-focus-ring-expected.png: Ditto.
  • platform/gtk/fast/images/imagemap-focus-ring-outline-color-expected.checksum: Added.
  • platform/gtk/fast/images/imagemap-focus-ring-outline-color-expected.png: Added.
  • platform/gtk/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.checksum: Added.
  • platform/gtk/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.png: Added.
  • platform/gtk/fast/images/imagemap-focus-ring-zoom-expected.checksum: Added.
  • platform/gtk/fast/images/imagemap-focus-ring-zoom-expected.png: Added.
  • platform/gtk/fast/images/imagemap-polygon-focus-ring-expected.checksum: Added.
  • platform/gtk/fast/images/imagemap-polygon-focus-ring-expected.png: Added.
  • platform/gtk/fast/images/imagemap-polygon-focus-ring-expected.txt: Added.
  • platform/mac/fast/images/imagemap-circle-focus-ring-expected.checksum: Added.
  • platform/mac/fast/images/imagemap-circle-focus-ring-expected.png: Added.
  • platform/mac/fast/images/imagemap-circle-focus-ring-expected.txt: Added.
  • platform/mac/fast/images/imagemap-polygon-focus-ring-expected.checksum: Added.
  • platform/mac/fast/images/imagemap-polygon-focus-ring-expected.png: Added.
  • platform/mac/fast/images/imagemap-polygon-focus-ring-expected.txt: Added.
Location:
trunk
Files:
20 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r73488 r73490  
     12010-12-07  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        Implement focus ring support for image maps
     6        https://bugs.webkit.org/show_bug.cgi?id=50371
     7
     8        Tests to ensure that we support drawing a focus ring for an image map.
     9        In particular, that the GTK port can draw a focus ring for an image map.
     10
     11        * fast/images/imagemap-circle-focus-ring.html: Added.
     12        * fast/images/imagemap-polygon-focus-ring.html: Added.
     13        * platform/gtk/fast/images/imagemap-circle-focus-ring-expected.checksum: Added.
     14        * platform/gtk/fast/images/imagemap-circle-focus-ring-expected.png: Added.
     15        * platform/gtk/fast/images/imagemap-circle-focus-ring-expected.txt: Added.
     16        * platform/gtk/fast/images/imagemap-focus-ring-expected.checksum: Rebase result since we
     17        now support drawing a focus ring for imagemaps.
     18        * platform/gtk/fast/images/imagemap-focus-ring-expected.png: Ditto.
     19        * platform/gtk/fast/images/imagemap-focus-ring-outline-color-expected.checksum: Added.
     20        * platform/gtk/fast/images/imagemap-focus-ring-outline-color-expected.png: Added.
     21        * platform/gtk/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.checksum: Added.
     22        * platform/gtk/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.png: Added.
     23        * platform/gtk/fast/images/imagemap-focus-ring-zoom-expected.checksum: Added.
     24        * platform/gtk/fast/images/imagemap-focus-ring-zoom-expected.png: Added.
     25        * platform/gtk/fast/images/imagemap-polygon-focus-ring-expected.checksum: Added.
     26        * platform/gtk/fast/images/imagemap-polygon-focus-ring-expected.png: Added.
     27        * platform/gtk/fast/images/imagemap-polygon-focus-ring-expected.txt: Added.
     28        * platform/mac/fast/images/imagemap-circle-focus-ring-expected.checksum: Added.
     29        * platform/mac/fast/images/imagemap-circle-focus-ring-expected.png: Added.
     30        * platform/mac/fast/images/imagemap-circle-focus-ring-expected.txt: Added.
     31        * platform/mac/fast/images/imagemap-polygon-focus-ring-expected.checksum: Added.
     32        * platform/mac/fast/images/imagemap-polygon-focus-ring-expected.png: Added.
     33        * platform/mac/fast/images/imagemap-polygon-focus-ring-expected.txt: Added.
     34
    1352010-12-05  MORITA Hajime  <morrita@google.com>
    236
  • trunk/LayoutTests/platform/gtk/fast/images/imagemap-focus-ring-expected.checksum

    r69780 r73490  
    1 99fc414fc664384b68bde8eeefdcce6e
     19e87ee1592b997fd991e7f92f9059b5b
  • trunk/WebCore/ChangeLog

    r73489 r73490  
     12010-12-07  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        Implement focus ring support for image maps
     6        https://bugs.webkit.org/show_bug.cgi?id=50371
     7
     8        Implement GraphicsContext::drawFocusRing(const Path&, ...) so as to support
     9        drawing a focus ring for image maps.
     10
     11        Tests: fast/images/imagemap-circle-focus-ring.html
     12               fast/images/imagemap-polygon-focus-ring.html
     13
     14        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     15        (WebCore::adjustFocusRingColor): Added.
     16        (WebCore::adjustFocusRingLineWidth): Added.
     17        (WebCore::focusRingStrokeStyle): Added.
     18        (WebCore::GraphicsContext::drawFocusRing): Moved code for determining focus ring- color,
     19        line width and stroke style into functions adjustFocusRingColor(), adjustFocusRingLineWidth(),
     20        and focusRingStrokeStyle(), respectively. Implemented GraphicsContext::drawFocusRing(const Path&, ...).
     21
    1222010-12-07  Sergio Villar Senin  <svillar@igalia.com>
    223
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r73369 r73490  
    66 * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org>
    77 * Copyright (C) 2010 Igalia S.L.
     8 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
    89 *
    910 * Redistribution and use in source and binary forms, with or without
     
    594595}
    595596
    596 void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
    597 {
    598     // FIXME: implement
     597static inline void adjustFocusRingColor(Color& color)
     598{
     599#if !PLATFORM(GTK)
     600    // Force the alpha to 50%.  This matches what the Mac does with outline rings.
     601    color.setRGB(makeRGBA(color.red(), color.green(), color.blue(), 127));
     602#endif
     603}
     604
     605static inline void adjustFocusRingLineWidth(int& width)
     606{
     607#if PLATFORM(GTK)
     608    width = 2;
     609#endif
     610}
     611
     612static inline StrokeStyle focusRingStrokeStyle()
     613{
     614#if PLATFORM(GTK)
     615    return DottedStroke;
     616#else
     617    return SolidStroke;
     618#endif
     619}
     620
     621void GraphicsContext::drawFocusRing(const Path& path, int width, int /* offset */, const Color& color)
     622{
     623    // FIXME: We should draw paths that describe a rectangle with rounded corners
     624    // so as to be consistent with how we draw rectangular focus rings.
     625    Color ringColor = color;
     626    adjustFocusRingColor(ringColor);
     627    adjustFocusRingLineWidth(width);
     628
     629    cairo_t* cr = m_data->cr;
     630    cairo_save(cr);
     631    appendWebCorePathToCairoContext(cr, path);
     632    setSourceRGBAFromColor(cr, ringColor);
     633    cairo_set_line_width(cr, width);
     634    setPlatformStrokeStyle(focusRingStrokeStyle());
     635    cairo_stroke(cr);
     636    cairo_restore(cr);
    599637}
    600638
     
    633671    cairo_region_destroy(reg);
    634672#endif
    635 
    636     setSourceRGBAFromColor(cr, color);
    637     cairo_set_line_width(cr, 2.0f);
    638     setPlatformStrokeStyle(DottedStroke);
    639673#else
    640674    int radius = (width - 1) / 2;
     
    646680        appendWebCorePathToCairoContext(cr, path);
    647681    }
    648 
    649     // Force the alpha to 50%.  This matches what the Mac does with outline rings.
    650     Color ringColor(color.red(), color.green(), color.blue(), 127);
     682#endif
     683    Color ringColor = color;
     684    adjustFocusRingColor(ringColor);
     685    adjustFocusRingLineWidth(width);
    651686    setSourceRGBAFromColor(cr, ringColor);
    652687    cairo_set_line_width(cr, width);
    653     setPlatformStrokeStyle(SolidStroke);
    654 #endif
     688    setPlatformStrokeStyle(focusRingStrokeStyle());
    655689
    656690    cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
Note: See TracChangeset for help on using the changeset viewer.