diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 07:35:28 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 07:35:28 +0000 |
commit | 5211744cc70ae9435f9e904f4126f110ba7f142c (patch) | |
tree | 5a00ba7320e32447e48187e6427a660d349960a2 /webkit | |
parent | 8c5c745bd02971f744f651d532204f922a84ccff (diff) | |
download | chromium_src-5211744cc70ae9435f9e904f4126f110ba7f142c.zip chromium_src-5211744cc70ae9435f9e904f4126f110ba7f142c.tar.gz chromium_src-5211744cc70ae9435f9e904f4126f110ba7f142c.tar.bz2 |
Remove Carbon cursor call interposing in Mac NPAPI plugins
Cocoa cursor calls have been supported for quite some time, and
Carbon is long-deprecated; plugins should not be using Carbon calls
to change the cursor.
This reduces the complexity of the interpose library, which should
ideally be completely eliminated at some point.
BUG=None
Review URL: https://chromiumcodereview.appspot.com/11192052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163523 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webcursor.h | 8 | ||||
-rw-r--r-- | webkit/glue/webcursor_mac.mm | 129 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl.h | 6 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl_mac.mm | 10 |
4 files changed, 0 insertions, 153 deletions
diff --git a/webkit/glue/webcursor.h b/webkit/glue/webcursor.h index ad0dd34..48f4247 100644 --- a/webkit/glue/webcursor.h +++ b/webkit/glue/webcursor.h @@ -25,8 +25,6 @@ typedef struct _GdkCursor GdkCursor; #else class NSCursor; #endif -typedef UInt32 ThemeCursor; -typedef struct Cursor Cursor; #endif class Pickle; @@ -99,12 +97,6 @@ class WEBKIT_GLUE_EXPORT WebCursor { // returns GDK_CURSOR_IS_PIXMAP. GdkCursor* GetCustomCursor(); #elif defined(OS_MACOSX) - // Initialize this from the given Carbon ThemeCursor. - void InitFromThemeCursor(ThemeCursor cursor); - - // Initialize this from the given Carbon Cursor. - void InitFromCursor(const Cursor* cursor); - // Initialize this from the given Cocoa NSCursor. void InitFromNSCursor(NSCursor* cursor); #endif diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm index b067d9c..2321e72 100644 --- a/webkit/glue/webcursor_mac.mm +++ b/webkit/glue/webcursor_mac.mm @@ -5,7 +5,6 @@ #include "webkit/glue/webcursor.h" #import <AppKit/AppKit.h> -#include <Carbon/Carbon.h> #include "base/logging.h" #include "base/mac/mac_util.h" @@ -19,18 +18,6 @@ #include "ui/base/resource/resource_bundle.h" -#if defined(MAC_OS_X_VERSION_10_7) && \ - MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 -// The 10.7 SDK no longer has QuickDraw headers. -// http://developer.apple.com/legacy/mac/library/documentation/Carbon/reference/QuickDraw_Ref/QuickDraw_Ref.pdf -typedef short Bits16[16]; -struct Cursor { - Bits16 data; - Bits16 mask; - Point hotSpot; -}; -#endif // 10.7+ SDK - using WebKit::WebCursorInfo; using WebKit::WebImage; using WebKit::WebSize; @@ -351,122 +338,6 @@ gfx::NativeCursor WebCursor::GetNativeCursor() { return nil; } -void WebCursor::InitFromThemeCursor(ThemeCursor cursor) { - WebKit::WebCursorInfo cursor_info; - - switch (cursor) { - case kThemeArrowCursor: - cursor_info.type = WebCursorInfo::TypePointer; - break; - case kThemeCopyArrowCursor: - cursor_info.type = WebCursorInfo::TypeCopy; - break; - case kThemeAliasArrowCursor: - cursor_info.type = WebCursorInfo::TypeAlias; - break; - case kThemeContextualMenuArrowCursor: - cursor_info.type = WebCursorInfo::TypeContextMenu; - break; - case kThemeIBeamCursor: - cursor_info.type = WebCursorInfo::TypeIBeam; - break; - case kThemeCrossCursor: - case kThemePlusCursor: - cursor_info.type = WebCursorInfo::TypeCross; - break; - case kThemeWatchCursor: - case kThemeSpinningCursor: - cursor_info.type = WebCursorInfo::TypeWait; - break; - case kThemeClosedHandCursor: - cursor_info.type = WebCursorInfo::TypeGrabbing; - break; - case kThemeOpenHandCursor: - cursor_info.type = WebCursorInfo::TypeGrab; - break; - case kThemePointingHandCursor: - case kThemeCountingUpHandCursor: - case kThemeCountingDownHandCursor: - case kThemeCountingUpAndDownHandCursor: - cursor_info.type = WebCursorInfo::TypeHand; - break; - case kThemeResizeLeftCursor: - cursor_info.type = WebCursorInfo::TypeWestResize; - break; - case kThemeResizeRightCursor: - cursor_info.type = WebCursorInfo::TypeEastResize; - break; - case kThemeResizeLeftRightCursor: - cursor_info.type = WebCursorInfo::TypeEastWestResize; - break; - case kThemeNotAllowedCursor: - cursor_info.type = WebCursorInfo::TypeNotAllowed; - break; - case kThemeResizeUpCursor: - cursor_info.type = WebCursorInfo::TypeNorthResize; - break; - case kThemeResizeDownCursor: - cursor_info.type = WebCursorInfo::TypeSouthResize; - break; - case kThemeResizeUpDownCursor: - cursor_info.type = WebCursorInfo::TypeNorthSouthResize; - break; - case kThemePoofCursor: // *shrug* - default: - cursor_info.type = WebCursorInfo::TypePointer; - break; - } - - InitFromCursorInfo(cursor_info); -} - -void WebCursor::InitFromCursor(const Cursor* cursor) { - // This conversion isn't perfect (in particular, the inversion effect of - // data==1, mask==0 won't work). Not planning on fixing it. - - gfx::Size custom_size(16, 16); - std::vector<char> raw_data; - for (int row = 0; row < 16; ++row) { - unsigned short data = cursor->data[row]; - unsigned short mask = cursor->mask[row]; - - // The Core Endian flipper callback for 'CURS' doesn't flip Bits16 as if it - // were a short (which it is), so we flip it here. - data = ((data << 8) & 0xFF00) | ((data >> 8) & 0x00FF); - mask = ((mask << 8) & 0xFF00) | ((mask >> 8) & 0x00FF); - - for (int bit = 0; bit < 16; ++bit) { - if (data & 0x8000) { - raw_data.push_back(0x00); - raw_data.push_back(0x00); - raw_data.push_back(0x00); - } else { - raw_data.push_back(0xFF); - raw_data.push_back(0xFF); - raw_data.push_back(0xFF); - } - if (mask & 0x8000) - raw_data.push_back(0xFF); - else - raw_data.push_back(0x00); - data <<= 1; - mask <<= 1; - } - } - - base::mac::ScopedCFTypeRef<CGImageRef> cg_image( - CreateCGImageFromCustomData(raw_data, custom_size)); - - WebKit::WebCursorInfo cursor_info; - cursor_info.type = WebCursorInfo::TypeCustom; - cursor_info.hotSpot = WebKit::WebPoint(cursor->hotSpot.h, cursor->hotSpot.v); - // TODO(avi): build the cursor image in Skia directly rather than going via - // this roundabout path. - cursor_info.customImage = gfx::CGImageToSkBitmap(cg_image.get()); - - InitFromCursorInfo(cursor_info); -} - void WebCursor::InitFromNSCursor(NSCursor* cursor) { WebKit::WebCursorInfo cursor_info; diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.h b/webkit/plugins/npapi/webplugin_delegate_impl.h index 0c26aed..671bc9c 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.h +++ b/webkit/plugins/npapi/webplugin_delegate_impl.h @@ -180,12 +180,6 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { // Informs the plugin that IME composition has completed. // If |text| is empty, IME was cancelled. void ImeCompositionCompleted(const string16& text); -#ifndef NP_NO_CARBON - // Informs the delegate that the plugin set a Carbon ThemeCursor. - void SetThemeCursor(ThemeCursor cursor); - // Informs the delegate that the plugin set a Carbon Cursor. - void SetCarbonCursor(const Cursor* cursor); -#endif // Informs the delegate that the plugin set a Cocoa NSCursor. void SetNSCursor(NSCursor* cursor); diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm index ff23bcb..806bdeb 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm +++ b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm @@ -645,16 +645,6 @@ void WebPluginDelegateImpl::ImeCompositionCompleted(const string16& text) { } } -#ifndef NP_NO_CARBON -void WebPluginDelegateImpl::SetThemeCursor(ThemeCursor cursor) { - current_windowless_cursor_.InitFromThemeCursor(cursor); -} - -void WebPluginDelegateImpl::SetCarbonCursor(const Cursor* cursor) { - current_windowless_cursor_.InitFromCursor(cursor); -} -#endif - void WebPluginDelegateImpl::SetNSCursor(NSCursor* cursor) { current_windowless_cursor_.InitFromNSCursor(cursor); } |