Changeset 134803 in webkit


Ignore:
Timestamp:
Nov 15, 2012 11:15:17 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

No tests for changing mouse cursors
https://bugs.webkit.org/show_bug.cgi?id=100550

Patch by Rick Byers <rbyers@chromium.org> on 2012-11-15
Reviewed by Brent Fulgham.

.:

Add necessary exports for Internals::getCurrentCursorInfo

  • Source/autotools/symbols.filter:

Source/WebCore:

Add infrastructure to keep track of the last set mouse cursor,
and then to query it from DumpRenderTree. Also adds ASSERTs to help ensure
we can reliably detect when an uninitialized Cursor object is used (such as
the one that can be returned from OptionalCursor in the NoCursorChange scenario).

Test: fast/events/mouse-cursor.html

  • WebCore.exp.in: Add Cursor copy ctor export
  • page/EventHandler.cpp:

(WebCore::OptionalCursor::cursor):
(WebCore::EventHandler::handleMouseMoveEvent): Keep track of last set mouse cursor

  • page/EventHandler.h:

(WebCore::EventHandler::currentMouseCursor): New getter for last set mouse cursor

  • platform/Cursor.h:

(WebCore::Cursor::Cursor): Mark uninitialized cursor types as invalid.
(WebCore::Cursor::type): Assert cursor type is valid.

  • testing/Internals.cpp:

(WebCore::cursorTypeToString): Helper to convert cursor type to enum
(WebCore):
(WebCore::Internals::getCurrentCursorInfo): New function to return a string describing the last set mouse cursor

  • testing/Internals.h: Declare getCurrentCursorInfo
  • testing/Internals.idl: Declare getCurrentCursorInfo

Source/WebKit2:

Add necessary exports for Internals::getCurrentCursorInfo

  • win/WebKit2.def:
  • win/WebKit2CFLite.def:

LayoutTests:

Add a simple test covering the basic scenarios of changing a mouse
cursor with CSS. This includes most of the cases currently covered
by ManualTests/*cursor*.

  • fast/events/mouse-cursor-expected.txt: Added.
  • fast/events/mouse-cursor.html: Added.
Location:
trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r134753 r134803  
     12012-11-15  Rick Byers  <rbyers@chromium.org>
     2
     3        No tests for changing mouse cursors
     4        https://bugs.webkit.org/show_bug.cgi?id=100550
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Add necessary exports for Internals::getCurrentCursorInfo
     9
     10        * Source/autotools/symbols.filter:
     11
    1122012-11-15  Kent Tamura  <tkent@chromium.org>
    213
  • trunk/LayoutTests/ChangeLog

    r134802 r134803  
     12012-11-15  Rick Byers  <rbyers@chromium.org>
     2
     3        No tests for changing mouse cursors
     4        https://bugs.webkit.org/show_bug.cgi?id=100550
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Add a simple test covering the basic scenarios of changing a mouse
     9        cursor with CSS.  This includes most of the cases currently covered
     10        by ManualTests/*cursor*.
     11
     12        * fast/events/mouse-cursor-expected.txt: Added.
     13        * fast/events/mouse-cursor.html: Added.
     14
    1152012-11-13  Jer Noble  <jer.noble@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r134802 r134803  
     12012-11-15  Rick Byers  <rbyers@chromium.org>
     2
     3        No tests for changing mouse cursors
     4        https://bugs.webkit.org/show_bug.cgi?id=100550
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Add infrastructure to keep track of the last set mouse cursor,
     9        and then to query it from DumpRenderTree.  Also adds ASSERTs to help ensure
     10        we can reliably detect when an uninitialized Cursor object is used (such as
     11        the one that can be returned from OptionalCursor in the NoCursorChange scenario).
     12
     13        Test: fast/events/mouse-cursor.html
     14
     15        * WebCore.exp.in: Add Cursor copy ctor export
     16        * page/EventHandler.cpp:
     17        (WebCore::OptionalCursor::cursor):
     18        (WebCore::EventHandler::handleMouseMoveEvent): Keep track of last set mouse cursor
     19        * page/EventHandler.h:
     20        (WebCore::EventHandler::currentMouseCursor): New getter for last set mouse cursor
     21        * platform/Cursor.h:
     22        (WebCore::Cursor::Cursor): Mark uninitialized cursor types as invalid.
     23        (WebCore::Cursor::type): Assert cursor type is valid.
     24        * testing/Internals.cpp:
     25        (WebCore::cursorTypeToString): Helper to convert cursor type to enum
     26        (WebCore):
     27        (WebCore::Internals::getCurrentCursorInfo): New function to return a string describing the last set mouse cursor
     28        * testing/Internals.h: Declare getCurrentCursorInfo
     29        * testing/Internals.idl: Declare getCurrentCursorInfo
     30
    1312012-11-13  Jer Noble  <jer.noble@apple.com>
    232
  • trunk/Source/WebCore/WebCore.exp.in

    r134747 r134803  
    17121712__ZN7WebCore6Cursor8fromTypeENS0_4TypeE
    17131713__ZN7WebCore6CursorC1EPNS_5ImageERKNS_8IntPointE
     1714__ZN7WebCore6CursorC1ERKS0_
    17141715__ZN7WebCore6CursorD1Ev
    17151716__ZN7WebCore6CursoraSERKS0_
  • trunk/Source/WebCore/page/EventHandler.cpp

    r134253 r134803  
    157157
    158158    bool isCursorChange() const { return m_isCursorChange; }
    159     const Cursor& cursor() const { return m_cursor; }
     159    const Cursor& cursor() const { ASSERT(m_isCursorChange); return m_cursor; }
    160160
    161161private:
     
    15391539    return pointerCursor();
    15401540}
    1541    
     1541
    15421542static LayoutPoint documentPointForWindowPoint(Frame* frame, const IntPoint& windowPoint)
    15431543{
     
    18741874        if (FrameView* view = m_frame->view()) {
    18751875            OptionalCursor optionalCursor = selectCursor(mev, scrollbar);
    1876             if (optionalCursor.isCursorChange())
    1877                 view->setCursor(optionalCursor.cursor());
     1876            if (optionalCursor.isCursorChange()) {
     1877                m_currentMouseCursor = optionalCursor.cursor();
     1878                view->setCursor(m_currentMouseCursor);
     1879            }
    18781880        }
    18791881    }
  • trunk/Source/WebCore/page/EventHandler.h

    r134183 r134803  
    2727#define EventHandler_h
    2828
     29#include "Cursor.h"
    2930#include "DragActions.h"
    3031#include "DragState.h"
     
    142143
    143144    IntPoint currentMousePosition() const;
     145    Cursor currentMouseCursor() const { return m_currentMouseCursor; }
    144146
    145147    static Frame* subframeForTargetNode(Node*);
     
    421423    RefPtr<Frame> m_lastMouseMoveEventSubframe;
    422424    RefPtr<Scrollbar> m_lastScrollbarUnderMouse;
     425    Cursor m_currentMouseCursor;
    423426
    424427    int m_clickCount;
  • trunk/Source/WebCore/platform/Cursor.h

    r134149 r134803  
    2929#include "Image.h"
    3030#include "IntPoint.h"
     31#include <wtf/Assertions.h>
    3132#include <wtf/RefPtr.h>
    3233
     
    100101    public:
    101102        enum Type {
    102             Pointer,
     103            Pointer = 0,
    103104            Cross,
    104105            Hand,
     
    150151        Cursor()
    151152#if !PLATFORM(IOS) && !PLATFORM(BLACKBERRY)
     153#if USE(LAZY_NATIVE_CURSOR)
     154            // This is an invalid Cursor and should never actually get used.
     155            : m_type(static_cast<Type>(-1))
     156            , m_platformCursor(0)
     157#else
    152158            : m_platformCursor(0)
    153 #endif
     159#endif // USE(LAZY_NATIVE_CURSOR)
     160#endif // !PLATFORM(IOS) && !PLATFORM(BLACKBERRY)
    154161        {
    155162        }
     
    163170#if USE(LAZY_NATIVE_CURSOR)
    164171        explicit Cursor(Type);
    165         Type type() const { return m_type; }
     172        Type type() const
     173        {
     174            ASSERT(m_type >= 0 && m_type <= Custom);
     175            return m_type;
     176        }
    166177        Image* image() const { return m_image.get(); }
    167178        const IntPoint& hotSpot() const { return m_hotSpot; }
  • trunk/Source/WebCore/testing/Internals.cpp

    r134747 r134803  
    3232#include "ClientRectList.h"
    3333#include "ComposedShadowTreeWalker.h"
     34#include "Cursor.h"
    3435#include "DOMStringList.h"
    3536#include "DOMWindow.h"
     
    3940#include "Element.h"
    4041#include "ElementShadow.h"
     42#include "EventHandler.h"
    4143#include "ExceptionCode.h"
    4244#include "FormController.h"
     
    7678#include "TreeScope.h"
    7779#include "ViewportArguments.h"
     80#include <wtf/text/StringBuffer.h>
     81
    7882
    7983#if ENABLE(INPUT_TYPE_COLOR)
     
    9599
    96100#if ENABLE(TOUCH_ADJUSTMENT)
    97 #include "EventHandler.h"
    98101#include "WebKitPoint.h"
    99102#endif
     
    15401543}
    15411544
    1542 }
     1545#if USE(LAZY_NATIVE_CURSOR)
     1546static const char* cursorTypeToString(Cursor::Type cursorType)
     1547{
     1548    switch (cursorType) {
     1549    case Cursor::Pointer: return "Pointer";
     1550    case Cursor::Cross: return "Cross";
     1551    case Cursor::Hand: return "Hand";
     1552    case Cursor::IBeam: return "IBeam";
     1553    case Cursor::Wait: return "Wait";
     1554    case Cursor::Help: return "Help";
     1555    case Cursor::EastResize: return "EastResize";
     1556    case Cursor::NorthResize: return "NorthResize";
     1557    case Cursor::NorthEastResize: return "NorthEastResize";
     1558    case Cursor::NorthWestResize: return "NorthWestResize";
     1559    case Cursor::SouthResize: return "SouthResize";
     1560    case Cursor::SouthEastResize: return "SouthEastResize";
     1561    case Cursor::SouthWestResize: return "SouthWestResize";
     1562    case Cursor::WestResize: return "WestResize";
     1563    case Cursor::NorthSouthResize: return "NorthSouthResize";
     1564    case Cursor::EastWestResize: return "EastWestResize";
     1565    case Cursor::NorthEastSouthWestResize: return "NorthEastSouthWestResize";
     1566    case Cursor::NorthWestSouthEastResize: return "NorthWestSouthEastResize";
     1567    case Cursor::ColumnResize: return "ColumnResize";
     1568    case Cursor::RowResize: return "RowResize";
     1569    case Cursor::MiddlePanning: return "MiddlePanning";
     1570    case Cursor::EastPanning: return "EastPanning";
     1571    case Cursor::NorthPanning: return "NorthPanning";
     1572    case Cursor::NorthEastPanning: return "NorthEastPanning";
     1573    case Cursor::NorthWestPanning: return "NorthWestPanning";
     1574    case Cursor::SouthPanning: return "SouthPanning";
     1575    case Cursor::SouthEastPanning: return "SouthEastPanning";
     1576    case Cursor::SouthWestPanning: return "SouthWestPanning";
     1577    case Cursor::WestPanning: return "WestPanning";
     1578    case Cursor::Move: return "Move";
     1579    case Cursor::VerticalText: return "VerticalText";
     1580    case Cursor::Cell: return "Cell";
     1581    case Cursor::ContextMenu: return "ContextMenu";
     1582    case Cursor::Alias: return "Alias";
     1583    case Cursor::Progress: return "Progress";
     1584    case Cursor::NoDrop: return "NoDrop";
     1585    case Cursor::Copy: return "Copy";
     1586    case Cursor::None: return "None";
     1587    case Cursor::NotAllowed: return "NotAllowed";
     1588    case Cursor::ZoomIn: return "ZoomIn";
     1589    case Cursor::ZoomOut: return "ZoomOut";
     1590    case Cursor::Grab: return "Grab";
     1591    case Cursor::Grabbing: return "Grabbing";
     1592    case Cursor::Custom: return "Custom";
     1593    }
     1594
     1595    ASSERT_NOT_REACHED();
     1596    return "UNKNOWN";
     1597}
     1598#endif
     1599
     1600String Internals::getCurrentCursorInfo(Document* document, ExceptionCode& ec)
     1601{
     1602    if (!document || !document->frame()) {
     1603        ec = INVALID_ACCESS_ERR;
     1604        return String();
     1605    }
     1606
     1607    Cursor cursor = document->frame()->eventHandler()->currentMouseCursor();
     1608
     1609#if USE(LAZY_NATIVE_CURSOR)
     1610    StringBuilder result;
     1611    result.append("type=");
     1612    result.append(cursorTypeToString(cursor.type()));
     1613    result.append(" hotSpot=");
     1614    result.appendNumber(cursor.hotSpot().x());
     1615    result.append(",");
     1616    result.appendNumber(cursor.hotSpot().y());
     1617    if (cursor.image()) {
     1618        IntSize size = cursor.image()->size();
     1619        result.append(" image=");
     1620        result.appendNumber(size.width());
     1621        result.append("x");
     1622        result.appendNumber(size.height());
     1623    }
     1624    return result.toString();
     1625#else
     1626    return "FAIL: Cursor details not available on this platform.";
     1627#endif
     1628}
     1629
     1630}
  • trunk/Source/WebCore/testing/Internals.h

    r134747 r134803  
    247247    void stopTrackingRepaints(Document*, ExceptionCode&);
    248248
     249    String getCurrentCursorInfo(Document*, ExceptionCode&);
     250
    249251private:
    250252    explicit Internals(Document*);
  • trunk/Source/WebCore/testing/Internals.idl

    r134747 r134803  
    215215    void startTrackingRepaints(in Document document) raises (DOMException);
    216216    void stopTrackingRepaints(in Document document) raises (DOMException);
     217
     218    // Returns a string with information about the mouse cursor used at the specified client location.
     219    DOMString getCurrentCursorInfo(in Document document) raises (DOMException);
    217220};
  • trunk/Source/WebKit2/ChangeLog

    r134801 r134803  
     12012-11-15  Rick Byers  <rbyers@chromium.org>
     2
     3        No tests for changing mouse cursors
     4        https://bugs.webkit.org/show_bug.cgi?id=100550
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Add necessary exports for Internals::getCurrentCursorInfo
     9
     10        * win/WebKit2.def:
     11        * win/WebKit2CFLite.def:
     12
    1132012-11-15  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    214
  • trunk/Source/WebKit2/win/WebKit2.def

    r134747 r134803  
    154154        ??0ClientRectList@WebCore@@AAE@ABV?$Vector@VFloatQuad@WebCore@@$0A@@WTF@@@Z
    155155        ??1ClientRectList@WebCore@@QAE@XZ
     156        ??1Cursor@WebCore@@QAE@XZ
     157        ??0Cursor@WebCore@@QAE@ABV01@@Z
    156158        ??0String@WTF@@QAE@PBD@Z
    157159        ??0String@WTF@@QAE@PB_W@Z
  • trunk/Source/WebKit2/win/WebKit2CFLite.def

    r134747 r134803  
    147147        ??0ClientRectList@WebCore@@AAE@ABV?$Vector@VFloatQuad@WebCore@@$0A@@WTF@@@Z
    148148        ??1ClientRectList@WebCore@@QAE@XZ
     149        ??1Cursor@WebCore@@QAE@XZ
     150        ??0Cursor@WebCore@@QAE@ABV01@@Z
    149151        ??0String@WTF@@QAE@PBD@Z
    150152        ??0String@WTF@@QAE@PB_W@Z
  • trunk/Source/autotools/symbols.filter

    r134744 r134803  
    164164_ZN7WebCore10ScrollView21setDelegatesScrollingEb;
    165165_ZN7WebCore4Node14removedLastRefEv;
     166_ZN7WebCore6CursorC1ERKS0_;
     167_ZN7WebCore6CursorD1Ev;
    166168_ZN7WebCore8Settings16setImagesEnabledEb;
    167169_ZN7WebCore8Settings18setFixedFontFamilyERKN3WTF12AtomicStringE11UScriptCode;
Note: See TracChangeset for help on using the changeset viewer.