mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 835022 - Switch to correct tab when a tab is closed. r=mfinkle
This commit is contained in:
parent
e5e5a90814
commit
ca84939aa6
@ -798,7 +798,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
}
|
||||
|
||||
private void showTabs(TabsPanel.Panel panel) {
|
||||
if (Tabs.getInstance().getCount() == 0)
|
||||
if (Tabs.getInstance().getDisplayCount() == 0)
|
||||
return;
|
||||
|
||||
mTabsPanel.show(panel);
|
||||
|
@ -449,7 +449,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
}
|
||||
break;
|
||||
case RESTORED:
|
||||
updateTabCount(Tabs.getInstance().getCount());
|
||||
updateTabCount(Tabs.getInstance().getDisplayCount());
|
||||
break;
|
||||
case SELECTED:
|
||||
mAnimateSiteSecurity = false;
|
||||
@ -463,7 +463,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
break;
|
||||
case CLOSED:
|
||||
case ADDED:
|
||||
updateTabCountAndAnimate(Tabs.getInstance().getCount());
|
||||
updateTabCountAndAnimate(Tabs.getInstance().getDisplayCount());
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
updateBackButton(tab.canDoBack());
|
||||
updateForwardButton(tab.canDoForward());
|
||||
@ -1313,7 +1313,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
setSecurityMode(tab.getSecurityMode());
|
||||
setReaderMode(tab.getReaderEnabled());
|
||||
setShadowVisibility(true);
|
||||
updateTabCount(Tabs.getInstance().getCount());
|
||||
updateTabCount(Tabs.getInstance().getDisplayCount());
|
||||
updateBackButton(tab.canDoBack());
|
||||
updateForwardButton(tab.canDoForward());
|
||||
|
||||
|
@ -104,8 +104,15 @@ public class Tabs implements GeckoEventListener {
|
||||
}
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return mTabs.size();
|
||||
public int getDisplayCount() {
|
||||
boolean getPrivate = mSelectedTab != null && mSelectedTab.isPrivate();
|
||||
int count = 0;
|
||||
for (Tab tab : mTabs.values()) {
|
||||
if (tab.isPrivate() == getPrivate) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private void lazyRegisterBookmarkObserver() {
|
||||
@ -206,7 +213,7 @@ public class Tabs implements GeckoEventListener {
|
||||
}
|
||||
|
||||
public Tab getTab(int id) {
|
||||
if (getCount() == 0)
|
||||
if (mTabs.size() == 0)
|
||||
return null;
|
||||
|
||||
if (!mTabs.containsKey(id))
|
||||
|
Loading…
Reference in New Issue
Block a user