зеркало из https://github.com/mozilla/gecko-dev.git
Bug 941844 - Part 1: don't update title if title doesn't change. r=bnicholson
This commit is contained in:
Родитель
ed490f60e8
Коммит
0c1fb7f45d
|
@ -314,9 +314,16 @@ public class Tab {
|
|||
}
|
||||
|
||||
public synchronized void updateTitle(String title) {
|
||||
// Keep the title unchanged while entering reader mode
|
||||
if (mEnteringReaderMode)
|
||||
// Keep the title unchanged while entering reader mode.
|
||||
if (mEnteringReaderMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there was a title, but it hasn't changed, do nothing.
|
||||
if (mTitle != null &&
|
||||
TextUtils.equals(mTitle, title)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mTitle = (title == null ? "" : title);
|
||||
Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.TITLE);
|
||||
|
|
|
@ -532,7 +532,7 @@ public class BrowserToolbar extends GeckoRelativeLayout
|
|||
|
||||
@Override
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
switch(msg) {
|
||||
switch (msg) {
|
||||
case TITLE:
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
updateTitle();
|
||||
|
@ -558,24 +558,26 @@ public class BrowserToolbar extends GeckoRelativeLayout
|
|||
updateTitle();
|
||||
}
|
||||
break;
|
||||
case LOADED:
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
updateTitle();
|
||||
}
|
||||
break;
|
||||
|
||||
case RESTORED:
|
||||
// TabCount fixup after OOM
|
||||
case SELECTED:
|
||||
updateTabCount(Tabs.getInstance().getDisplayCount());
|
||||
mSwitchingTabs = true;
|
||||
// fall through
|
||||
case LOCATION_CHANGE:
|
||||
// Fall through.
|
||||
|
||||
// A successful location change will cause Tab to notify
|
||||
// us of a title change, so only LOAD_ERROR does this.
|
||||
case LOAD_ERROR:
|
||||
updateTitle();
|
||||
// Fall through.
|
||||
case LOCATION_CHANGE:
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
refresh();
|
||||
}
|
||||
mSwitchingTabs = false;
|
||||
break;
|
||||
|
||||
case CLOSED:
|
||||
case ADDED:
|
||||
updateTabCount(Tabs.getInstance().getDisplayCount());
|
||||
|
@ -1473,10 +1475,9 @@ public class BrowserToolbar extends GeckoRelativeLayout
|
|||
setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
private void refresh() {
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab != null) {
|
||||
updateTitle();
|
||||
setFavicon(tab.getFavicon());
|
||||
setProgressVisibility(tab.getState() == Tab.STATE_LOADING);
|
||||
setSecurityMode(tab.getSecurityMode());
|
||||
|
|
Загрузка…
Ссылка в новой задаче