Bug 868342 - (Part 2) Get rid of displayTitle variable. r=wesj
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Wed, 08 May 2013 15:53:27 -0400
changeset 138064 a23eea95bf64672dcab5fedfad76339028c9593b
parent 138063 1c8df5e637a21782acfec5fc13d333b3eb489780
child 138065 14417f00ec418970b82851cb08daa66d67578dff
push id3752
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 17:21:10 +0000
treeherdermozilla-aurora@1580544aef0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs868342
milestone23.0a1
Bug 868342 - (Part 2) Get rid of displayTitle variable. r=wesj
mobile/android/base/BrowserToolbar.java
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -878,54 +878,52 @@ public class BrowserToolbar implements T
         visible &= !(url == null || (url.startsWith("about:") && 
                      !url.equals("about:blank")));
 
         if ((mShadow.getVisibility() == View.VISIBLE) != visible) {
             mShadow.setVisibility(visible ? View.VISIBLE : View.GONE);
         }
     }
 
-    private void setTitle(String title) {
+    private void setTitle(CharSequence title) {
         Tab tab = Tabs.getInstance().getSelectedTab();
-        CharSequence displayTitle = title;
 
         if (tab != null) {
             // Keep the title unchanged if the tab is entering reader mode
             if (tab.isEnteringReaderMode()) {
                 return;
             }
 
             // Setting a null title will ensure we just see the "Enter Search or Address"
             // placeholder text. Because "about:home" and "about:privatebrowsing" don't
             // have titles, their display titles will always match their URLs.
             if ("about:home".equals(title) || "about:privatebrowsing".equals(title)) {
-                displayTitle = null;
+                title = null;
             }
 
-            if (mShowUrl && displayTitle != null) {
+            if (mShowUrl && title != null) {
                 title = StringUtils.stripScheme(tab.getURL());
-                title = StringUtils.stripCommonSubdomains(title);
-                displayTitle = title;
+                title = StringUtils.stripCommonSubdomains(title.toString());
 
                 // highlight the domain name if we find one
                 String baseDomain = tab.getBaseDomain();
                 if (!TextUtils.isEmpty(baseDomain)) {
                     SpannableStringBuilder builder = new SpannableStringBuilder(title);
-                    int index = title.indexOf(baseDomain);
+                    int index = title.toString().indexOf(baseDomain);
                     if (index > -1) {
                         builder.setSpan(mUrlColor, 0, title.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
                         builder.setSpan(tab.isPrivate() ? mPrivateDomainColor : mDomainColor, index, index+baseDomain.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
 
-                        displayTitle = builder;
+                        title = builder;
                     }
                 }
             }
         }
 
-        mTitle.setText(displayTitle);
+        mTitle.setText(title);
         mLayout.setContentDescription(title != null ? title : mTitle.getHint());
     }
 
     private void setFavicon(Bitmap image) {
         if (Tabs.getInstance().getSelectedTab().getState() == Tab.STATE_LOADING)
             return;
 
         if (image != null) {