зеркало из https://github.com/mozilla/gecko-dev.git
Bug 810764 - Catch and handle various exceptions that can be thrown if the user pinches in a narrow window before Gecko is ready. r=jwir3
This commit is contained in:
Родитель
094cd8d3c3
Коммит
04e2b3378e
|
@ -265,24 +265,29 @@ public class GeckoEvent {
|
|||
}
|
||||
|
||||
public static GeckoEvent createNativeGestureEvent(int action, PointF pt, double size) {
|
||||
GeckoEvent event = new GeckoEvent(NATIVE_GESTURE_EVENT);
|
||||
event.mAction = action;
|
||||
event.mCount = 1;
|
||||
event.mPoints = new Point[1];
|
||||
try {
|
||||
GeckoEvent event = new GeckoEvent(NATIVE_GESTURE_EVENT);
|
||||
event.mAction = action;
|
||||
event.mCount = 1;
|
||||
event.mPoints = new Point[1];
|
||||
|
||||
PointF geckoPoint = new PointF(pt.x, pt.y);
|
||||
geckoPoint = GeckoApp.mAppContext.getLayerView().convertViewPointToLayerPoint(geckoPoint);
|
||||
PointF geckoPoint = new PointF(pt.x, pt.y);
|
||||
geckoPoint = GeckoApp.mAppContext.getLayerView().convertViewPointToLayerPoint(geckoPoint);
|
||||
|
||||
if (geckoPoint == null) {
|
||||
// This could happen if Gecko isn't ready yet.
|
||||
if (geckoPoint == null) {
|
||||
// This could happen if Gecko isn't ready yet.
|
||||
return null;
|
||||
}
|
||||
|
||||
event.mPoints[0] = new Point(Math.round(geckoPoint.x), Math.round(geckoPoint.y));
|
||||
|
||||
event.mX = size;
|
||||
event.mTime = System.currentTimeMillis();
|
||||
return event;
|
||||
} catch (Exception e) {
|
||||
// This can happen if Gecko isn't ready yet
|
||||
return null;
|
||||
}
|
||||
|
||||
event.mPoints[0] = new Point(Math.round(geckoPoint.x), Math.round(geckoPoint.y));
|
||||
|
||||
event.mX = size;
|
||||
event.mTime = System.currentTimeMillis();
|
||||
return event;
|
||||
}
|
||||
|
||||
public static GeckoEvent createMotionEvent(MotionEvent m) {
|
||||
|
@ -370,7 +375,7 @@ public class GeckoEvent {
|
|||
mOrientations[index] = 0;
|
||||
}
|
||||
mPressures[index] = event.getPressure(eventIndex);
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
Log.e(LOGTAG, "Error creating motion point " + index, ex);
|
||||
mPointRadii[index] = new Point(0, 0);
|
||||
mPoints[index] = new Point(0, 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче