Bug 1299922 - Keep surface covered until it has been painted when switching tabs in Fennec r=jchen

This commit is contained in:
Randall Barker 2016-09-01 16:31:15 -07:00
parent 8adc72b766
commit 6e384a2633
2 changed files with 14 additions and 2 deletions

View File

@ -259,7 +259,7 @@ public class Tabs implements GeckoEventListener {
notifyListeners(tab, TabEvents.SELECTED);
if (mLayerView != null) {
mLayerView.setClearColor(tab.isPrivate() ? mPrivateClearColor : Color.WHITE);
mLayerView.setClearColor(getTabColor(tab));
}
if (oldTab != null) {
@ -672,6 +672,10 @@ public class Tabs implements GeckoEventListener {
// are also selected/unselected, so it would be redundant to also listen
// for ADDED/CLOSED events.
case SELECTED:
if (mLayerView != null) {
mLayerView.setSurfaceBackgroundColor(getTabColor(tab));
mLayerView.setPaintState(LayerView.PAINT_START);
}
queuePersistAllTabs();
case UNSELECTED:
tab.onChange();
@ -983,4 +987,12 @@ public class Tabs implements GeckoEventListener {
public static int getNextTabId() {
return sTabId.getAndIncrement();
}
private int getTabColor(Tab tab) {
if (tab != null) {
return tab.isPrivate() ? mPrivateClearColor : Color.WHITE;
}
return Color.WHITE;
}
}

View File

@ -394,7 +394,7 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
return mLayerClient.getMatrixForLayerRectToViewRect();
}
void setSurfaceBackgroundColor(int newColor) {
public void setSurfaceBackgroundColor(int newColor) {
if (mSurfaceView != null) {
mSurfaceView.setBackgroundColor(newColor);
}