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

Side by Side Diff: Source/devtools/front_end/ui/TabbedPane.js

Issue 1344283003: Devtools UI: Do not animate tab slider on load and during dragging (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 WebInspector.TabbedPane = function() 35 WebInspector.TabbedPane = function()
36 { 36 {
37 WebInspector.VBox.call(this, true); 37 WebInspector.VBox.call(this, true);
38 this.registerRequiredCSS("ui/tabbedPane.css"); 38 this.registerRequiredCSS("ui/tabbedPane.css");
39 this.element.classList.add("tabbed-pane"); 39 this.element.classList.add("tabbed-pane");
40 this.contentElement.classList.add("tabbed-pane-shadow"); 40 this.contentElement.classList.add("tabbed-pane-shadow");
41 this.contentElement.tabIndex = -1; 41 this.contentElement.tabIndex = -1;
42 this._headerElement = this.contentElement.createChild("div", "tabbed-pane-he ader toolbar-colors"); 42 this._headerElement = this.contentElement.createChild("div", "tabbed-pane-he ader toolbar-colors");
43 this._headerElement.createChild("content").select = ".tabbed-pane-header-bef ore"; 43 this._headerElement.createChild("content").select = ".tabbed-pane-header-bef ore";
44 this._headerContentsElement = this._headerElement.createChild("div", "tabbed -pane-header-contents"); 44 this._headerContentsElement = this._headerElement.createChild("div", "tabbed -pane-header-contents");
45 this._tabSlider = this._headerContentsElement.createChild("div", "tabbed-pan e-tab-slider"); 45 this._tabSlider = createElementWithClass("div", "tabbed-pane-tab-slider");
46 this._headerElement.createChild("content").select = ".tabbed-pane-header-aft er"; 46 this._headerElement.createChild("content").select = ".tabbed-pane-header-aft er";
47 this._tabsElement = this._headerContentsElement.createChild("div", "tabbed-p ane-header-tabs"); 47 this._tabsElement = this._headerContentsElement.createChild("div", "tabbed-p ane-header-tabs");
48 this._contentElement = this.contentElement.createChild("div", "tabbed-pane-c ontent"); 48 this._contentElement = this.contentElement.createChild("div", "tabbed-pane-c ontent");
49 this._contentElement.createChild("content"); 49 this._contentElement.createChild("content");
50 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ 50 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */
51 this._tabs = []; 51 this._tabs = [];
52 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ 52 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */
53 this._tabsHistory = []; 53 this._tabsHistory = [];
54 /** @type {!Object.<string, !WebInspector.TabbedPaneTab>} */ 54 /** @type {!Object.<string, !WebInspector.TabbedPaneTab>} */
55 this._tabsById = {}; 55 this._tabsById = {};
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 */ 733 */
734 _showTab: function(tab) 734 _showTab: function(tab)
735 { 735 {
736 tab.tabElement.classList.add("selected"); 736 tab.tabElement.classList.add("selected");
737 tab.view.show(this.element); 737 tab.view.show(this.element);
738 this._updateTabSlider(); 738 this._updateTabSlider();
739 }, 739 },
740 740
741 _updateTabSlider: function() 741 _updateTabSlider: function()
742 { 742 {
743 if (!this._currentTab) 743 if (!this._currentTab || !this._sliderEnabled)
744 return;
745 if (!this._sliderEnabled)
746 return; 744 return;
747 var left = 0; 745 var left = 0;
748 for (var i = 0; i < this._tabs.length && this._currentTab !== this._tabs [i] && this._tabs[i]._shown; i++) 746 for (var i = 0; i < this._tabs.length && this._currentTab !== this._tabs [i] && this._tabs[i]._shown; i++)
749 left += this._tabs[i]._measuredWidth; 747 left += this._tabs[i]._measuredWidth;
750 var sliderWidth = this._currentTab._shown ? this._currentTab._measuredWi dth : this._dropDownButton.offsetWidth; 748 var sliderWidth = this._currentTab._shown ? this._currentTab._measuredWi dth : this._dropDownButton.offsetWidth;
751 this._tabSlider.style.transform = "translateX(" + left + "px) scaleY(0.7 5)"; 749 this._tabSlider.style.transform = "translateX(" + left + "px) scaleY(0.7 5)";
752 this._tabSlider.style.width = sliderWidth + "px"; 750 this._tabSlider.style.width = sliderWidth + "px";
751
752 if (this._tabSlider.parentElement !== this._headerContentsElement)
753 this._headerContentsElement.appendChild(this._tabSlider);
753 }, 754 },
754 755
755 /** 756 /**
756 * @param {!WebInspector.TabbedPaneTab} tab 757 * @param {!WebInspector.TabbedPaneTab} tab
757 */ 758 */
758 _hideTab: function(tab) 759 _hideTab: function(tab)
759 { 760 {
760 tab.tabElement.classList.remove("selected"); 761 tab.tabElement.classList.remove("selected");
761 tab.view.detach(); 762 tab.view.detach();
762 }, 763 },
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 this._tabElement.style.setProperty("left", "0px"); 1170 this._tabElement.style.setProperty("left", "0px");
1170 return; 1171 return;
1171 } 1172 }
1172 if (!this._tabElement.nextSibling && event.pageX - this._dragStartX > 0) { 1173 if (!this._tabElement.nextSibling && event.pageX - this._dragStartX > 0) {
1173 this._tabElement.style.setProperty("left", "0px"); 1174 this._tabElement.style.setProperty("left", "0px");
1174 return; 1175 return;
1175 } 1176 }
1176 1177
1177 this._tabElement.classList.add("dragging"); 1178 this._tabElement.classList.add("dragging");
1178 this._tabElement.style.setProperty("left", (event.pageX - this._dragStar tX) + "px"); 1179 this._tabElement.style.setProperty("left", (event.pageX - this._dragStar tX) + "px");
1179 this._tabbedPane._updateTabSlider(); 1180 this._tabbedPane._tabSlider.remove();
1180 }, 1181 },
1181 1182
1182 /** 1183 /**
1183 * @param {!Event} event 1184 * @param {!Event} event
1184 */ 1185 */
1185 _endTabDragging: function(event) 1186 _endTabDragging: function(event)
1186 { 1187 {
1187 this._tabElement.classList.remove("dragging"); 1188 this._tabElement.classList.remove("dragging");
1188 this._tabElement.style.removeProperty("left"); 1189 this._tabElement.style.removeProperty("left");
1189 delete this._dragStartX; 1190 delete this._dragStartX;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 { 1308 {
1308 var view = /** @type {!WebInspector.Widget} */ (object); 1309 var view = /** @type {!WebInspector.Widget} */ (object);
1309 delete this._promiseForId[id]; 1310 delete this._promiseForId[id];
1310 this._views.set(id, view); 1311 this._views.set(id, view);
1311 if (this._viewCallback && view) 1312 if (this._viewCallback && view)
1312 this._viewCallback(id, view); 1313 this._viewCallback(id, view);
1313 return view; 1314 return view;
1314 } 1315 }
1315 } 1316 }
1316 } 1317 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698