Changeset 168476 in webkit


Ignore:
Timestamp:
May 8, 2014 10:57:09 AM (10 years ago)
Author:
cabanier@adobe.com
Message:

Add support for drawFocusIfNeeded
https://bugs.webkit.org/show_bug.cgi?id=132584

Reviewed by Dirk Schulze.

Source/WebCore:
The drawFocusIfNeeded API will draw a focus ring if the element that is passed
in is focused and a child element of the canvas.

Test: fast/canvas/draw-focus-if-needed.html

  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::CanvasRenderingContext2D::drawFocusIfNeeded):

  • html/canvas/CanvasRenderingContext2D.h:
  • html/canvas/CanvasRenderingContext2D.idl:

LayoutTests:

  • fast/canvas/draw-focus-if-needed-expected.txt: Added.
  • fast/canvas/draw-focus-if-needed.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r168472 r168476  
     12014-05-08  Rik Cabanier  <cabanier@adobe.com>
     2
     3        Add support for drawFocusIfNeeded
     4        https://bugs.webkit.org/show_bug.cgi?id=132584
     5
     6        Reviewed by Dirk Schulze.
     7
     8        * fast/canvas/draw-focus-if-needed-expected.txt: Added.
     9        * fast/canvas/draw-focus-if-needed.html: Added.
     10
    1112014-05-08  Ion Rosca  <rosca@adobe.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r168473 r168476  
     12014-05-08  Rik Cabanier  <cabanier@adobe.com>
     2
     3        Add support for drawFocusIfNeeded
     4        https://bugs.webkit.org/show_bug.cgi?id=132584
     5
     6        Reviewed by Dirk Schulze.
     7
     8        The drawFocusIfNeeded API will draw a focus ring if the element that is passed
     9        in is focused and a child element of the canvas.
     10
     11        Test: fast/canvas/draw-focus-if-needed.html
     12
     13        * html/canvas/CanvasRenderingContext2D.cpp:
     14        (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded):
     15        * html/canvas/CanvasRenderingContext2D.h:
     16        * html/canvas/CanvasRenderingContext2D.idl:
     17
    1182014-05-08  Antti Koivisto  <antti@apple.com>
    219
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r168457 r168476  
    5151#include "RenderImage.h"
    5252#include "RenderLayer.h"
     53#include "RenderTheme.h"
    5354#include "SecurityOrigin.h"
    5455#include "StrokeStyleApplier.h"
     
    19711972}
    19721973
     1974void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element)
     1975{
     1976    GraphicsContext* context = drawingContext();
     1977
     1978    if (!element || !element->focused() || !state().m_hasInvertibleTransform || m_path.isEmpty()
     1979        || !element->isDescendantOf(canvas()) || !context)
     1980        return;
     1981
     1982    context->drawFocusRing(m_path, 1, 1, RenderTheme::focusRingColor());
     1983}
     1984
    19731985void CanvasRenderingContext2D::putImageData(ImageData* data, ImageBuffer::CoordinateSystem coordinateSystem, float dx, float dy, float dirtyX, float dirtyY,
    19741986                                            float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h

    r167451 r168476  
    197197    void webkitPutImageDataHD(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
    198198
     199    void drawFocusIfNeeded(Element*);
     200
    199201    float webkitBackingStorePixelRatio() const { return canvas()->deviceScaleFactor(); }
    200202
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl

    r168302 r168476  
    178178
    179179    [RaisesException] ImageData webkitGetImageDataHD(float sx, float sy, float sw, float sh);
     180   
     181    // Focus rings
     182    void drawFocusIfNeeded(Element element);
    180183
    181184    readonly attribute float webkitBackingStorePixelRatio;
Note: See TracChangeset for help on using the changeset viewer.