Changeset 90087 in webkit


Ignore:
Timestamp:
Jun 29, 2011 10:12:28 PM (13 years ago)
Author:
Darin Adler
Message:

2011-06-29 Darin Adler <Darin Adler>

Reviewed by Dan Bernstein.

[Mac] Use system cursors instead of custom bitmaps where possible
https://bugs.webkit.org/show_bug.cgi?id=63679

  • WebCoreSupport/WebSystemInterface.mm: (InitWebCoreSystemInterface): Added WKCursor.

2011-06-29 Darin Adler <Darin Adler>

Reviewed by Dan Bernstein.

[Mac] Use system cursors instead of custom bitmaps where possible
https://bugs.webkit.org/show_bug.cgi?id=63679

  • Resources/crossHairCursor.png: Removed.
  • Resources/notAllowedCursor.png: Removed.
  • WebCore.exp.in: Added wkCursor.
  • WebCore/WebCore.gyp/WebCore.gyp: Removed the two now-unused PNG files.
  • WebCore.xcodeproj/project.pbxproj: Ditto.
  • platform/mac/CursorMac.mm: (WebCore::Cursor::ensurePlatformCursor): Use NSCursor API for Cross, Hand, VerticalText, ContextMenu, Copy, and NotAllowed. Use wkCursor for Move, Alias, Progress, and the resize and panning cursors.
  • platform/mac/WebCoreSystemInterface.h: Added wkCursor.
  • platform/mac/WebCoreSystemInterface.mm: Ditto.

2011-06-29 Darin Adler <Darin Adler>

Reviewed by Dan Bernstein.

[Mac] Use system cursors instead of custom bitmaps where possible
https://bugs.webkit.org/show_bug.cgi?id=63679

  • WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface): Added WKCursor.
Location:
trunk/Source
Files:
2 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90082 r90087  
     12011-06-29  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        [Mac] Use system cursors instead of custom bitmaps where possible
     6        https://bugs.webkit.org/show_bug.cgi?id=63679
     7
     8        * Resources/crossHairCursor.png: Removed.
     9        * Resources/notAllowedCursor.png: Removed.
     10        * WebCore.exp.in: Added wkCursor.
     11        * WebCore/WebCore.gyp/WebCore.gyp: Removed the two now-unused PNG files.
     12        * WebCore.xcodeproj/project.pbxproj: Ditto.
     13
     14        * platform/mac/CursorMac.mm:
     15        (WebCore::Cursor::ensurePlatformCursor): Use NSCursor API for Cross, Hand,
     16        VerticalText, ContextMenu, Copy, and NotAllowed. Use wkCursor for Move,
     17        Alias, Progress, and the resize and panning cursors.
     18
     19        * platform/mac/WebCoreSystemInterface.h: Added wkCursor.
     20        * platform/mac/WebCoreSystemInterface.mm: Ditto.
     21
    1222011-06-29  Keishi Hattori  <keishi@webkit.org>
    223
  • trunk/Source/WebCore/WebCore.exp.in

    r89991 r90087  
    14851485_wkWillStartLiveResize
    14861486_wkAVAssetResolvedURL
     1487_wkCursor
    14871488#else
    14881489_wkGetNSEventMomentumPhase
  • trunk/Source/WebCore/WebCore.gyp/WebCore.gyp

    r89975 r90087  
    16361636          '../Resources/contextMenuCursor.png',
    16371637          '../Resources/copyCursor.png',
    1638           '../Resources/crossHairCursor.png',
    16391638          '../Resources/eastResizeCursor.png',
    16401639          '../Resources/eastWestResizeCursor.png',
     
    16511650          '../Resources/northWestResizeCursor.png',
    16521651          '../Resources/northWestSouthEastResizeCursor.png',
    1653           '../Resources/notAllowedCursor.png',
    16541652          '../Resources/progressCursor.png',
    16551653          '../Resources/southEastResizeCursor.png',
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r90071 r90087  
    10361036                45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 45BAC2AF1360BBAB005DA258 /* IconURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10371037                4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 4614A1FD0B23A8D600446E1C /* copyCursor.png */; };
    1038                 464EA2730B8A350B00A8E6E3 /* crossHairCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 464EA2710B8A350B00A8E6E3 /* crossHairCursor.png */; };
    1039                 464EA2740B8A350B00A8E6E3 /* notAllowedCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 464EA2720B8A350B00A8E6E3 /* notAllowedCursor.png */; };
    10401038                46700ED0127B96CB00F5D5D6 /* FileWriterSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46700ECE127B96CB00F5D5D6 /* FileWriterSync.cpp */; };
    10411039                46700ED1127B96CB00F5D5D6 /* FileWriterSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 46700ECF127B96CB00F5D5D6 /* FileWriterSync.h */; };
     
    75327530                45BAC2AF1360BBAB005DA258 /* IconURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconURL.h; sourceTree = "<group>"; };
    75337531                4614A1FD0B23A8D600446E1C /* copyCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = copyCursor.png; sourceTree = "<group>"; };
    7534                 464EA2710B8A350B00A8E6E3 /* crossHairCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = crossHairCursor.png; sourceTree = "<group>"; };
    7535                 464EA2720B8A350B00A8E6E3 /* notAllowedCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = notAllowedCursor.png; sourceTree = "<group>"; };
    75367532                46700ECE127B96CB00F5D5D6 /* FileWriterSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileWriterSync.cpp; path = fileapi/FileWriterSync.cpp; sourceTree = "<group>"; };
    75377533                46700ECF127B96CB00F5D5D6 /* FileWriterSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileWriterSync.h; path = fileapi/FileWriterSync.h; sourceTree = "<group>"; };
     
    1293312929                                46D4F2470AF97E810035385A /* contextMenuCursor.png */,
    1293412930                                4614A1FD0B23A8D600446E1C /* copyCursor.png */,
    12935                                 464EA2710B8A350B00A8E6E3 /* crossHairCursor.png */,
    1293612931                                1C14E76A0AD8C81C00B6158B /* deleteButton.tiff */,
    1293712932                                1C14E7690AD8C81C00B6158B /* deleteButtonPressed.tiff */,
     
    1295212947                                85136C920AED665900F90A3D /* northWestResizeCursor.png */,
    1295312948                                85136C930AED665900F90A3D /* northWestSouthEastResizeCursor.png */,
    12954                                 464EA2720B8A350B00A8E6E3 /* notAllowedCursor.png */,
    1295512949                                46F9D5DC0B0D60170028EE36 /* progressCursor.png */,
    1295612950                                85136C940AED665900F90A3D /* southEastResizeCursor.png */,
     
    2319623190                                46D4F24A0AF97E810035385A /* contextMenuCursor.png in Resources */,
    2319723191                                4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */,
    23198                                 464EA2730B8A350B00A8E6E3 /* crossHairCursor.png in Resources */,
    2319923192                                1C14E76C0AD8C81C00B6158B /* deleteButton.tiff in Resources */,
    2320023193                                1C14E76B0AD8C81C00B6158B /* deleteButtonPressed.tiff in Resources */,
     
    2321623209                                85136CA20AED665900F90A3D /* northWestResizeCursor.png in Resources */,
    2321723210                                85136CA30AED665900F90A3D /* northWestSouthEastResizeCursor.png in Resources */,
    23218                                 464EA2740B8A350B00A8E6E3 /* notAllowedCursor.png in Resources */,
    2321923211                                46F9D5DF0B0D60170028EE36 /* progressCursor.png in Resources */,
    2322023212                                85136CA40AED665900F90A3D /* southEastResizeCursor.png in Resources */,
  • trunk/Source/WebCore/platform/mac/CursorMac.mm

    r68054 r90087  
    2828
    2929#import "BlockExceptions.h"
     30#import "WebCoreSystemInterface.h"
    3031#import <wtf/StdLibExtras.h>
    3132
     
    8485        break;
    8586    case Cursor::Cross:
    86         m_platformCursor = leakNamedCursor("crossHairCursor", 11, 11);
     87        m_platformCursor = [NSCursor crosshairCursor];
    8788        break;
    8889    case Cursor::Hand:
     90#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     91        m_platformCursor = [NSCursor pointingHandCursor];
     92#else
     93        // The pointingHandCursor from NSCursor does not have a shadow on
     94        // older versions of Mac OS X, so use our own custom cursor.
    8995        m_platformCursor = leakNamedCursor("linkCursor", 6, 1);
     96#endif
    9097        break;
    9198    case Cursor::IBeam:
     
    100107    case Cursor::Move:
    101108    case Cursor::MiddlePanning:
     109#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     110        m_platformCursor = wkCursor("Move");
     111#else
    102112        m_platformCursor = leakNamedCursor("moveCursor", 7, 7);
     113#endif
    103114        break;
    104115    case Cursor::EastResize:
    105116    case Cursor::EastPanning:
     117#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     118        m_platformCursor = wkCursor("ResizeEast");
     119#else
    106120        m_platformCursor = leakNamedCursor("eastResizeCursor", 14, 7);
     121#endif
    107122        break;
    108123    case Cursor::NorthResize:
    109124    case Cursor::NorthPanning:
     125#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     126        m_platformCursor = wkCursor("ResizeNorth");
     127#else
    110128        m_platformCursor = leakNamedCursor("northResizeCursor", 7, 1);
     129#endif
    111130        break;
    112131    case Cursor::NorthEastResize:
    113132    case Cursor::NorthEastPanning:
     133#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     134        m_platformCursor = wkCursor("ResizeNortheast");
     135#else
    114136        m_platformCursor = leakNamedCursor("northEastResizeCursor", 14, 1);
     137#endif
    115138        break;
    116139    case Cursor::NorthWestResize:
    117140    case Cursor::NorthWestPanning:
     141#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     142        m_platformCursor = wkCursor("ResizeNorthwest");
     143#else
    118144        m_platformCursor = leakNamedCursor("northWestResizeCursor", 0, 0);
     145#endif
    119146        break;
    120147    case Cursor::SouthResize:
    121148    case Cursor::SouthPanning:
     149#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     150        m_platformCursor = wkCursor("ResizeSouth");
     151#else
    122152        m_platformCursor = leakNamedCursor("southResizeCursor", 7, 14);
     153#endif
    123154        break;
    124155    case Cursor::SouthEastResize:
    125156    case Cursor::SouthEastPanning:
     157#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     158        m_platformCursor = wkCursor("ResizeSoutheast");
     159#else
    126160        m_platformCursor = leakNamedCursor("southEastResizeCursor", 14, 14);
     161#endif
    127162        break;
    128163    case Cursor::SouthWestResize:
    129164    case Cursor::SouthWestPanning:
     165#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     166        m_platformCursor = wkCursor("ResizeSouthwest");
     167#else
    130168        m_platformCursor = leakNamedCursor("southWestResizeCursor", 1, 14);
     169#endif
    131170        break;
    132171    case Cursor::WestResize:
     172#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     173        m_platformCursor = wkCursor("ResizeWest");
     174#else
    133175        m_platformCursor = leakNamedCursor("westResizeCursor", 1, 7);
     176#endif
    134177        break;
    135178    case Cursor::NorthSouthResize:
     179#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     180        m_platformCursor = wkCursor("ResizeNorthSouth");
     181#else
    136182        m_platformCursor = leakNamedCursor("northSouthResizeCursor", 7, 7);
     183#endif
    137184        break;
    138185    case Cursor::EastWestResize:
    139186    case Cursor::WestPanning:
     187#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     188        m_platformCursor = wkCursor("ResizeEastWest");
     189#else
    140190        m_platformCursor = leakNamedCursor("eastWestResizeCursor", 7, 7);
     191#endif
    141192        break;
    142193    case Cursor::NorthEastSouthWestResize:
     194#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     195        m_platformCursor = wkCursor("ResizeNortheastSouthwest");
     196#else
    143197        m_platformCursor = leakNamedCursor("northEastSouthWestResizeCursor", 7, 7);
     198#endif
    144199        break;
    145200    case Cursor::NorthWestSouthEastResize:
     201#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     202        m_platformCursor = wkCursor("ResizeNorthwestSoutheast");
     203#else
    146204        m_platformCursor = leakNamedCursor("northWestSouthEastResizeCursor", 7, 7);
     205#endif
    147206        break;
    148207    case Cursor::ColumnResize:
     
    153212        break;
    154213    case Cursor::VerticalText:
     214#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     215        m_platformCursor = [NSCursor IBeamCursorForVerticalLayout];
     216#else
    155217        m_platformCursor = leakNamedCursor("verticalTextCursor", 7, 7);
     218#endif
    156219        break;
    157220    case Cursor::Cell:
     
    159222        break;
    160223    case Cursor::ContextMenu:
     224#if !defined(BUILDING_ON_LEOPARD)
     225        m_platformCursor = [NSCursor contextualMenuCursor];
     226#else
    161227        m_platformCursor = leakNamedCursor("contextMenuCursor", 3, 2);
     228#endif
    162229        break;
    163230    case Cursor::Alias:
     231#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     232        m_platformCursor = wkCursor("MakeAlias");
     233#else
    164234        m_platformCursor = leakNamedCursor("aliasCursor", 11, 3);
     235#endif
    165236        break;
    166237    case Cursor::Progress:
     238#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     239        m_platformCursor = wkCursor("BusyButClickable");
     240#else
    167241        m_platformCursor = leakNamedCursor("progressCursor", 3, 2);
     242#endif
    168243        break;
    169244    case Cursor::NoDrop:
     
    171246        break;
    172247    case Cursor::Copy:
     248#if !defined(BUILDING_ON_LEOPARD)
     249        m_platformCursor = [NSCursor dragCopyCursor];
     250#else
    173251        m_platformCursor = leakNamedCursor("copyCursor", 3, 2);
     252#endif
    174253        break;
    175254    case Cursor::None:
     
    177256        break;
    178257    case Cursor::NotAllowed:
    179         m_platformCursor = leakNamedCursor("notAllowedCursor", 11, 11);
     258        m_platformCursor = [NSCursor operationNotAllowedCursor];
    180259        break;
    181260    case Cursor::ZoomIn:
  • trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h

    r89388 r90087  
    7373@class NSButtonCell;
    7474@class NSControl;
     75@class NSCursor;
    7576@class NSData;
    7677@class NSDate;
     
    9697class NSButtonCell;
    9798class NSControl;
     99class NSCursor;
    98100class NSData;
    99101class NSDate;
     
    231233
    232234extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
     235
    233236#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     237
    234238extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
    235239
     
    290294
    291295extern NSURL *(*wkAVAssetResolvedURL)(AVAsset*);
     296
     297extern NSCursor *(*wkCursor)(const char*);
     298
    292299#endif
    293300
  • trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm

    r89300 r90087  
    167167
    168168NSURL *(*wkAVAssetResolvedURL)(AVAsset*);
     169
     170NSCursor *(*wkCursor)(const char*);
     171
    169172#endif
    170173
  • trunk/Source/WebKit/mac/ChangeLog

    r89991 r90087  
     12011-06-29  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        [Mac] Use system cursors instead of custom bitmaps where possible
     6        https://bugs.webkit.org/show_bug.cgi?id=63679
     7
     8        * WebCoreSupport/WebSystemInterface.mm:
     9        (InitWebCoreSystemInterface): Added WKCursor.
     10
    1112011-06-28  Ilya Sherman  <isherman@chromium.org>
    212
  • trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm

    r89271 r90087  
    11/*
    2  * Copyright 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
     2 * Copyright 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    160160    INIT(CopyDefaultSearchProviderDisplayName);
    161161    INIT(AVAssetResolvedURL);
     162    INIT(Cursor);
    162163#endif
    163164
  • trunk/Source/WebKit2/ChangeLog

    r90038 r90087  
     12011-06-29  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        [Mac] Use system cursors instead of custom bitmaps where possible
     6        https://bugs.webkit.org/show_bug.cgi?id=63679
     7
     8        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
     9        (InitWebCoreSystemInterface): Added WKCursor.
     10
    1112011-06-29  Darin Adler  <darin@apple.com>
    212
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm

    r87328 r90087  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    150150        INIT(CopyDefaultSearchProviderDisplayName);
    151151        INIT(AVAssetResolvedURL);
     152        INIT(Cursor);
    152153#else
    153154        INIT(GetHyphenationLocationBeforeIndex);
Note: See TracChangeset for help on using the changeset viewer.