Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1117)

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 1393193002: Paint tab-loading throbbers into a ui::Layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix clipping on the right, and animations Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 5269e9947f96702fd54e6fc6d967b17fed866020..175f9961b247fa8368c3845ce132e8e920df90e9 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -1178,16 +1178,17 @@ void TabStrip::OnMouseEventInTab(views::View* source,
}
bool TabStrip::ShouldPaintTab(const Tab* tab, gfx::Rect* clip) {
+ const bool dragging = drag_controller_ && drag_controller_->started_drag();
// Only touch layout needs to restrict the clip.
- if (!touch_layout_ && !IsStackingDraggedTabs())
+ if (!touch_layout_ && !dragging)
return true;
int index = GetModelIndexOfTab(tab);
if (index == -1)
return true; // Tab is closing, paint it all.
- int active_index = IsStackingDraggedTabs() ?
- controller_->GetActiveIndex() : touch_layout_->active_index();
+ int active_index =
+ dragging ? controller_->GetActiveIndex() : touch_layout_->active_index();
if (active_index == tab_count())
active_index--;
@@ -1195,23 +1196,28 @@ bool TabStrip::ShouldPaintTab(const Tab* tab, gfx::Rect* clip) {
if (tab_at(index)->x() == tab_at(index + 1)->x())
return false;
- if (tab_at(index)->x() > tab_at(index + 1)->x())
- return true; // Can happen during dragging.
-
- clip->SetRect(
- 0, 0, tab_at(index + 1)->x() - tab_at(index)->x() + kStackedTabLeftClip,
- tab_at(index)->height());
+ if (tab_at(index)->x() > tab_at(index + 1)->x()) {
+ // Can happen during dragging.
+ int x = tab_at(index)->x() - tab_at(index + 1)->x();
+ clip->SetRect(x, 0, tab_at(index)->width() - x, tab_at(index)->height());
+ } else {
+ clip->SetRect(0, 0, tab_at(index + 1)->x() - tab_at(index)->x() +
+ kStackedTabLeftClip,
+ tab_at(index)->height());
+ }
} else if (index > active_index && index > 0) {
const gfx::Rect& tab_bounds(tab_at(index)->bounds());
const gfx::Rect& previous_tab_bounds(tab_at(index - 1)->bounds());
if (tab_bounds.x() == previous_tab_bounds.x())
return false;
- if (tab_bounds.x() < previous_tab_bounds.x())
- return true; // Can happen during dragging.
-
- if (previous_tab_bounds.right() - GetLayoutConstant(TABSTRIP_TAB_OVERLAP) !=
- tab_bounds.x()) {
+ if (tab_bounds.x() < previous_tab_bounds.x()) {
+ // Can happen during dragging.
+ int x = previous_tab_bounds.x() - tab_bounds.x();
+ clip->SetRect(x, 0, tab_bounds.width() - x, tab_bounds.height());
+ } else if (previous_tab_bounds.right() -
+ GetLayoutConstant(TABSTRIP_TAB_OVERLAP) !=
+ tab_bounds.x()) {
int x = previous_tab_bounds.right() - tab_bounds.x() -
kStackedTabRightClip;
clip->SetRect(x, 0, tab_bounds.width() - x, tab_bounds.height());
@@ -1751,12 +1757,6 @@ void TabStrip::StackDraggedTabs(int delta) {
SchedulePaint();
}
-bool TabStrip::IsStackingDraggedTabs() const {
- return drag_controller_.get() && drag_controller_->started_drag() &&
- (drag_controller_->move_behavior() ==
- TabDragController::MOVE_VISIBILE_TABS);
-}
-
void TabStrip::LayoutDraggedTabsAt(const Tabs& tabs,
Tab* active_tab,
const gfx::Point& location,
« chrome/browser/ui/views/tabs/tab.cc ('K') | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698