Changeset 79425 in webkit


Ignore:
Timestamp:
Feb 23, 2011 1:30:56 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-02-23 Dominic Mazzoni <dmazzoni@google.com>

Reviewed by Kenneth Russell.

Add a new test to make sure that a canvas can receive click events and
that hit testing is working correctly.

https://bugs.webkit.org/show_bug.cgi?id=54697

  • canvas/canvas-mouse-events-expected.txt: Added.
  • canvas/canvas-mouse-events.html: Added.
  • platform/mac-wk2/Skipped:
  • platform/qt-wk2/Skipped:
  • platform/win-wk2/Skipped:

2011-02-23 Dominic Mazzoni <dmazzoni@google.com>

Reviewed by Kenneth Russell.

Add a hit test handler for canvas elements that handles clicks on the canvas but ignores children.
https://bugs.webkit.org/show_bug.cgi?id=54697

New test to prevent this from regressing in the future: canvas/canvas-mouse-events.html

  • rendering/RenderHTMLCanvas.cpp: (WebCore::RenderHTMLCanvas::nodeAtPoint):
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r79423 r79425  
     12011-02-23  Dominic Mazzoni  <dmazzoni@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Add a new test to make sure that a canvas can receive click events and
     6        that hit testing is working correctly.
     7
     8        https://bugs.webkit.org/show_bug.cgi?id=54697
     9
     10        * canvas/canvas-mouse-events-expected.txt: Added.
     11        * canvas/canvas-mouse-events.html: Added.
     12        * platform/mac-wk2/Skipped:
     13        * platform/qt-wk2/Skipped:
     14        * platform/win-wk2/Skipped:
     15
    1162011-02-23  MORITA Hajime  <morrita@google.com>
    217
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r79239 r79425  
    6161svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-specularExponent-prop.html
    6262svg/dynamic-updates/SVGFESpecularLightingElement-svgdom-suraceScale-prop.html
     63canvas/canvas-mouse-events.html
    6364fast/forms/file-input-hit-test.html
    6465fast/repaint/slider-thumb-drag-release.html
  • trunk/LayoutTests/platform/qt-wk2/Skipped

    r77885 r79425  
    114114svg/dynamic-updates/SVGFEPointLightElement-svgdom-y-prop.html
    115115svg/dynamic-updates/SVGFEPointLightElement-svgdom-z-prop.html
     116canvas/canvas-mouse-events.html
    116117compositing/iframes/layout-on-compositing-change.html
    117118editing/deleting/5390681-2.html
  • trunk/LayoutTests/platform/win-wk2/Skipped

    r76810 r79425  
    5353# WebKitTestRunner needs an implementation of eventSender
    5454# <https://bugs.webkit.org/show_bug.cgi?id=42194>
     55canvas/canvas-mouse-events.html
    5556platform/win/editing/selection/shift-page-up-down.html
    5657platform/win/fast/events/alt-numpad.html
  • trunk/Source/WebCore/ChangeLog

    r79420 r79425  
     12011-02-23  Dominic Mazzoni  <dmazzoni@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Add a hit test handler for canvas elements that handles clicks on the canvas but ignores children.
     6        https://bugs.webkit.org/show_bug.cgi?id=54697
     7
     8        New test to prevent this from regressing in the future: canvas/canvas-mouse-events.html
     9
     10        * rendering/RenderHTMLCanvas.cpp:
     11        (WebCore::RenderHTMLCanvas::nodeAtPoint):
     12
    1132011-02-23  Patrick Gansterer  <paroga@webkit.org>
    214
  • trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp

    r78789 r79425  
    103103}
    104104
    105 bool RenderHTMLCanvas::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction action)
     105bool RenderHTMLCanvas::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int xPos, int yPos, int tx, int ty, HitTestAction action)
    106106{
    107107    UNUSED_PARAM(request);
    108     UNUSED_PARAM(result);
    109     UNUSED_PARAM(x);
    110     UNUSED_PARAM(y);
    111     UNUSED_PARAM(tx);
    112     UNUSED_PARAM(ty);
    113     UNUSED_PARAM(action);
     108    tx += x();
     109    ty += y();
     110
     111    // Ignore children (accessible fallback content that might be focusable but not clickable)
     112    // but do test our own bounds for a hit.
     113    IntRect boundsRect = IntRect(tx, ty, width(), height());
     114    if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectForPoint(xPos, yPos))) {
     115        updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty));
     116        if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect))
     117            return true;
     118    }
     119
    114120    return false;
    115121}
Note: See TracChangeset for help on using the changeset viewer.