Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/tabs/tab_strip_model.h" | 5 #include "chrome/browser/tabs/tab_strip_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 | 391 |
| 392 // Ensure that the new TabContentsView begins at the same size as the | 392 // Ensure that the new TabContentsView begins at the same size as the |
| 393 // previous TabContentsView if it existed. Otherwise, the initial WebKit | 393 // previous TabContentsView if it existed. Otherwise, the initial WebKit |
| 394 // layout will be performed based on a width of 0 pixels, causing a | 394 // layout will be performed based on a width of 0 pixels, causing a |
| 395 // very long, narrow, inaccurate layout. Because some scripts on pages (as | 395 // very long, narrow, inaccurate layout. Because some scripts on pages (as |
| 396 // well as WebKit's anchor link location calculation) are run on the | 396 // well as WebKit's anchor link location calculation) are run on the |
| 397 // initial layout and not recalculated later, we need to ensure the first | 397 // initial layout and not recalculated later, we need to ensure the first |
| 398 // layout is performed with sane view dimensions even when we're opening a | 398 // layout is performed with sane view dimensions even when we're opening a |
| 399 // new background tab. | 399 // new background tab. |
| 400 if (TabContents* old_contents = GetSelectedTabContents()) { | 400 if (TabContents* old_contents = GetSelectedTabContents()) { |
| 401 if (!foreground) | 401 if (!foreground) { |
| 402 contents->view()->SizeContents(old_contents->view()->GetContainerSize()); | 402 contents->view()->SizeContents(old_contents->view()->GetContainerSize()); |
| 403 // We need to hide the contents or else we get and execute paints for | |
| 404 // background tabs. With enough background tabs they will steal the | |
| 405 // backing store of the visible tab causing flashing. See bug 20831. | |
| 406 contents->HideContents(); | |
|
darin (slow to review)
2009/09/04 06:25:57
shouldn't we hide the contents before we size them
| |
| 407 } | |
| 403 } | 408 } |
| 404 } | 409 } |
| 405 | 410 |
| 406 void TabStripModel::CloseSelectedTab() { | 411 void TabStripModel::CloseSelectedTab() { |
| 407 CloseTabContentsAt(selected_index_); | 412 CloseTabContentsAt(selected_index_); |
| 408 } | 413 } |
| 409 | 414 |
| 410 void TabStripModel::SelectNextTab() { | 415 void TabStripModel::SelectNextTab() { |
| 411 // This may happen during automated testing or if a user somehow buffers | 416 // This may happen during automated testing or if a user somehow buffers |
| 412 // many key accelerators. | 417 // many key accelerators. |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 int index = GetIndexOfTabContents(contents); | 670 int index = GetIndexOfTabContents(contents); |
| 666 contents_data_.at(index)->opener = &opener->controller(); | 671 contents_data_.at(index)->opener = &opener->controller(); |
| 667 } | 672 } |
| 668 | 673 |
| 669 // static | 674 // static |
| 670 bool TabStripModel::OpenerMatches(const TabContentsData* data, | 675 bool TabStripModel::OpenerMatches(const TabContentsData* data, |
| 671 const NavigationController* opener, | 676 const NavigationController* opener, |
| 672 bool use_group) { | 677 bool use_group) { |
| 673 return data->opener == opener || (use_group && data->group == opener); | 678 return data->opener == opener || (use_group && data->group == opener); |
| 674 } | 679 } |
| OLD | NEW |