- Add keyboard and focus notifications (issue #508).

- Add CefDOMNode::IsEditable method.
- List interfaces alphabetically in CefClient.
- Correct error checking for code and command input.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@680 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-06-11 15:52:49 +00:00
parent 3715c23777
commit d8caf27e3b
60 changed files with 1940 additions and 408 deletions

View File

@@ -69,8 +69,9 @@ class CefCriticalSection {
};
// Handle types.
#define CefWindowHandle cef_window_handle_t
#define CefCursorHandle cef_cursor_handle_t
#define CefEventHandle cef_event_handle_t
#define CefWindowHandle cef_window_handle_t
struct CefMainArgsTraits {
typedef cef_main_args_t struct_type;

View File

@@ -45,10 +45,6 @@ inline long CefAtomicDecrement(long volatile *pDest) { // NOLINT(runtime/int)
return __sync_sub_and_fetch(pDest, 1);
}
// Handle types.
#define CefWindowHandle cef_window_handle_t
#define CefCursorHandle cef_cursor_handle_t
// Critical section wrapper.
class CefCriticalSection {
public:
@@ -72,6 +68,11 @@ class CefCriticalSection {
pthread_mutexattr_t attr_;
};
// Handle types.
#define CefCursorHandle cef_cursor_handle_t
#define CefEventHandle cef_event_handle_t
#define CefWindowHandle cef_window_handle_t
struct CefMainArgsTraits {
typedef cef_main_args_t struct_type;

View File

@@ -75,6 +75,15 @@ typedef int int32;
typedef unsigned int uint32;
#endif
// UTF-16 character type
#ifndef char16
#if defined(WIN32)
typedef wchar_t char16;
#else
typedef unsigned short char16;
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
@@ -945,6 +954,94 @@ enum cef_context_menu_edit_state_flags_t {
CM_EDITFLAG_CAN_TRANSLATE = 1 << 7,
};
///
// Key event types.
///
enum cef_key_event_type_t {
KEYEVENT_RAWKEYDOWN = 0,
KEYEVENT_KEYDOWN,
KEYEVENT_KEYUP,
KEYEVENT_CHAR
};
///
// Key event modifiers.
///
enum cef_key_event_modifiers_t {
KEY_SHIFT = 1 << 0,
KEY_CTRL = 1 << 1,
KEY_ALT = 1 << 2,
KEY_META = 1 << 3,
KEY_KEYPAD = 1 << 4, // Only used on Mac OS-X
};
///
// Structure representing keyboard event information.
///
typedef struct _cef_key_event_t {
///
// The type of keyboard event.
///
cef_key_event_type_t type;
///
// Bit flags describing any pressed modifier keys. See
// cef_key_event_modifiers_t for values.
///
int modifiers;
///
// The Windows key code for the key event. This value is used by the DOM
// specification. Sometimes it comes directly from the event (i.e. on
// Windows) and sometimes it's determined using a mapping function. See
// WebCore/platform/chromium/KeyboardCodes.h for the list of values.
///
int windows_key_code;
///
// The actual key code genenerated by the platform.
///
int native_key_code;
///
// Indicates whether the event is considered a "system key" event (see
// http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details).
// This value will always be false on non-Windows platforms.
///
bool is_system_key;
///
// The character generated by the keystroke.
///
char16 character;
///
// Same as |character| but unmodified by any concurrently-held modifiers
// (except shift). This is useful for working out shortcut keys.
///
char16 unmodified_character;
///
// True if the focus is currently on an editable field on the page. This is
// useful for determining if standard key events should be intercepted.
///
bool focus_on_editable_field;
} cef_key_event_t;
///
// Focus sources.
///
enum cef_focus_source_t {
///
// The source is explicit navigation via the API (LoadURL(), etc).
///
FOCUS_SOURCE_NAVIGATION = 0,
///
// The source is a system-generated focus event.
///
FOCUS_SOURCE_SYSTEM,
};
///
// Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and
// UTF16 (LE and BE) by default. All other types must be translated to UTF8

View File

@@ -42,9 +42,10 @@
extern "C" {
#endif
// Window handle.
// Handle types.
#define cef_cursor_handle_t GtkCursor*
#define cef_event_handle_t GdkEvent*
#define cef_window_handle_t GtkWidget*
#define cef_cursor_handle_t void*
///
// Structure representing CefExecuteProcess arguments.

View File

@@ -37,18 +37,25 @@
#if defined(OS_MACOSX)
#include "include/internal/cef_string.h"
// Window handle.
// Handle types.
#ifdef __cplusplus
#ifdef __OBJC__
@class NSCursor;
@class NSEvent;
@class NSView;
#else
class NSCursor;
class NSEvent;
struct NSView;
#endif
#define cef_cursor_handle_t NSCursor*
#define cef_event_handle_t NSEvent*
#define cef_window_handle_t NSView*
#else
#define cef_cursor_handle_t void*
#define cef_event_handle_t void*
#define cef_window_handle_t void*
#endif
#define cef_cursor_handle_t void*
#ifdef __cplusplus
extern "C" {

View File

@@ -42,9 +42,10 @@
extern "C" {
#endif
// Window handle.
#define cef_window_handle_t HWND
// Handle types.
#define cef_cursor_handle_t HCURSOR
#define cef_event_handle_t MSG*
#define cef_window_handle_t HWND
///
// Structure representing CefExecuteProcess arguments.

View File

@@ -174,6 +174,31 @@ inline bool operator!=(const CefRect& a, const CefRect& b) {
return !(a == b);
}
struct CefKeyEventTraits {
typedef cef_key_event_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
target->type = src->type;
target->modifiers = src->modifiers;
target->windows_key_code = src->windows_key_code;
target->native_key_code = src->native_key_code;
target->is_system_key = src->is_system_key;
target->character = src->character;
target->unmodified_character = src->unmodified_character;
target->focus_on_editable_field = src->focus_on_editable_field;
}
};
///
// Class representing a a keyboard event.
///
typedef CefStructBase<CefKeyEventTraits> CefKeyEvent;
struct CefPopupFeaturesTraits {
typedef cef_popup_features_t struct_type;

View File

@@ -68,8 +68,9 @@ class CefCriticalSection {
///
// Handle types.
///
#define CefWindowHandle cef_window_handle_t
#define CefCursorHandle cef_cursor_handle_t
#define CefEventHandle cef_event_handle_t
#define CefWindowHandle cef_window_handle_t
struct CefMainArgsTraits {
typedef cef_main_args_t struct_type;