diff options
author | newt <newt@chromium.org> | 2015-12-17 17:39:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-18 01:40:25 +0000 |
commit | a00d675dd71a328bc09b1de793756f98ce79caf2 (patch) | |
tree | 31c0d241558d38705556290b5e90372dba861f53 | |
parent | 3843192fb540302ab1e488e9d1d34afb789c6e45 (diff) | |
download | chromium_src-a00d675dd71a328bc09b1de793756f98ce79caf2.zip chromium_src-a00d675dd71a328bc09b1de793756f98ce79caf2.tar.gz chromium_src-a00d675dd71a328bc09b1de793756f98ce79caf2.tar.bz2 |
Use hex ints instead of Color.rgb().
This replaces calls to Color.rgb() that generate fixed colors with hex
int representations of those colors. E.g. Color.rgb(255, 0, 0) becomes
0xFFFF0000. This follows the pattern typically used in our code, and
allows the colors to be inlined constants instead of requiring runtime
computation.
BUG=
Review URL: https://codereview.chromium.org/1529353003
Cr-Commit-Position: refs/heads/master@{#365972}
8 files changed, 15 insertions, 19 deletions
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java index abf9094..f417b69 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java @@ -4,7 +4,6 @@ package org.chromium.android_webview.test; -import android.graphics.Color; import android.test.suitebuilder.annotation.SmallTest; import android.view.View; import android.view.ViewGroup.LayoutParams; @@ -321,7 +320,7 @@ public class AndroidViewIntegrationTest extends AwTestBase { mOnContentSizeChangedHelper, expectedWidthCss, expectedHeightCss, false); GraphicsTestUtils.pollForBackgroundColor( - testContainerView.getAwContents(), Color.rgb(0x22, 0x77, 0x88)); + testContainerView.getAwContents(), 0xFF227788); } @SmallTest diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java index a1a6c07..47aefc5 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java @@ -63,16 +63,15 @@ public class AwContentsRenderTest extends AwTestBase { loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), "data:text/html,<html><head><style>body {background-color:#227788}</style></head>" + "<body></body></html>"); - GraphicsTestUtils.pollForBackgroundColor(mAwContents, Color.rgb(0x22, 0x77, 0x88)); + final int teal = 0xFF227788; + GraphicsTestUtils.pollForBackgroundColor(mAwContents, teal); // Changing the base background should not override CSS background. setBackgroundColorOnUiThread(Color.MAGENTA); - assertEquals(Color.rgb(0x22, 0x77, 0x88), - GraphicsTestUtils.sampleBackgroundColorOnUiThread(mAwContents)); + assertEquals(teal, GraphicsTestUtils.sampleBackgroundColorOnUiThread(mAwContents)); // ...setting the background is asynchronous, so pause a bit and retest just to be sure. Thread.sleep(500); - assertEquals(Color.rgb(0x22, 0x77, 0x88), - GraphicsTestUtils.sampleBackgroundColorOnUiThread(mAwContents)); + assertEquals(teal, GraphicsTestUtils.sampleBackgroundColorOnUiThread(mAwContents)); } @SmallTest diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivityIcon.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivityIcon.java index 59cb08b..8a0b0c0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivityIcon.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivityIcon.java @@ -6,7 +6,6 @@ package org.chromium.chrome.browser.document; import android.content.Context; import android.graphics.Bitmap; -import android.graphics.Color; import android.text.TextUtils; import org.chromium.chrome.browser.widget.RoundedIconGenerator; @@ -19,7 +18,7 @@ public class DocumentActivityIcon { private static final int APP_ICON_SIZE_DP = 64; private static final int APP_ICON_CORNER_RADIUS_DP = 3; private static final int APP_ICON_TEXT_SIZE_DP = 30; - private static final int APP_ICON_DEFAULT_BACKGROUND_COLOR = Color.rgb(50, 50, 50); + private static final int APP_ICON_DEFAULT_BACKGROUND_COLOR = 0xFF323232; private Context mContext; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java index 8f14aa0..66145cc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java @@ -11,7 +11,6 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; -import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.text.Spannable; @@ -58,7 +57,7 @@ public class NotificationUIManager { // that it was set by us. private static final String PLATFORM_TAG_PREFIX = NotificationUIManager.class.getSimpleName(); - private static final int NOTIFICATION_ICON_BG_COLOR = Color.rgb(150, 150, 150); + private static final int NOTIFICATION_ICON_BG_COLOR = 0xFF969696; private static final int NOTIFICATION_TEXT_SIZE_DP = 28; // We always use the same request code for pending intents. We use other ways to force diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java index 2c7a9bb..f55d4fd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java @@ -128,9 +128,9 @@ public class LocationBarLayout extends FrameLayout implements OnClickListener, // response (as opposed to treating it like a typed string in the Omnibox). private static final float VOICE_SEARCH_CONFIDENCE_NAVIGATE_THRESHOLD = 0.9f; - private static final int CONTENT_OVERLAY_COLOR = Color.argb(166, 0, 0, 0); - private static final int OMNIBOX_RESULTS_BG_COLOR = Color.rgb(245, 245, 246); - private static final int OMNIBOX_INCOGNITO_RESULTS_BG_COLOR = Color.rgb(50, 50, 50); + private static final int CONTENT_OVERLAY_COLOR = 0xA6000000; + private static final int OMNIBOX_RESULTS_BG_COLOR = 0xFFF5F5F6; + private static final int OMNIBOX_INCOGNITO_RESULTS_BG_COLOR = 0xFF323232; /** * URI schemes that ContentView can handle. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java index fd4762c..f030ca0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java @@ -55,9 +55,9 @@ class SuggestionView extends ViewGroup { private static final long RELAYOUT_DELAY_MS = 20; - private static final int TITLE_COLOR_STANDARD_FONT_DARK = Color.rgb(51, 51, 51); - private static final int TITLE_COLOR_STANDARD_FONT_LIGHT = Color.rgb(255, 255, 255); - private static final int URL_COLOR = Color.rgb(85, 149, 254); + private static final int TITLE_COLOR_STANDARD_FONT_DARK = 0xFF333333; + private static final int TITLE_COLOR_STANDARD_FONT_LIGHT = 0xFFFFFFFF; + private static final int URL_COLOR = 0xFF5595FE; private static final int ANSWER_IMAGE_HORIZONTAL_SPACING_DP = 4; private static final int ANSWER_IMAGE_VERTICAL_SPACING_DP = 5; diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java index 4959da3..2499491 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java @@ -23,7 +23,7 @@ public class WebappSplashScreenBackgroundColorTest extends WebappActivityTestBas protected Intent createIntent() { Intent intent = super.createIntent(); // This is setting Color.GREEN with 50% opacity. - intent.putExtra(ShortcutHelper.EXTRA_BACKGROUND_COLOR, (long) Color.argb(128, 0, 255, 0)); + intent.putExtra(ShortcutHelper.EXTRA_BACKGROUND_COLOR, 0x8000FF00L); return intent; } diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java index d6600c9..3faea04 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java @@ -35,7 +35,7 @@ public class WebappSplashScreenThemeColorTest extends WebappActivityTestBase { Intent intent = super.createIntent(); intent.putExtra(ShortcutHelper.EXTRA_URL, "http://localhost"); // This is setting Color.Magenta with 50% opacity. - intent.putExtra(ShortcutHelper.EXTRA_THEME_COLOR, (long) Color.argb(128, 255, 0, 255)); + intent.putExtra(ShortcutHelper.EXTRA_THEME_COLOR, 0x80FF00FFL); return intent; } |