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

Side by Side 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: cl format 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/views/tabs/tab_strip.h" 5 #include "chrome/browser/ui/views/tabs/tab_strip.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windowsx.h> 8 #include <windowsx.h>
9 #endif 9 #endif
10 10
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 1169
1170 return view && view->id() == VIEW_ID_TAB ? static_cast<Tab*>(view) : NULL; 1170 return view && view->id() == VIEW_ID_TAB ? static_cast<Tab*>(view) : NULL;
1171 } 1171 }
1172 1172
1173 void TabStrip::OnMouseEventInTab(views::View* source, 1173 void TabStrip::OnMouseEventInTab(views::View* source,
1174 const ui::MouseEvent& event) { 1174 const ui::MouseEvent& event) {
1175 UpdateStackedLayoutFromMouseEvent(source, event); 1175 UpdateStackedLayoutFromMouseEvent(source, event);
1176 } 1176 }
1177 1177
1178 bool TabStrip::ShouldPaintTab(const Tab* tab, gfx::Rect* clip) { 1178 bool TabStrip::ShouldPaintTab(const Tab* tab, gfx::Rect* clip) {
1179 const bool dragging = drag_controller_ && drag_controller_->started_drag();
1179 // Only touch layout needs to restrict the clip. 1180 // Only touch layout needs to restrict the clip.
1180 if (!touch_layout_ && !IsStackingDraggedTabs()) 1181 if (!touch_layout_ && !dragging)
1181 return true; 1182 return true;
1182 1183
1183 int index = GetModelIndexOfTab(tab); 1184 int index = GetModelIndexOfTab(tab);
1184 if (index == -1) 1185 if (index == -1)
1185 return true; // Tab is closing, paint it all. 1186 return true; // Tab is closing, paint it all.
1186 1187
1187 int active_index = IsStackingDraggedTabs() ? 1188 int active_index =
1188 controller_->GetActiveIndex() : touch_layout_->active_index(); 1189 dragging ? controller_->GetActiveIndex() : touch_layout_->active_index();
1189 if (active_index == tab_count()) 1190 if (active_index == tab_count())
1190 active_index--; 1191 active_index--;
1191 1192
1192 if (index < active_index) { 1193 if (index < active_index) {
1193 if (tab_at(index)->x() == tab_at(index + 1)->x()) 1194 if (tab_at(index)->x() == tab_at(index + 1)->x())
1194 return false; 1195 return false;
1195 1196
1196 if (tab_at(index)->x() > tab_at(index + 1)->x()) 1197 if (tab_at(index)->x() > tab_at(index + 1)->x())
1197 return true; // Can happen during dragging. 1198 return true; // Can happen during dragging.
1198 1199
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 new_bounds.set_x(std::min(min_x, new_bounds.x() + delta)); 1745 new_bounds.set_x(std::min(min_x, new_bounds.x() + delta));
1745 tabs_.set_ideal_bounds(i, new_bounds); 1746 tabs_.set_ideal_bounds(i, new_bounds);
1746 } 1747 }
1747 if (ideal_bounds(tab_count() - 1).right() >= newtab_button_->x()) 1748 if (ideal_bounds(tab_count() - 1).right() >= newtab_button_->x())
1748 newtab_button_->SetVisible(false); 1749 newtab_button_->SetVisible(false);
1749 } 1750 }
1750 views::ViewModelUtils::SetViewBoundsToIdealBounds(tabs_); 1751 views::ViewModelUtils::SetViewBoundsToIdealBounds(tabs_);
1751 SchedulePaint(); 1752 SchedulePaint();
1752 } 1753 }
1753 1754
1754 bool TabStrip::IsStackingDraggedTabs() const {
1755 return drag_controller_.get() && drag_controller_->started_drag() &&
1756 (drag_controller_->move_behavior() ==
1757 TabDragController::MOVE_VISIBILE_TABS);
1758 }
1759
1760 void TabStrip::LayoutDraggedTabsAt(const Tabs& tabs, 1755 void TabStrip::LayoutDraggedTabsAt(const Tabs& tabs,
1761 Tab* active_tab, 1756 Tab* active_tab,
1762 const gfx::Point& location, 1757 const gfx::Point& location,
1763 bool initial_drag) { 1758 bool initial_drag) {
1764 // Immediately hide the new tab button if the last tab is being dragged. 1759 // Immediately hide the new tab button if the last tab is being dragged.
1765 const Tab* last_visible_tab = GetLastVisibleTab(); 1760 const Tab* last_visible_tab = GetLastVisibleTab();
1766 if (last_visible_tab && last_visible_tab->dragging()) 1761 if (last_visible_tab && last_visible_tab->dragging())
1767 newtab_button_->SetVisible(false); 1762 newtab_button_->SetVisible(false);
1768 std::vector<gfx::Rect> bounds; 1763 std::vector<gfx::Rect> bounds;
1769 CalculateBoundsForDraggedTabs(tabs, &bounds); 1764 CalculateBoundsForDraggedTabs(tabs, &bounds);
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); 2765 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
2771 if (view) 2766 if (view)
2772 return view; 2767 return view;
2773 } 2768 }
2774 Tab* tab = FindTabForEvent(point); 2769 Tab* tab = FindTabForEvent(point);
2775 if (tab) 2770 if (tab)
2776 return ConvertPointToViewAndGetEventHandler(this, tab, point); 2771 return ConvertPointToViewAndGetEventHandler(this, tab, point);
2777 } 2772 }
2778 return this; 2773 return this;
2779 } 2774 }
OLDNEW
« 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