Changeset 116954 in webkit
- Timestamp:
- May 14, 2012 8:53:05 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116952 r116954 1 2012-05-14 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: preserve tab index while widening / shrinking tabbed pane area. 4 https://bugs.webkit.org/show_bug.cgi?id=86359 5 6 Reviewed by Vsevolod Vlasov. 7 8 After the drag'n'drop reorder, we should preserve tab index while widening / 9 shrinking the tabbed pane area. 10 11 * inspector/front-end/TabbedPane.js: 12 (WebInspector.TabbedPane.prototype._innerCloseTab): 13 (WebInspector.TabbedPane.prototype._showTabElement): 14 (WebInspector.TabbedPane.prototype._hideTabElement): 15 (WebInspector.TabbedPane.prototype._updateTabsDropDown): 16 (WebInspector.TabbedPane.prototype.elementsToRestoreScrollPositionsFor): 17 (WebInspector.TabbedPane.prototype._insertBefore): 18 (WebInspector.TabbedPaneTab): 19 (WebInspector.TabbedPaneTab.prototype._createTabElement): 20 (WebInspector.TabbedPaneTab.prototype._tabDragging): 21 1 22 2012-05-14 Vsevolod Vlasov <vsevik@chromium.org> 2 23 -
trunk/Source/WebCore/inspector/front-end/TabbedPane.js
r116930 r116954 140 140 this._tabsHistory.splice(this._tabsHistory.indexOf(tab), 1); 141 141 this._tabs.splice(this._tabs.indexOf(tab), 1); 142 if (tab. shown)142 if (tab._shown) 143 143 this._hideTabElement(tab); 144 144 … … 282 282 else 283 283 this._tabsElement.insertBefore(tab.tabElement, this._tabsElement.children[index]); 284 tab. shown = true;284 tab._shown = true; 285 285 }, 286 286 … … 291 291 { 292 292 this._tabsElement.removeChild(tab.tabElement); 293 tab. shown = false;293 tab._shown = false; 294 294 }, 295 295 … … 310 310 311 311 for (var i = 0; i < this._tabs.length; ++i) { 312 if (this._tabs[i]. shown && tabsToShowIndexes.indexOf(i) === -1)312 if (this._tabs[i]._shown && tabsToShowIndexes.indexOf(i) === -1) 313 313 this._hideTabElement(this._tabs[i]); 314 314 } 315 315 for (var i = 0; i < tabsToShowIndexes.length; ++i) { 316 316 var tab = this._tabs[tabsToShowIndexes[i]]; 317 if (!tab. shown)317 if (!tab._shown) 318 318 this._showTabElement(i, tab); 319 319 } … … 330 330 var tabsToShow = []; 331 331 for (var i = 0; i < this._tabs.length; ++i) { 332 if (!this._tabs[i]. shown)332 if (!this._tabs[i]._shown) 333 333 tabsToShow.push(this._tabs[i]); 334 334 continue; … … 483 483 { 484 484 return [ this._contentElement ]; 485 }, 486 487 /** 488 * @param {WebInspector.TabbedPaneTab} tab 489 * @param {number} index 490 */ 491 _insertBefore: function(tab, index) 492 { 493 this._tabsElement.insertBefore(tab._tabElement, this._tabsElement.childNodes[index]); 494 var oldIndex = this._tabs.indexOf(tab); 495 this._tabs.splice(oldIndex, 1); 496 if (oldIndex < index) 497 --index; 498 this._tabs.splice(index, 0, tab); 485 499 } 486 500 } … … 508 522 this._tooltip = tooltip; 509 523 this._view = view; 510 this. shown = false;524 this._shown = false; 511 525 /** @type {number} */ this._measuredWidth; 512 526 /** @type {Element} */ this._tabElement; … … 629 643 this._tabElement = tabElement; 630 644 tabElement.addEventListener("click", this._tabClicked.bind(this), false); 645 tabElement.addEventListener("mousedown", this._tabMouseDown.bind(this), false); 631 646 if (this._closeable) { 632 647 tabElement.addEventListener("contextmenu", this._tabContextMenu.bind(this), false); 633 tabElement.addEventListener("mousedown", this._tabMouseDown.bind(this), false);634 648 tabElement.addEventListener("mousemove", this._tabMouseMove.bind(this), false); 635 649 } … … 664 678 return; 665 679 this._tabbedPane.selectTab(this.id, true); 680 this._dragStartX = event.pageX; 666 681 }, 667 682 … … 692 707 _tabMouseMove: function(event) 693 708 { 709 if (isNaN(this._dragStartX)) 710 return; 694 711 if (event.which !== 1) 695 712 return; 696 713 this._tabbedPane.selectTab(this.id, true); 697 714 WebInspector.elementDragStart(this._tabElement, this._tabDragging.bind(this), this._endTabDragging.bind(this), event, "pointer"); 698 this._dragStartX = event.pageX;699 715 }, 700 716 … … 709 725 if (tabElement === this._tabElement) 710 726 continue; 711 var offset = tabElement.totalOffsetLeft(); 712 if (event.offsetX < offset || event.offsetX > offset + tabElement.clientWidth) 727 728 var intersects = tabElement.offsetLeft + tabElement.clientWidth > this._tabElement.offsetLeft && 729 this._tabElement.offsetLeft + this._tabElement.clientWidth > tabElement.offsetLeft; 730 if (!intersects) 713 731 continue; 714 715 if (tabElement.offsetLeft > this._tabElement.offsetLeft) 732 733 if (Math.abs(event.pageX - this._dragStartX) < tabElement.clientWidth / 2 + 5) 734 break; 735 736 if (event.pageX - this._dragStartX > 0) { 716 737 tabElement = tabElement.nextSibling; 738 ++i; 739 } 740 717 741 var oldOffsetLeft = this._tabElement.offsetLeft; 718 this._tab Element.parentElement.insertBefore(this._tabElement, tabElement);742 this._tabbedPane._insertBefore(this, i); 719 743 this._dragStartX += this._tabElement.offsetLeft - oldOffsetLeft; 744 break; 720 745 } 721 746 … … 740 765 this._tabElement.style.removeProperty("position"); 741 766 this._tabElement.style.removeProperty("left"); 767 delete this._dragStartX; 742 768 WebInspector.elementDragEnd(event); 743 769 }
Note: See TracChangeset
for help on using the changeset viewer.