Commit ef321762 authored by sky@chromium.org's avatar sky@chromium.org

Nukes TabStrip::CanUpdateDisplay. This appears to be the culprit for a

couple of crashes we're getting.

BUG=24132, 13707
TEST=thorougly test tab dragging on windows and make sure there are no
regressions.

Review URL: http://codereview.chromium.org/337013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30193 0039d316-1c4b-4281-b951-d872f2087c98
parent b9867d73
......@@ -1032,14 +1032,12 @@ void TabStrip::TabInsertedAt(TabContents* contents,
}
void TabStrip::TabDetachedAt(TabContents* contents, int index) {
if (CanUpdateDisplay()) {
GenerateIdealBounds();
StartRemoveTabAnimation(index, contents);
// Have to do this _after_ calling StartRemoveTabAnimation, so that any
// previous remove is completed fully and index is valid in sync with the
// model index.
GetTabAt(index)->set_closing(true);
}
GenerateIdealBounds();
StartRemoveTabAnimation(index, contents);
// Have to do this _after_ calling StartRemoveTabAnimation, so that any
// previous remove is completed fully and index is valid in sync with the
// model index.
GetTabAt(index)->set_closing(true);
}
void TabStrip::TabSelectedAt(TabContents* old_contents,
......@@ -1047,20 +1045,18 @@ void TabStrip::TabSelectedAt(TabContents* old_contents,
int index,
bool user_gesture) {
DCHECK(index >= 0 && index < GetTabCount());
if (CanUpdateDisplay()) {
// We have "tiny tabs" if the tabs are so tiny that the unselected ones are
// a different size to the selected ones.
bool tiny_tabs = current_unselected_width_ != current_selected_width_;
if (!IsAnimating() && (!resize_layout_scheduled_ || tiny_tabs)) {
Layout();
} else {
SchedulePaint();
}
int old_index = model_->GetIndexOfTabContents(old_contents);
if (old_index >= 0)
GetTabAt(old_index)->StopPinnedTabTitleAnimation();
// We have "tiny tabs" if the tabs are so tiny that the unselected ones are
// a different size to the selected ones.
bool tiny_tabs = current_unselected_width_ != current_selected_width_;
if (!IsAnimating() && (!resize_layout_scheduled_ || tiny_tabs)) {
Layout();
} else {
SchedulePaint();
}
int old_index = model_->GetIndexOfTabContents(old_contents);
if (old_index >= 0)
GetTabAt(old_index)->StopPinnedTabTitleAnimation();
}
void TabStrip::TabMoved(TabContents* contents, int from_index, int to_index,
......@@ -1208,6 +1204,7 @@ void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) {
// This records some extra information in hopes of tracking down why.
// The string contains the following, in order:
// . If a drag is already in progress, a 'D'.
// . If the model is closing all, an 'A'.
// . Index of tab the user is dragging.
// . Number of tabs.
// . Size of the model.
......@@ -1216,6 +1213,8 @@ void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) {
std::string tmp;
if (drag_controller_.get())
tmp += "D";
if (model_->closing_all())
tmp += " A";
tmp += " " + IntToString(index);
tmp += " " + IntToString(GetTabCount());
tmp += " " + IntToString(model_->count());
......@@ -1906,17 +1905,6 @@ void TabStrip::StartPinAndMoveTabAnimation(int from_index,
active_animation_->Start();
}
bool TabStrip::CanUpdateDisplay() {
// Don't bother laying out/painting when we're closing all tabs.
if (model_->closing_all()) {
// Make sure any active animation is ended, too.
if (active_animation_.get())
active_animation_->Stop();
return false;
}
return true;
}
void TabStrip::FinishAnimation(TabStrip::TabAnimation* animation,
bool layout) {
active_animation_.reset(NULL);
......
......@@ -273,12 +273,6 @@ class TabStrip : public views::View,
void StartPinAndMoveTabAnimation(int from_index, int to_index,
const gfx::Rect& start_bounds);
// Returns true if detach or select changes in the model should be reflected
// in the TabStrip. This returns false if we're closing all tabs in the
// TabStrip and so we should prevent updating. This is not const because we
// use this as a signal to cancel any active animations.
bool CanUpdateDisplay();
// Notifies the TabStrip that the specified TabAnimation has completed.
// Optionally a full Layout will be performed, specified by |layout|.
void FinishAnimation(TabAnimation* animation, bool layout);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment