Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2052)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java

Issue 2228823003: When possible, draw the toolbar shadow with the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
index b5c41b85f737337db260541c8376243f7baf1a8c..37e2fbed09f242fe337e7787b54edc1ac02f4862 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
@@ -68,6 +68,8 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
private final int mId;
private final boolean mIsIncognito;
+ private final boolean mIsNative;
+ private boolean mNeedsToolbarShadow;
// Fields initialized in init()
private float mScale;
@@ -146,6 +148,7 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
*
* @param tabId The id of the source {@link Tab}.
* @param isIncognito Whether the tab in the in the incognito stack.
+ * @param isNative Whether the tab a native page.
* @param maxContentTextureWidth The maximum width for drawing the content.
* @param maxContentTextureHeight The maximum height for drawing the content.
* @param showCloseButton Whether a close button should be displayed in the corner.
@@ -153,10 +156,11 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
* optimization to save cycles and memory. This is
* ignored if the title texture is already set.
*/
- public LayoutTab(int tabId, boolean isIncognito, float maxContentTextureWidth,
+ public LayoutTab(int tabId, boolean isIncognito, boolean isNative, float maxContentTextureWidth,
float maxContentTextureHeight, boolean showCloseButton, boolean isTitleNeeded) {
mId = tabId;
mIsIncognito = isIncognito;
+ mIsNative = isNative;
init(maxContentTextureWidth, maxContentTextureHeight, showCloseButton, isTitleNeeded);
}
@@ -212,6 +216,7 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
* Initializes the {@link LayoutTab} from data extracted from a {@link Tab}.
* As this function may be expensive and can be delayed we initialize it as a separately.
*
+ * @param needsToolbarShadow Whether the tab will need the toolbar shadow.
* @param backgroundColor The color of the page background.
* @param fallbackThumbnailId The id of a cached thumbnail to show if the current
* thumbnail is unavailable, or {@link Tab.INVALID_TAB_ID}
@@ -221,8 +226,10 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
* @param canUseLiveTexture Whether the tab can use a live texture when being displayed.
* @return True if the init requires the compositor to update.
*/
- public boolean initFromHost(int backgroundColor, boolean shouldStall, boolean canUseLiveTexture,
- int toolbarBackgroundColor, int textBoxBackgroundColor, float textBoxAlpha) {
+ public boolean initFromHost(boolean needsToolbarShadow, int backgroundColor,
+ boolean shouldStall, boolean canUseLiveTexture, int toolbarBackgroundColor,
+ int textBoxBackgroundColor, float textBoxAlpha) {
+ mNeedsToolbarShadow = needsToolbarShadow;
mBackgroundColor = backgroundColor;
boolean needsUpdate = false;
@@ -497,6 +504,20 @@ public class LayoutTab implements ChromeAnimation.Animatable<LayoutTab.Property>
}
/**
+ * @return Whether the underlying tab is a native page.
+ */
+ public boolean isNativePage() {
+ return mIsNative;
+ }
+
+ /**
+ * @return Whether the underlying tab needs to draw the toolbar shadow.
+ */
+ public boolean needsToolbarShadow() {
+ return mNeedsToolbarShadow;
+ }
+
+ /**
* @param y The vertical draw position.
*/
public void setY(float y) {

Powered by Google App Engine
This is Rietveld 408576698