Skip to content

Commit

Permalink
Fix black quad on the browser window before the first composite. (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Nov 22, 2018
1 parent a38266e commit e92f5a3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,15 @@ public void onCrash(GeckoSession session) {
removeSession(crashedSessionId);
}

@Override
public void onFirstComposite(GeckoSession aSession) {
if (mCurrentSession == aSession) {
for (GeckoSession.ContentDelegate listener : mContentListeners) {
listener.onFirstComposite(aSession);
}
}
}

// TextInput Delegate

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@


public class BrowserWidget extends UIWidget implements SessionStore.SessionChangeListener,
GeckoSession.PromptDelegate, WidgetManagerDelegate.UpdateListener, BookmarkListener {
GeckoSession.ContentDelegate, GeckoSession.PromptDelegate, WidgetManagerDelegate.UpdateListener,
BookmarkListener {

private static final String LOGTAG = "VRB";

Expand All @@ -47,6 +48,7 @@ public class BrowserWidget extends UIWidget implements SessionStore.SessionChang
private int mBorderWidth;
private BookmarksWidget mBookmarksWidget;
private float mMultiplier;
Runnable mFirstDrawCallback;

public BrowserWidget(Context aContext, int aSessionId) {
super(aContext);
Expand All @@ -55,6 +57,7 @@ public BrowserWidget(Context aContext, int aSessionId) {
mBorderWidth = SettingsStore.getInstance(aContext).getLayersEnabled() ? 1 : 0;
SessionStore.get().addSessionChangeListener(this);
SessionStore.get().addPromptListener(this);
SessionStore.get().addContentListener(this);
mWidgetManager.addUpdateListener(this);
setFocusable(true);
GeckoSession session = SessionStore.get().getSession(mSessionId);
Expand Down Expand Up @@ -222,6 +225,7 @@ public void setSurface(Surface aSurface, final int aWidth, final int aHeight, Ru
mWidth = aWidth;
mHeight = aHeight;
mSurface = aSurface;
mFirstDrawCallback = aFirstDrawCallback;
if (mDisplay == null) {
mDisplay = session.acquireDisplay();
} else {
Expand All @@ -232,9 +236,6 @@ public void setSurface(Surface aSurface, final int aWidth, final int aHeight, Ru
} else {
mDisplay.surfaceDestroyed();
}
if (aFirstDrawCallback != null) {
aFirstDrawCallback.run();
}
}

private void callSurfaceChanged() {
Expand Down Expand Up @@ -304,6 +305,7 @@ public void handleResizeEvent(float aWorldWidth, float aWorldHeight) {
public void releaseWidget() {
SessionStore.get().removeSessionChangeListener(this);
SessionStore.get().removePromptListener(this);
SessionStore.get().removeContentListener(this);
mWidgetManager.removeUpdateListener(this);
GeckoSession session = SessionStore.get().getSession(mSessionId);
if (session == null) {
Expand Down Expand Up @@ -563,4 +565,48 @@ public void onWidgetUpdate(Widget aWidget) {
mWidgetPlacement.height = aWidget.getPlacement().height;
mWidgetManager.updateWidget(this);
}

// GeckoSession.ContentDelegate
@Override
public void onTitleChange(GeckoSession session, String title) {

}

@Override
public void onFocusRequest(GeckoSession session) {

}

@Override
public void onCloseRequest(GeckoSession session) {

}

@Override
public void onFullScreen(GeckoSession session, boolean fullScreen) {

}

@Override
public void onContextMenu(GeckoSession session, int screenX, int screenY, String uri, int elementType, String elementSrc) {

}

@Override
public void onExternalResponse(GeckoSession session, GeckoSession.WebResponseInfo response) {

}

@Override
public void onCrash(GeckoSession session) {

}

@Override
public void onFirstComposite(GeckoSession session) {
if (mFirstDrawCallback != null) {
mFirstDrawCallback.run();
mFirstDrawCallback = null;
}
}
}

0 comments on commit e92f5a3

Please sign in to comment.