Bug 913985: Part 5 - Refactor the Bridge to use the generated code. r=kats
This commit is contained in:
@@ -6,13 +6,13 @@
|
||||
#include "AndroidJavaWrappers.h"
|
||||
#include "AndroidBridge.h"
|
||||
#include "AndroidBridgeUtilities.h"
|
||||
#include "nsIAndroidBridge.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::widget::android;
|
||||
|
||||
jclass AndroidGeckoEvent::jGeckoEventClass = 0;
|
||||
jfieldID AndroidGeckoEvent::jActionField = 0;
|
||||
@@ -91,49 +91,12 @@ jmethodID AndroidLocation::jGetBearingMethod = 0;
|
||||
jmethodID AndroidLocation::jGetSpeedMethod = 0;
|
||||
jmethodID AndroidLocation::jGetTimeMethod = 0;
|
||||
|
||||
jclass AndroidGeckoLayerClient::jGeckoLayerClientClass = 0;
|
||||
jclass AndroidGeckoLayerClient::jViewportClass = 0;
|
||||
jclass AndroidGeckoLayerClient::jDisplayportClass = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jSetFirstPaintViewport = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jSetPageRect = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jSyncViewportInfoMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jSyncFrameMetricsMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jCreateFrameMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jActivateProgramMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jDeactivateProgramMethod = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jGetDisplayPort = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jContentDocumentChanged = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jIsContentDocumentDisplayed = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jViewportCtor = 0;
|
||||
jfieldID AndroidGeckoLayerClient::jDisplayportPosition = 0;
|
||||
jfieldID AndroidGeckoLayerClient::jDisplayportResolution = 0;
|
||||
jmethodID AndroidGeckoLayerClient::jProgressiveUpdateCallbackMethod = 0;
|
||||
|
||||
jclass AndroidLayerRendererFrame::jLayerRendererFrameClass = 0;
|
||||
jmethodID AndroidLayerRendererFrame::jBeginDrawingMethod = 0;
|
||||
jmethodID AndroidLayerRendererFrame::jDrawBackgroundMethod = 0;
|
||||
jmethodID AndroidLayerRendererFrame::jDrawForegroundMethod = 0;
|
||||
jmethodID AndroidLayerRendererFrame::jEndDrawingMethod = 0;
|
||||
|
||||
jclass AndroidViewTransform::jViewTransformClass = 0;
|
||||
jfieldID AndroidViewTransform::jXField = 0;
|
||||
jfieldID AndroidViewTransform::jYField = 0;
|
||||
jfieldID AndroidViewTransform::jScaleField = 0;
|
||||
jfieldID AndroidViewTransform::jFixedLayerMarginLeft = 0;
|
||||
jfieldID AndroidViewTransform::jFixedLayerMarginTop = 0;
|
||||
jfieldID AndroidViewTransform::jFixedLayerMarginRight = 0;
|
||||
jfieldID AndroidViewTransform::jFixedLayerMarginBottom = 0;
|
||||
jfieldID AndroidViewTransform::jOffsetXField = 0;
|
||||
jfieldID AndroidViewTransform::jOffsetYField = 0;
|
||||
|
||||
jclass AndroidProgressiveUpdateData::jProgressiveUpdateDataClass = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jXField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jYField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jWidthField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jHeightField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jScaleField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jShouldAbortField = 0;
|
||||
|
||||
RefCountedJavaObject::~RefCountedJavaObject() {
|
||||
if (mObject)
|
||||
GetJNIForThread()->DeleteGlobalRef(mObject);
|
||||
@@ -148,10 +111,8 @@ mozilla::InitAndroidJavaWrappers(JNIEnv *jEnv)
|
||||
AndroidLocation::InitLocationClass(jEnv);
|
||||
AndroidRect::InitRectClass(jEnv);
|
||||
AndroidRectF::InitRectFClass(jEnv);
|
||||
AndroidGeckoLayerClient::InitGeckoLayerClientClass(jEnv);
|
||||
AndroidLayerRendererFrame::InitLayerRendererFrameClass(jEnv);
|
||||
AndroidViewTransform::InitViewTransformClass(jEnv);
|
||||
AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(jEnv);
|
||||
InitStubs(jEnv);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -290,36 +251,6 @@ AndroidRectF::InitRectFClass(JNIEnv *jEnv)
|
||||
jRightField = getField("right", "F");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
|
||||
{
|
||||
initInit();
|
||||
|
||||
jGeckoLayerClientClass = getClassGlobalRef("org/mozilla/gecko/gfx/GeckoLayerClient");
|
||||
|
||||
jProgressiveUpdateCallbackMethod = getMethod("progressiveUpdateCallback",
|
||||
"(ZFFFFFZ)Lorg/mozilla/gecko/gfx/ProgressiveUpdateData;");
|
||||
jSetFirstPaintViewport = getMethod("setFirstPaintViewport", "(FFFFFFF)V");
|
||||
jSetPageRect = getMethod("setPageRect", "(FFFF)V");
|
||||
jSyncViewportInfoMethod = getMethod("syncViewportInfo",
|
||||
"(IIIIFZ)Lorg/mozilla/gecko/gfx/ViewTransform;");
|
||||
jSyncFrameMetricsMethod = getMethod("syncFrameMetrics",
|
||||
"(FFFFFFFZIIIIFZ)Lorg/mozilla/gecko/gfx/ViewTransform;");
|
||||
jCreateFrameMethod = getMethod("createFrame", "()Lorg/mozilla/gecko/gfx/LayerRenderer$Frame;");
|
||||
jActivateProgramMethod = getMethod("activateProgram", "()V");
|
||||
jDeactivateProgramMethod = getMethod("deactivateProgram", "()V");
|
||||
jGetDisplayPort = getMethod("getDisplayPort", "(ZZILorg/mozilla/gecko/gfx/ImmutableViewportMetrics;)Lorg/mozilla/gecko/gfx/DisplayPortMetrics;");
|
||||
jContentDocumentChanged = getMethod("contentDocumentChanged", "()V");
|
||||
jIsContentDocumentDisplayed = getMethod("isContentDocumentDisplayed", "()Z");
|
||||
|
||||
jViewportClass = getClassGlobalRef("org/mozilla/gecko/gfx/ImmutableViewportMetrics");
|
||||
jViewportCtor = getMethod("<init>", "(FFFFFFFFFFFFF)V");
|
||||
|
||||
jDisplayportClass = getClassGlobalRef("org/mozilla/gecko/gfx/DisplayPortMetrics");
|
||||
jDisplayportPosition = getField("mPosition", "Landroid/graphics/RectF;");
|
||||
jDisplayportResolution = getField("resolution", "F");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv)
|
||||
{
|
||||
@@ -333,39 +264,6 @@ AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv)
|
||||
jEndDrawingMethod = getMethod("endDrawing", "()V");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv)
|
||||
{
|
||||
initInit();
|
||||
|
||||
jViewTransformClass = getClassGlobalRef("org/mozilla/gecko/gfx/ViewTransform");
|
||||
|
||||
jXField = getField("x", "F");
|
||||
jYField = getField("y", "F");
|
||||
jScaleField = getField("scale", "F");
|
||||
jFixedLayerMarginLeft = getField("fixedLayerMarginLeft", "F");
|
||||
jFixedLayerMarginTop = getField("fixedLayerMarginTop", "F");
|
||||
jFixedLayerMarginRight = getField("fixedLayerMarginRight", "F");
|
||||
jFixedLayerMarginBottom = getField("fixedLayerMarginBottom", "F");
|
||||
jOffsetXField = getField("offsetX", "F");
|
||||
jOffsetYField = getField("offsetY", "F");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(JNIEnv *jEnv)
|
||||
{
|
||||
initInit();
|
||||
|
||||
jProgressiveUpdateDataClass = getClassGlobalRef("org/mozilla/gecko/gfx/ProgressiveUpdateData");
|
||||
|
||||
jXField = getField("x", "F");
|
||||
jYField = getField("y", "F");
|
||||
jWidthField = getField("width", "F");
|
||||
jHeightField = getField("height", "F");
|
||||
jScaleField = getField("scale", "F");
|
||||
jShouldAbortField = getField("abort", "Z");
|
||||
}
|
||||
|
||||
#undef initInit
|
||||
#undef initClassGlobalRef
|
||||
#undef getField
|
||||
@@ -892,13 +790,6 @@ AndroidPoint::Init(JNIEnv *jenv, jobject jobj)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::Init(jobject jobj)
|
||||
{
|
||||
NS_ASSERTION(wrapped_obj == nullptr, "Init called on non-null wrapped_obj!");
|
||||
wrapped_obj = jobj;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidLayerRendererFrame::Init(JNIEnv *env, jobject jobj)
|
||||
{
|
||||
@@ -920,281 +811,8 @@ AndroidLayerRendererFrame::Dispose(JNIEnv *env)
|
||||
wrapped_obj = 0;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidViewTransform::Init(jobject jobj)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(wrapped_obj == nullptr, "Init called on non-null wrapped_obj!");
|
||||
wrapped_obj = jobj;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidProgressiveUpdateData::Init(jobject jobj)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(wrapped_obj == nullptr, "Init called on non-null wrapped_obj!");
|
||||
wrapped_obj = jobj;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SetFirstPaintViewport(const LayerIntPoint& aOffset, const CSSToLayerScale& aZoom, const CSSRect& aCssPageRect)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SetFirstPaintViewport called on null layer client!");
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
return env->CallVoidMethod(wrapped_obj, jSetFirstPaintViewport, (float)aOffset.x, (float)aOffset.y, aZoom.scale,
|
||||
aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost());
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SetPageRect(const CSSRect& aCssPageRect)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SetPageRect called on null layer client!");
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
return env->CallVoidMethod(wrapped_obj, jSetPageRect,
|
||||
aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost());
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SyncViewportInfo(const LayerIntRect& aDisplayPort, const CSSToLayerScale& aDisplayResolution,
|
||||
bool aLayersUpdated, ScreenPoint& aScrollOffset, CSSToScreenScale& aScale,
|
||||
LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SyncViewportInfo called on null layer client!");
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jobject viewTransformJObj = env->CallObjectMethod(wrapped_obj, jSyncViewportInfoMethod,
|
||||
aDisplayPort.x, aDisplayPort.y,
|
||||
aDisplayPort.width, aDisplayPort.height,
|
||||
aDisplayResolution.scale, aLayersUpdated);
|
||||
if (jniFrame.CheckForException())
|
||||
return;
|
||||
|
||||
NS_ABORT_IF_FALSE(viewTransformJObj, "No view transform object!");
|
||||
|
||||
AndroidViewTransform viewTransform;
|
||||
viewTransform.Init(viewTransformJObj);
|
||||
|
||||
aScrollOffset = ScreenPoint(viewTransform.GetX(env), viewTransform.GetY(env));
|
||||
aScale.scale = viewTransform.GetScale(env);
|
||||
viewTransform.GetFixedLayerMargins(env, aFixedLayerMargins);
|
||||
|
||||
aOffset.x = viewTransform.GetOffsetX(env);
|
||||
aOffset.y = viewTransform.GetOffsetY(env);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SyncFrameMetrics(const ScreenPoint& aScrollOffset, float aZoom, const CSSRect& aCssPageRect,
|
||||
bool aLayersUpdated, const CSSRect& aDisplayPort, const CSSToLayerScale& aDisplayResolution,
|
||||
bool aIsFirstPaint, LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SyncFrameMetrics called on null layer client!");
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
// convert the displayport rect from scroll-relative CSS pixels to document-relative device pixels
|
||||
LayerRect dpUnrounded = aDisplayPort * aDisplayResolution;
|
||||
dpUnrounded += LayerPoint::FromUnknownPoint(aScrollOffset.ToUnknownPoint());
|
||||
LayerIntRect dp = gfx::RoundedToInt(dpUnrounded);
|
||||
|
||||
jobject viewTransformJObj = env->CallObjectMethod(wrapped_obj, jSyncFrameMetricsMethod,
|
||||
aScrollOffset.x, aScrollOffset.y, aZoom,
|
||||
aCssPageRect.x, aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost(),
|
||||
aLayersUpdated, dp.x, dp.y, dp.width, dp.height, aDisplayResolution.scale,
|
||||
aIsFirstPaint);
|
||||
|
||||
if (jniFrame.CheckForException())
|
||||
return;
|
||||
|
||||
NS_ABORT_IF_FALSE(viewTransformJObj, "No view transform object!");
|
||||
|
||||
AndroidViewTransform viewTransform;
|
||||
viewTransform.Init(viewTransformJObj);
|
||||
viewTransform.GetFixedLayerMargins(env, aFixedLayerMargins);
|
||||
aOffset.x = viewTransform.GetOffsetX(env);
|
||||
aOffset.y = viewTransform.GetOffsetY(env);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent,
|
||||
const LayerRect& aDisplayPort,
|
||||
float aDisplayResolution,
|
||||
bool aDrawingCritical,
|
||||
gfx::Rect& aViewport,
|
||||
float& aScaleX,
|
||||
float& aScaleY)
|
||||
{
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return false;
|
||||
|
||||
AutoJObject progressiveUpdateDataJObj(env, env->CallObjectMethod(wrapped_obj,
|
||||
jProgressiveUpdateCallbackMethod,
|
||||
aHasPendingNewThebesContent,
|
||||
(float)aDisplayPort.x,
|
||||
(float)aDisplayPort.y,
|
||||
(float)aDisplayPort.width,
|
||||
(float)aDisplayPort.height,
|
||||
aDisplayResolution,
|
||||
!aDrawingCritical));
|
||||
if (env->ExceptionCheck()) {
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_ABORT_IF_FALSE(progressiveUpdateDataJObj, "No progressive update data!");
|
||||
|
||||
AndroidProgressiveUpdateData progressiveUpdateData(progressiveUpdateDataJObj);
|
||||
|
||||
aViewport.x = progressiveUpdateData.GetX(env);
|
||||
aViewport.y = progressiveUpdateData.GetY(env);
|
||||
aViewport.width = progressiveUpdateData.GetWidth(env);
|
||||
aViewport.height = progressiveUpdateData.GetHeight(env);
|
||||
aScaleX = aScaleY = progressiveUpdateData.GetScale(env);
|
||||
|
||||
return progressiveUpdateData.GetShouldAbort(env);
|
||||
}
|
||||
|
||||
jobject ConvertToJavaViewportMetrics(JNIEnv* env, nsIAndroidViewport* metrics) {
|
||||
float x, y, width, height,
|
||||
pageLeft, pageTop, pageRight, pageBottom,
|
||||
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
||||
zoom;
|
||||
metrics->GetX(&x);
|
||||
metrics->GetY(&y);
|
||||
metrics->GetWidth(&width);
|
||||
metrics->GetHeight(&height);
|
||||
metrics->GetPageLeft(&pageLeft);
|
||||
metrics->GetPageTop(&pageTop);
|
||||
metrics->GetPageRight(&pageRight);
|
||||
metrics->GetPageBottom(&pageBottom);
|
||||
metrics->GetCssPageLeft(&cssPageLeft);
|
||||
metrics->GetCssPageTop(&cssPageTop);
|
||||
metrics->GetCssPageRight(&cssPageRight);
|
||||
metrics->GetCssPageBottom(&cssPageBottom);
|
||||
metrics->GetZoom(&zoom);
|
||||
|
||||
jobject jobj = env->NewObject(AndroidGeckoLayerClient::jViewportClass, AndroidGeckoLayerClient::jViewportCtor,
|
||||
pageLeft, pageTop, pageRight, pageBottom,
|
||||
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
||||
x, y, x + width, y + height,
|
||||
zoom);
|
||||
return jobj;
|
||||
}
|
||||
|
||||
class nsAndroidDisplayport MOZ_FINAL : public nsIAndroidDisplayport
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
virtual nsresult GetLeft(float *aLeft) { *aLeft = mLeft; return NS_OK; }
|
||||
virtual nsresult GetTop(float *aTop) { *aTop = mTop; return NS_OK; }
|
||||
virtual nsresult GetRight(float *aRight) { *aRight = mRight; return NS_OK; }
|
||||
virtual nsresult GetBottom(float *aBottom) { *aBottom = mBottom; return NS_OK; }
|
||||
virtual nsresult GetResolution(float *aResolution) { *aResolution = mResolution; return NS_OK; }
|
||||
virtual nsresult SetLeft(float aLeft) { mLeft = aLeft; return NS_OK; }
|
||||
virtual nsresult SetTop(float aTop) { mTop = aTop; return NS_OK; }
|
||||
virtual nsresult SetRight(float aRight) { mRight = aRight; return NS_OK; }
|
||||
virtual nsresult SetBottom(float aBottom) { mBottom = aBottom; return NS_OK; }
|
||||
virtual nsresult SetResolution(float aResolution) { mResolution = aResolution; return NS_OK; }
|
||||
|
||||
nsAndroidDisplayport(AndroidRectF aRect, float aResolution):
|
||||
mLeft(aRect.Left()), mTop(aRect.Top()), mRight(aRect.Right()), mBottom(aRect.Bottom()), mResolution(aResolution) {}
|
||||
|
||||
private:
|
||||
~nsAndroidDisplayport() {}
|
||||
float mLeft, mTop, mRight, mBottom, mResolution;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAndroidDisplayport, nsIAndroidDisplayport)
|
||||
|
||||
void createDisplayPort(AutoLocalJNIFrame *jniFrame, jobject jobj, nsIAndroidDisplayport** displayPort) {
|
||||
JNIEnv* env = jniFrame->GetEnv();
|
||||
AndroidRectF rect(env, env->GetObjectField(jobj, AndroidGeckoLayerClient::jDisplayportPosition));
|
||||
if (jniFrame->CheckForException()) return;
|
||||
float resolution = env->GetFloatField(jobj, AndroidGeckoLayerClient::jDisplayportResolution);
|
||||
if (jniFrame->CheckForException()) return;
|
||||
*displayPort = new nsAndroidDisplayport(rect, resolution);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::GetDisplayPort(AutoLocalJNIFrame *jniFrame, bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort)
|
||||
{
|
||||
jobject jmetrics = ConvertToJavaViewportMetrics(jniFrame->GetEnv(), metrics);
|
||||
if (jniFrame->CheckForException()) return;
|
||||
if (!jmetrics)
|
||||
return;
|
||||
jobject jobj = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jGetDisplayPort, aPageSizeUpdate, aIsBrowserContentDisplayed, tabId, jmetrics);
|
||||
if (jniFrame->CheckForException()) return;
|
||||
createDisplayPort(jniFrame, jobj, displayPort);
|
||||
(*displayPort)->AddRef();
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::ContentDocumentChanged(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jContentDocumentChanged);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::IsContentDocumentDisplayed(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
return jniFrame->GetEnv()->CallBooleanMethod(wrapped_obj, jIsContentDocumentDisplayed);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jobject frameJObj = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jCreateFrameMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
NS_ABORT_IF_FALSE(frameJObj, "No frame object!");
|
||||
|
||||
aFrame.Init(jniFrame->GetEnv(), frameJObj);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::ActivateProgram(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jActivateProgramMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::DeactivateProgram(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return false;
|
||||
|
||||
jniFrame->GetEnv()->CallVoidMethod(wrapped_obj, jDeactivateProgramMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidLayerRendererFrame::BeginDrawing(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
@@ -1247,106 +865,6 @@ AndroidLayerRendererFrame::EndDrawing(AutoLocalJNIFrame *jniFrame)
|
||||
return true;
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetX(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jXField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetY(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jYField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetScale(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jScaleField);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidViewTransform::GetFixedLayerMargins(JNIEnv *env, LayerMargin &aFixedLayerMargins)
|
||||
{
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
aFixedLayerMargins.top = env->GetFloatField(wrapped_obj, jFixedLayerMarginTop);
|
||||
aFixedLayerMargins.right = env->GetFloatField(wrapped_obj, jFixedLayerMarginRight);
|
||||
aFixedLayerMargins.bottom = env->GetFloatField(wrapped_obj, jFixedLayerMarginBottom);
|
||||
aFixedLayerMargins.left = env->GetFloatField(wrapped_obj, jFixedLayerMarginLeft);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetOffsetX(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jOffsetXField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidViewTransform::GetOffsetY(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jOffsetYField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetX(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jXField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetY(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jYField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetWidth(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jWidthField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetHeight(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jHeightField);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetScale(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return 0.0f;
|
||||
return env->GetFloatField(wrapped_obj, jScaleField);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidProgressiveUpdateData::GetShouldAbort(JNIEnv *env)
|
||||
{
|
||||
if (!env)
|
||||
return false;
|
||||
return env->GetBooleanField(wrapped_obj, jShouldAbortField);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidRect::Init(JNIEnv *jenv, jobject jobj)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user