Bug 1158309 - Initialize LayerView sooner; r=snorp

This commit is contained in:
Jim Chen 2015-04-30 13:01:01 -04:00
parent 9fa1496350
commit 8b64ccfb1e
2 changed files with 11 additions and 11 deletions

View File

@ -1275,6 +1275,7 @@ public abstract class GeckoApp
mRootLayout = (OuterLayout) findViewById(R.id.root_layout);
mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout);
mMainLayout = (RelativeLayout) findViewById(R.id.main_layout);
mLayerView = (LayerView) findViewById(R.id.layer_view);
// Determine whether we should restore tabs.
mShouldRestore = getSessionRestoreState(savedInstanceState);
@ -1414,13 +1415,12 @@ public abstract class GeckoApp
}
}
if (mLayerView == null) {
LayerView layerView = (LayerView) findViewById(R.id.layer_view);
layerView.initializeView(EventDispatcher.getInstance());
mLayerView = layerView;
GeckoAppShell.sendEventToGecko(GeckoEvent.createObjectEvent(
GeckoEvent.ACTION_OBJECT_LAYER_CLIENT, layerView.getLayerClientObject()));
}
// XXX our editor tests require the GeckoView to have focus to pass, so we have to
// manually shift focus to the GeckoView. requestFocus apparently doesn't work at
// this stage of starting up, so we have to unset and reset the focusability.
mLayerView.setFocusable(false);
mLayerView.setFocusable(true);
mLayerView.setFocusableInTouchMode(true);
}
/**

View File

@ -122,6 +122,10 @@ public class GeckoView extends LayerView
// Perform common initialization for Fennec/GeckoView.
GeckoAppShell.setLayerView(this);
initializeView(EventDispatcher.getInstance());
GeckoAppShell.sendEventToGecko(GeckoEvent.createObjectEvent(
GeckoEvent.ACTION_OBJECT_LAYER_CLIENT, getLayerClientObject()));
// TODO: Fennec currently takes care of its own initialization, so this
// flag is a hack used in Fennec to prevent GeckoView initialization.
// This should go away once Fennec also uses GeckoView for
@ -181,13 +185,9 @@ public class GeckoView extends LayerView
"Accessibility:Ready",
"GeckoView:Message");
initializeView(EventDispatcher.getInstance());
if (GeckoThread.launch()) {
// This is the first launch, so finish initialization and go.
GeckoProfile profile = GeckoProfile.get(context).forceCreate();
GeckoAppShell.sendEventToGecko(GeckoEvent.createObjectEvent(
GeckoEvent.ACTION_OBJECT_LAYER_CLIENT, getLayerClientObject()));
} else if (GeckoThread.checkLaunchState(GeckoThread.LaunchState.GeckoRunning)) {
// If Gecko is already running, that means the Activity was