mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 1297850 - part 2, Background is no longer cleared by Java. Remove unused setBackgroundColor. r=jchen
This commit is contained in:
parent
4839c748eb
commit
d755533d9f
@ -367,14 +367,6 @@ public abstract class GeckoApp
|
||||
mFormAssistPopup.hide();
|
||||
break;
|
||||
|
||||
case LOADED:
|
||||
// Sync up the layer view and the tab if the tab is
|
||||
// currently displayed.
|
||||
LayerView layerView = mLayerView;
|
||||
if (layerView != null && Tabs.getInstance().isSelectedTab(tab))
|
||||
layerView.setBackgroundColor(tab.getBackgroundColor());
|
||||
break;
|
||||
|
||||
case DESKTOP_MODE_CHANGE:
|
||||
if (Tabs.getInstance().isSelectedTab(tab))
|
||||
invalidateOptionsMenu();
|
||||
|
@ -13,11 +13,6 @@ import org.mozilla.gecko.db.BrowserDB;
|
||||
public class PrivateTab extends Tab {
|
||||
public PrivateTab(Context context, int id, String url, boolean external, int parentId, String title) {
|
||||
super(context, id, url, external, parentId, title);
|
||||
|
||||
// Init background to private_toolbar_grey to ensure flicker-free
|
||||
// private tab creation. Page loads will reset it to white as expected.
|
||||
final int bgColor = ContextCompat.getColor(context, R.color.tabs_tray_grey_pressed);
|
||||
setBackgroundColor(bgColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,7 +74,6 @@ public class Tab {
|
||||
private ZoomConstraints mZoomConstraints;
|
||||
private boolean mIsRTL;
|
||||
private final ArrayList<View> mPluginViews;
|
||||
private int mBackgroundColor;
|
||||
private int mState;
|
||||
private Bitmap mThumbnailBitmap;
|
||||
private boolean mDesktopMode;
|
||||
@ -116,8 +115,6 @@ public class Tab {
|
||||
public static final int LOAD_PROGRESS_LOADED = 80;
|
||||
public static final int LOAD_PROGRESS_STOP = 100;
|
||||
|
||||
private static final int DEFAULT_BACKGROUND_COLOR = Color.WHITE;
|
||||
|
||||
public enum ErrorType {
|
||||
CERT_ERROR, // Pages with certificate problems
|
||||
BLOCKED, // Pages blocked for phishing or malware warnings
|
||||
@ -143,11 +140,6 @@ public class Tab {
|
||||
mState = shouldShowProgress(url) ? STATE_LOADING : STATE_SUCCESS;
|
||||
mLoadProgress = LOAD_PROGRESS_INIT;
|
||||
|
||||
// At startup, the background is set to a color specified by LayerView
|
||||
// when the LayerView is created. Shortly after, this background color
|
||||
// will be used before the tab's content is shown.
|
||||
mBackgroundColor = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
updateBookmark();
|
||||
}
|
||||
|
||||
@ -698,7 +690,6 @@ public class Tab {
|
||||
setSiteLogins(null);
|
||||
setZoomConstraints(new ZoomConstraints(true));
|
||||
setHasTouchListeners(false);
|
||||
setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
|
||||
setErrorType(ErrorType.NONE);
|
||||
setLoadProgressIfLoading(LOAD_PROGRESS_LOCATION_CHANGE);
|
||||
|
||||
@ -803,38 +794,6 @@ public class Tab {
|
||||
return mPluginViews.toArray(new View[mPluginViews.size()]);
|
||||
}
|
||||
|
||||
public int getBackgroundColor() {
|
||||
return mBackgroundColor;
|
||||
}
|
||||
|
||||
/** Sets a new color for the background. */
|
||||
public void setBackgroundColor(int color) {
|
||||
mBackgroundColor = color;
|
||||
}
|
||||
|
||||
/** Parses and sets a new color for the background. */
|
||||
public void setBackgroundColor(String newColor) {
|
||||
setBackgroundColor(parseColorFromGecko(newColor));
|
||||
}
|
||||
|
||||
// Parses a color from an RGB triple of the form "rgb([0-9]+, [0-9]+, [0-9]+)". If the color
|
||||
// cannot be parsed, returns white.
|
||||
private static int parseColorFromGecko(String string) {
|
||||
if (sColorPattern == null) {
|
||||
sColorPattern = Pattern.compile("rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)");
|
||||
}
|
||||
|
||||
Matcher matcher = sColorPattern.matcher(string);
|
||||
if (!matcher.matches()) {
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
||||
int r = Integer.parseInt(matcher.group(1));
|
||||
int g = Integer.parseInt(matcher.group(2));
|
||||
int b = Integer.parseInt(matcher.group(3));
|
||||
return Color.rgb(r, g, b);
|
||||
}
|
||||
|
||||
public void setDesktopMode(boolean enabled) {
|
||||
mDesktopMode = enabled;
|
||||
}
|
||||
|
@ -111,7 +111,6 @@ public class Tabs implements GeckoEventListener {
|
||||
"Content:StateChange",
|
||||
"Content:LoadError",
|
||||
"Content:PageShow",
|
||||
"DOMContentLoaded",
|
||||
"DOMTitleChanged",
|
||||
"Link:Favicon",
|
||||
"Link:Feed",
|
||||
@ -518,18 +517,6 @@ public class Tabs implements GeckoEventListener {
|
||||
tab.setLoadedFromCache(message.getBoolean("fromCache"));
|
||||
tab.updateUserRequested(message.getString("userRequested"));
|
||||
notifyListeners(tab, TabEvents.PAGE_SHOW);
|
||||
} else if (event.equals("DOMContentLoaded")) {
|
||||
tab.handleContentLoaded();
|
||||
String backgroundColor = message.getString("bgColor");
|
||||
if (backgroundColor != null) {
|
||||
tab.setBackgroundColor(backgroundColor);
|
||||
} else {
|
||||
// Default to white if no color is given
|
||||
tab.setBackgroundColor(Color.WHITE);
|
||||
}
|
||||
tab.setErrorType(message.optString("errorType"));
|
||||
tab.setMetadata(message.optJSONObject("metadata"));
|
||||
notifyListeners(tab, Tabs.TabEvents.LOADED);
|
||||
} else if (event.equals("DOMTitleChanged")) {
|
||||
tab.updateTitle(message.getString("title"));
|
||||
} else if (event.equals("Link:Favicon")) {
|
||||
|
@ -362,10 +362,6 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
|
||||
setViewportMetrics(newMetrics);
|
||||
|
||||
if (tab != null) {
|
||||
mView.setBackgroundColor(tab.getBackgroundColor());
|
||||
}
|
||||
|
||||
// Indicate that the document is about to be composited so the
|
||||
// LayerView background can be removed.
|
||||
if (mView.getPaintState() == LayerView.PAINT_START) {
|
||||
|
@ -55,7 +55,6 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
||||
private LayerRenderer mRenderer;
|
||||
/* Must be a PAINT_xxx constant */
|
||||
private int mPaintState;
|
||||
private int mBackgroundColor;
|
||||
private FullScreenState mFullScreenState;
|
||||
|
||||
private SurfaceView mSurfaceView;
|
||||
@ -171,7 +170,6 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
||||
super(context, attrs);
|
||||
|
||||
mPaintState = PAINT_START;
|
||||
mBackgroundColor = Color.WHITE;
|
||||
mFullScreenState = FullScreenState.NONE;
|
||||
|
||||
if (Versions.feature14Plus) {
|
||||
@ -385,16 +383,6 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
|
||||
return mLayerClient.getMatrixForLayerRectToViewRect();
|
||||
}
|
||||
|
||||
int getBackgroundColor() {
|
||||
return mBackgroundColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(int newColor) {
|
||||
mBackgroundColor = newColor;
|
||||
requestRender();
|
||||
}
|
||||
|
||||
void setSurfaceBackgroundColor(int newColor) {
|
||||
if (mSurfaceView != null) {
|
||||
mSurfaceView.setBackgroundColor(newColor);
|
||||
|
Loading…
Reference in New Issue
Block a user