Auto merge of #21658 - paulrouget:loaduri, r=jdm

Save initial URI even for all loadUri methods

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21658)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-09-10 10:39:24 -04:00 committed by GitHub
commit f37124563b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ public class ServoSurface {
private Servo mServo;
private Client mClient = null;
private String mServoArgs = "";
private Uri mInitialUri = null;
private String mInitialUri = null;
private Activity mActivity;
public ServoSurface(Surface surface, int width, int height) {
@ -82,7 +82,15 @@ public class ServoSurface {
}
public void loadUri(String uri) {
mServo.loadUri(uri);
if (mServo != null) {
mServo.loadUri(uri);
} else {
mInitialUri = uri;
}
}
public void loadUri(Uri uri) {
loadUri(uri.toString());
}
public void scrollStart(int dx, int dy, int x, int y) {
@ -105,14 +113,6 @@ public class ServoSurface {
mServo.resize(width, height);
}
public void loadUri(Uri uri) {
if (mServo != null) {
mServo.loadUri(uri.toString());
} else {
mInitialUri = uri;
}
}
static class GLSurface implements GfxCallbacks {
private EGLConfig[] mEGLConfigs;
private EGLDisplay mEglDisplay;
@ -196,15 +196,14 @@ public class ServoSurface {
GLSurface surface = new GLSurface(mASurface);
final boolean showLogs = true;
String uri = mInitialUri == null ? null : mInitialUri.toString();
mGLLooperHandler = new Handler() {
public void handleMessage(Message msg) {
}
};
inUIThread(() -> {
final boolean showLogs = true;
String uri = mInitialUri == null ? null : mInitialUri;
mServo = new Servo(this, surface, mClient, mActivity, mServoArgs, uri, mWidth, mHeight, showLogs);
});