Bug 1211704 - Remove obsolete GeckoEvent definitions; r=esawin

Remove obsolete GeckoEvent definitions from GeckoEvent.java and
AndroidJavaWrappers.cpp/h.
This commit is contained in:
Jim Chen 2015-10-22 17:45:47 -04:00
parent b81c9794ee
commit a5188f1dd7
3 changed files with 0 additions and 195 deletions

View File

@ -70,7 +70,6 @@ public class GeckoEvent {
@JNITarget
private enum NativeGeckoEvent {
NATIVE_POKE(0),
KEY_EVENT(1),
MOTION_EVENT(2),
SENSOR_EVENT(3),
LOCATION_EVENT(5),
@ -138,34 +137,16 @@ public class GeckoEvent {
private int mMetaState;
private int mFlags;
private int mKeyCode;
private int mScanCode;
private int mUnicodeChar;
private int mBaseUnicodeChar; // mUnicodeChar without meta states applied
private int mDOMPrintableKeyValue;
private int mRepeatCount;
private int mCount;
private int mStart;
private int mEnd;
private String mCharacters;
private String mCharactersExtra;
private String mData;
private int mRangeType;
private int mRangeStyles;
private int mRangeLineStyle;
private boolean mRangeBoldLine;
private int mRangeForeColor;
private int mRangeBackColor;
private int mRangeLineColor;
private Location mLocation;
private Address mAddress;
private int mConnectionType;
private boolean mIsWifi;
private int mDHCPGateway;
private int mNativeWindow;
private short mScreenOrientation;
private short mScreenAngle;
@ -196,12 +177,6 @@ public class GeckoEvent {
return GeckoEvent.get(NativeGeckoEvent.NOOP);
}
public static GeckoEvent createKeyEvent(KeyEvent k, int action, int metaState) {
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.KEY_EVENT);
event.initKeyEvent(k, action, metaState);
return event;
}
public static GeckoEvent createCompositorCreateEvent(int width, int height) {
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.COMPOSITOR_CREATE);
event.mWidth = width;
@ -217,39 +192,6 @@ public class GeckoEvent {
return GeckoEvent.get(NativeGeckoEvent.COMPOSITOR_RESUME);
}
private void initKeyEvent(KeyEvent k, int action, int metaState) {
// Use a separate action argument so we can override the key's original action,
// e.g. change ACTION_MULTIPLE to ACTION_DOWN. That way we don't have to allocate
// a new key event just to change its action field.
mAction = action;
mTime = k.getEventTime();
// Normally we expect k.getMetaState() to reflect the current meta-state; however,
// some software-generated key events may not have k.getMetaState() set, e.g. key
// events from Swype. Therefore, it's necessary to combine the key's meta-states
// with the meta-states that we keep separately in KeyListener
mMetaState = k.getMetaState() | metaState;
mFlags = k.getFlags();
mKeyCode = k.getKeyCode();
mScanCode = k.getScanCode();
mUnicodeChar = k.getUnicodeChar(mMetaState);
// e.g. for Ctrl+A, Android returns 0 for mUnicodeChar,
// but Gecko expects 'a', so we return that in mBaseUnicodeChar
mBaseUnicodeChar = k.getUnicodeChar(0);
mRepeatCount = k.getRepeatCount();
mCharacters = k.getCharacters();
if (mUnicodeChar >= ' ') {
mDOMPrintableKeyValue = mUnicodeChar;
} else {
int unmodifiedMetaState =
mMetaState & ~(KeyEvent.META_ALT_MASK |
KeyEvent.META_CTRL_MASK |
KeyEvent.META_META_MASK);
if (unmodifiedMetaState != mMetaState) {
mDOMPrintableKeyValue = k.getUnicodeChar(unmodifiedMetaState);
}
}
}
/**
* This method is a replacement for the the KeyEvent.isGamepadButton method to be
* compatible with Build.VERSION.SDK_INT < 12. This is an implementation of the

View File

@ -32,30 +32,14 @@ jfieldID AndroidGeckoEvent::jZField = 0;
jfieldID AndroidGeckoEvent::jWField = 0;
jfieldID AndroidGeckoEvent::jDistanceField = 0;
jfieldID AndroidGeckoEvent::jRectField = 0;
jfieldID AndroidGeckoEvent::jNativeWindowField = 0;
jfieldID AndroidGeckoEvent::jCharactersField = 0;
jfieldID AndroidGeckoEvent::jCharactersExtraField = 0;
jfieldID AndroidGeckoEvent::jDataField = 0;
jfieldID AndroidGeckoEvent::jDOMPrintableKeyValueField = 0;
jfieldID AndroidGeckoEvent::jKeyCodeField = 0;
jfieldID AndroidGeckoEvent::jScanCodeField = 0;
jfieldID AndroidGeckoEvent::jMetaStateField = 0;
jfieldID AndroidGeckoEvent::jFlagsField = 0;
jfieldID AndroidGeckoEvent::jUnicodeCharField = 0;
jfieldID AndroidGeckoEvent::jBaseUnicodeCharField = 0;
jfieldID AndroidGeckoEvent::jRepeatCountField = 0;
jfieldID AndroidGeckoEvent::jCountField = 0;
jfieldID AndroidGeckoEvent::jStartField = 0;
jfieldID AndroidGeckoEvent::jEndField = 0;
jfieldID AndroidGeckoEvent::jPointerIndexField = 0;
jfieldID AndroidGeckoEvent::jRangeTypeField = 0;
jfieldID AndroidGeckoEvent::jRangeStylesField = 0;
jfieldID AndroidGeckoEvent::jRangeLineStyleField = 0;
jfieldID AndroidGeckoEvent::jRangeBoldLineField = 0;
jfieldID AndroidGeckoEvent::jRangeForeColorField = 0;
jfieldID AndroidGeckoEvent::jRangeBackColorField = 0;
jfieldID AndroidGeckoEvent::jRangeLineColorField = 0;
jfieldID AndroidGeckoEvent::jLocationField = 0;
jfieldID AndroidGeckoEvent::jConnectionTypeField = 0;
jfieldID AndroidGeckoEvent::jIsWifiField = 0;
@ -144,25 +128,10 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
jCharactersField = geckoEvent.getField("mCharacters", "Ljava/lang/String;");
jCharactersExtraField = geckoEvent.getField("mCharactersExtra", "Ljava/lang/String;");
jDataField = geckoEvent.getField("mData", "Ljava/lang/String;");
jKeyCodeField = geckoEvent.getField("mKeyCode", "I");
jScanCodeField = geckoEvent.getField("mScanCode", "I");
jMetaStateField = geckoEvent.getField("mMetaState", "I");
jFlagsField = geckoEvent.getField("mFlags", "I");
jUnicodeCharField = geckoEvent.getField("mUnicodeChar", "I");
jBaseUnicodeCharField = geckoEvent.getField("mBaseUnicodeChar", "I");
jDOMPrintableKeyValueField = geckoEvent.getField("mDOMPrintableKeyValue", "I");
jRepeatCountField = geckoEvent.getField("mRepeatCount", "I");
jCountField = geckoEvent.getField("mCount", "I");
jStartField = geckoEvent.getField("mStart", "I");
jEndField = geckoEvent.getField("mEnd", "I");
jPointerIndexField = geckoEvent.getField("mPointerIndex", "I");
jRangeTypeField = geckoEvent.getField("mRangeType", "I");
jRangeStylesField = geckoEvent.getField("mRangeStyles", "I");
jRangeLineStyleField = geckoEvent.getField("mRangeLineStyle", "I");
jRangeBoldLineField = geckoEvent.getField("mRangeBoldLine", "Z");
jRangeForeColorField = geckoEvent.getField("mRangeForeColor", "I");
jRangeBackColorField = geckoEvent.getField("mRangeBackColor", "I");
jRangeLineColorField = geckoEvent.getField("mRangeLineColor", "I");
jLocationField = geckoEvent.getField("mLocation", "Landroid/location/Location;");
jConnectionTypeField = geckoEvent.getField("mConnectionType", "I");
jIsWifiField = geckoEvent.getField("mIsWifi", "Z");
@ -398,21 +367,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
ReadPointArray(mPoints, jenv, jPoints, 2);
break;
case KEY_EVENT:
case IME_KEY_EVENT:
mTime = jenv->GetLongField(jobj, jTimeField);
mMetaState = jenv->GetIntField(jobj, jMetaStateField);
mFlags = jenv->GetIntField(jobj, jFlagsField);
mKeyCode = jenv->GetIntField(jobj, jKeyCodeField);
mScanCode = jenv->GetIntField(jobj, jScanCodeField);
mUnicodeChar = jenv->GetIntField(jobj, jUnicodeCharField);
mBaseUnicodeChar = jenv->GetIntField(jobj, jBaseUnicodeCharField);
mDOMPrintableKeyValue =
jenv->GetIntField(jobj, jDOMPrintableKeyValueField);
mRepeatCount = jenv->GetIntField(jobj, jRepeatCountField);
ReadCharactersField(jenv);
break;
case NATIVE_GESTURE_EVENT:
mTime = jenv->GetLongField(jobj, jTimeField);
mMetaState = jenv->GetIntField(jobj, jMetaStateField);
@ -438,30 +392,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
break;
case IME_EVENT:
mStart = jenv->GetIntField(jobj, jStartField);
mEnd = jenv->GetIntField(jobj, jEndField);
if (mAction == IME_REPLACE_TEXT ||
mAction == IME_COMPOSE_TEXT) {
ReadCharactersField(jenv);
} else if (mAction == IME_UPDATE_COMPOSITION ||
mAction == IME_ADD_COMPOSITION_RANGE) {
mRangeType = jenv->GetIntField(jobj, jRangeTypeField);
mRangeStyles = jenv->GetIntField(jobj, jRangeStylesField);
mRangeLineStyle =
jenv->GetIntField(jobj, jRangeLineStyleField);
mRangeBoldLine =
jenv->GetBooleanField(jobj, jRangeBoldLineField);
mRangeForeColor =
jenv->GetIntField(jobj, jRangeForeColorField);
mRangeBackColor =
jenv->GetIntField(jobj, jRangeBackColorField);
mRangeLineColor =
jenv->GetIntField(jobj, jRangeLineColorField);
}
break;
case SENSOR_EVENT:
mX = jenv->GetDoubleField(jobj, jXField);
mY = jenv->GetDoubleField(jobj, jYField);

View File

@ -459,13 +459,6 @@ public:
return event;
}
static AndroidGeckoEvent* MakeIMEEvent(int aAction) {
AndroidGeckoEvent *event = new AndroidGeckoEvent();
event->Init(IME_EVENT);
event->mAction = aAction;
return event;
}
static AndroidGeckoEvent* MakeFromJavaObject(JNIEnv *jenv, jobject jobj) {
AndroidGeckoEvent *event = new AndroidGeckoEvent();
event->Init(jenv, jobj);
@ -508,9 +501,6 @@ public:
return mType == AndroidGeckoEvent::MOTION_EVENT ||
mType == AndroidGeckoEvent::NATIVE_GESTURE_EVENT ||
mType == AndroidGeckoEvent::LONG_PRESS ||
mType == AndroidGeckoEvent::KEY_EVENT ||
mType == AndroidGeckoEvent::IME_EVENT ||
mType == AndroidGeckoEvent::IME_KEY_EVENT ||
mType == AndroidGeckoEvent::APZ_INPUT_EVENT;
}
@ -532,8 +522,6 @@ public:
nsAString& Characters() { return mCharacters; }
nsAString& CharactersExtra() { return mCharactersExtra; }
nsAString& Data() { return mData; }
int KeyCode() { return mKeyCode; }
int ScanCode() { return mScanCode; }
int MetaState() { return mMetaState; }
Modifiers DOMModifiers() const;
bool IsAltPressed() const { return (mMetaState & AMETA_ALT_MASK) != 0; }
@ -541,21 +529,8 @@ public:
bool IsCtrlPressed() const { return (mMetaState & AMETA_CTRL_MASK) != 0; }
bool IsMetaPressed() const { return (mMetaState & AMETA_META_MASK) != 0; }
int Flags() { return mFlags; }
int UnicodeChar() { return mUnicodeChar; }
int BaseUnicodeChar() { return mBaseUnicodeChar; }
int DOMPrintableKeyValue() { return mDOMPrintableKeyValue; }
int RepeatCount() const { return mRepeatCount; }
int Count() { return mCount; }
int Start() { return mStart; }
int End() { return mEnd; }
int PointerIndex() { return mPointerIndex; }
int RangeType() { return mRangeType; }
int RangeStyles() { return mRangeStyles; }
int RangeLineStyle() { return mRangeLineStyle; }
bool RangeBoldLine() { return mRangeBoldLine; }
int RangeForeColor() { return mRangeForeColor; }
int RangeBackColor() { return mRangeBackColor; }
int RangeLineColor() { return mRangeLineColor; }
nsGeoPosition* GeoPosition() { return mGeoPosition; }
int ConnectionType() { return mConnectionType; }
bool IsWifi() { return mIsWifi; }
@ -594,14 +569,7 @@ protected:
nsTArray<int> mToolTypes;
nsIntRect mRect;
int mFlags, mMetaState;
int mKeyCode, mScanCode;
int mUnicodeChar, mBaseUnicodeChar, mDOMPrintableKeyValue;
int mRepeatCount;
int mCount;
int mStart, mEnd;
int mRangeType, mRangeStyles, mRangeLineStyle;
bool mRangeBoldLine;
int mRangeForeColor, mRangeBackColor, mRangeLineColor;
double mX, mY, mZ, mW;
int mPointerIndex;
nsString mCharacters, mCharactersExtra, mData;
@ -662,30 +630,14 @@ protected:
static jfieldID jWField;
static jfieldID jDistanceField;
static jfieldID jRectField;
static jfieldID jNativeWindowField;
static jfieldID jCharactersField;
static jfieldID jCharactersExtraField;
static jfieldID jDataField;
static jfieldID jDOMPrintableKeyValueField;
static jfieldID jKeyCodeField;
static jfieldID jScanCodeField;
static jfieldID jMetaStateField;
static jfieldID jFlagsField;
static jfieldID jCountField;
static jfieldID jStartField;
static jfieldID jEndField;
static jfieldID jPointerIndexField;
static jfieldID jUnicodeCharField;
static jfieldID jBaseUnicodeCharField;
static jfieldID jRepeatCountField;
static jfieldID jRangeTypeField;
static jfieldID jRangeStylesField;
static jfieldID jRangeLineStyleField;
static jfieldID jRangeBoldLineField;
static jfieldID jRangeForeColorField;
static jfieldID jRangeBackColorField;
static jfieldID jRangeLineColorField;
static jfieldID jLocationField;
static jfieldID jConnectionTypeField;
@ -708,11 +660,9 @@ protected:
public:
enum {
NATIVE_POKE = 0,
KEY_EVENT = 1,
MOTION_EVENT = 2,
SENSOR_EVENT = 3,
LOCATION_EVENT = 5,
IME_EVENT = 6,
SIZE_CHANGED = 8,
APP_BACKGROUNDING = 9,
APP_FOREGROUNDING = 10,
@ -730,7 +680,6 @@ public:
COMPOSITOR_PAUSE = 29,
COMPOSITOR_RESUME = 30,
NATIVE_GESTURE_EVENT = 31,
IME_KEY_EVENT = 32,
CALL_OBSERVER = 33,
REMOVE_OBSERVER = 34,
LOW_MEMORY = 35,
@ -756,22 +705,6 @@ public:
MEMORY_PRESSURE_HIGH = 4
};
enum {
// Internal Gecko events
IME_FLUSH_CHANGES = -2,
IME_UPDATE_CONTEXT = -1,
// Events from Java to Gecko
IME_SYNCHRONIZE = 0,
IME_REPLACE_TEXT = 1,
IME_SET_SELECTION = 2,
IME_ADD_COMPOSITION_RANGE = 3,
IME_UPDATE_COMPOSITION = 4,
IME_REMOVE_COMPOSITION = 5,
IME_ACKNOWLEDGE_FOCUS = 6,
IME_COMPOSE_TEXT = 7,
dummy_ime_enum_list_end
};
enum {
ACTION_GAMEPAD_ADDED = 1,
ACTION_GAMEPAD_REMOVED = 2