mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-27 10:50:35 +00:00
Bug 781220 - Hide other GeckoLayerClient methods and expose them via the LayerView API. r=sriram
This commit is contained in:
parent
d643365be3
commit
192f94dbc6
@ -223,7 +223,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
||||
int popupWidth = RelativeLayout.LayoutParams.FILL_PARENT;
|
||||
int popupLeft = left < 0 ? 0 : left;
|
||||
|
||||
FloatSize viewport = GeckoApp.mAppContext.getLayerClient().getViewportSize();
|
||||
FloatSize viewport = GeckoApp.mAppContext.getLayerView().getViewportMetrics().getSize();
|
||||
|
||||
// For autocomplete suggestions, if the input is smaller than the screen-width,
|
||||
// shrink the popup's width. Otherwise, keep it as FILL_PARENT.
|
||||
|
@ -2339,11 +2339,11 @@ class ScreenshotHandler implements Runnable {
|
||||
}
|
||||
|
||||
private void screenshotWholePage(int tabId) {
|
||||
GeckoLayerClient layerClient = GeckoApp.mAppContext.getLayerClient();
|
||||
if (layerClient == null) {
|
||||
LayerView layerView = GeckoApp.mAppContext.getLayerView();
|
||||
if (layerView == null) {
|
||||
return;
|
||||
}
|
||||
ImmutableViewportMetrics viewport = layerClient.getViewportMetrics();
|
||||
ImmutableViewportMetrics viewport = layerView.getViewportMetrics();
|
||||
RectF pageRect = viewport.getCssPageRect();
|
||||
|
||||
if (FloatUtils.fuzzyEquals(pageRect.width(), 0) || FloatUtils.fuzzyEquals(pageRect.height(), 0)) {
|
||||
@ -2443,14 +2443,14 @@ class ScreenshotHandler implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
GeckoLayerClient layerClient = GeckoApp.mAppContext.getLayerClient();
|
||||
if (layerClient == null) {
|
||||
LayerView layerView = GeckoApp.mAppContext.getLayerView();
|
||||
if (layerView == null) {
|
||||
// we could be in the midst of an activity tear-down and re-start, so guard
|
||||
// against a null layer controller.
|
||||
// against a null layer view
|
||||
return;
|
||||
}
|
||||
|
||||
ImmutableViewportMetrics viewport = layerClient.getViewportMetrics();
|
||||
ImmutableViewportMetrics viewport = layerView.getViewportMetrics();
|
||||
if (RectUtils.fuzzyEquals(mPageRect, viewport.getCssPageRect())) {
|
||||
// the page size hasn't changed, so our dirty rect is still valid and we can just
|
||||
// repaint that area
|
||||
|
@ -227,7 +227,7 @@ public class GeckoEvent {
|
||||
public void addMotionPoint(int index, int eventIndex, MotionEvent event) {
|
||||
try {
|
||||
PointF geckoPoint = new PointF(event.getX(eventIndex), event.getY(eventIndex));
|
||||
geckoPoint = GeckoApp.mAppContext.getLayerClient().convertViewPointToLayerPoint(geckoPoint);
|
||||
geckoPoint = GeckoApp.mAppContext.getLayerView().convertViewPointToLayerPoint(geckoPoint);
|
||||
|
||||
mPoints[index] = new Point(Math.round(geckoPoint.x), Math.round(geckoPoint.y));
|
||||
mPointIndicies[index] = event.getPointerId(eventIndex);
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.gfx.GeckoLayerClient;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
import org.mozilla.gecko.util.GeckoEventResponder;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@ -182,11 +182,11 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
||||
}
|
||||
|
||||
public void show(String aTitle, String aText, PromptButton[] aButtons, PromptListItem[] aMenuList, boolean aMultipleSelection) {
|
||||
final GeckoLayerClient layerClient = GeckoApp.mAppContext.getLayerClient();
|
||||
layerClient.post(new Runnable() {
|
||||
final LayerView layerView = GeckoApp.mAppContext.getLayerView();
|
||||
layerView.post(new Runnable() {
|
||||
public void run() {
|
||||
// treat actions that show a dialog as if preventDefault by content to prevent panning
|
||||
layerClient.getPanZoomController().abortPanning();
|
||||
layerView.abortPanning();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.gfx.GeckoLayerClient;
|
||||
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -83,15 +83,15 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener {
|
||||
mLeft = mLeft + newX - mTouchStartX;
|
||||
mTop = mTop + newY - mTouchStartY;
|
||||
|
||||
GeckoLayerClient layerClient = GeckoApp.mAppContext.getLayerClient();
|
||||
if (layerClient == null) {
|
||||
Log.e(LOGTAG, "Can't move selection because layerClient is null");
|
||||
LayerView layerView = GeckoApp.mAppContext.getLayerView();
|
||||
if (layerView == null) {
|
||||
Log.e(LOGTAG, "Can't move selection because layerView is null");
|
||||
return;
|
||||
}
|
||||
// Send x coordinate on the right side of the start handle, left side of the end handle.
|
||||
float left = (float) mLeft + (mHandleType.equals(HandleType.START) ? mWidth - mShadow : mShadow);
|
||||
PointF geckoPoint = new PointF(left, (float) mTop);
|
||||
geckoPoint = layerClient.convertViewPointToLayerPoint(geckoPoint);
|
||||
geckoPoint = layerView.convertViewPointToLayerPoint(geckoPoint);
|
||||
|
||||
JSONObject args = new JSONObject();
|
||||
try {
|
||||
@ -107,14 +107,14 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener {
|
||||
}
|
||||
|
||||
void positionFromGecko(int left, int top) {
|
||||
GeckoLayerClient layerClient = GeckoApp.mAppContext.getLayerClient();
|
||||
if (layerClient == null) {
|
||||
Log.e(LOGTAG, "Can't position handle because layerClient is null");
|
||||
LayerView layerView = GeckoApp.mAppContext.getLayerView();
|
||||
if (layerView == null) {
|
||||
Log.e(LOGTAG, "Can't position handle because layerView is null");
|
||||
return;
|
||||
}
|
||||
|
||||
mGeckoPoint = new PointF((float) left, (float) top);
|
||||
ImmutableViewportMetrics metrics = layerClient.getViewportMetrics();
|
||||
ImmutableViewportMetrics metrics = layerView.getViewportMetrics();
|
||||
repositionWithViewport(metrics.viewportRectLeft, metrics.viewportRectTop, metrics.zoomFactor);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ public class GeckoLayerClient
|
||||
}
|
||||
}
|
||||
|
||||
public PanZoomController getPanZoomController() {
|
||||
PanZoomController getPanZoomController() {
|
||||
return mPanZoomController;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.SurfaceTexture;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
@ -129,6 +130,18 @@ public class LayerView extends FrameLayout {
|
||||
public GeckoLayerClient getLayerClient() { return mLayerClient; }
|
||||
public TouchEventHandler getTouchEventHandler() { return mTouchEventHandler; }
|
||||
|
||||
public ImmutableViewportMetrics getViewportMetrics() {
|
||||
return mLayerClient.getViewportMetrics();
|
||||
}
|
||||
|
||||
public void abortPanning() {
|
||||
mLayerClient.getPanZoomController().abortPanning();
|
||||
}
|
||||
|
||||
public PointF convertViewPointToLayerPoint(PointF viewPoint) {
|
||||
return mLayerClient.convertViewPointToLayerPoint(viewPoint);
|
||||
}
|
||||
|
||||
/** The LayerRenderer calls this to indicate that the window has changed size. */
|
||||
public void setViewportSize(IntSize size) {
|
||||
mLayerClient.setViewportSize(new FloatSize(size));
|
||||
|
Loading…
Reference in New Issue
Block a user