From 0db8f5f76518a0a63a08fdc453810d85a5dde1bc Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Sat, 13 Oct 2012 02:43:34 +0900 Subject: [PATCH] Handle hidden/collapsed tabs while tab dragging correctly --- content/treestyletab/res/tabsDragUtils.js | 7 +++++-- modules/tabbarDNDObserver.js | 14 ++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/content/treestyletab/res/tabsDragUtils.js b/content/treestyletab/res/tabsDragUtils.js index 25c6d57a..64fd098d 100644 --- a/content/treestyletab/res/tabsDragUtils.js +++ b/content/treestyletab/res/tabsDragUtils.js @@ -131,7 +131,9 @@ 'if (!("animLastScreenX" in draggedTab._dragData))', 'let tabsWidth = 0;\n' + 'draggedTabs.forEach(function(draggedTab) {\n' + - ' tabsWidth += draggedTab.boxObject[size];\n' + + ' let style = window.getComputedStyle(draggedTab, null);\n' + + ' if (style.visibility != "collapse" && style.display != "none")\n' + + ' tabsWidth += draggedTab.boxObject[size];\n' + ' window["piro.sakura.ne.jp"].tabsDragUtils.fixDragData(draggedTab._dragData);\n' + ' $&' ).replace( @@ -219,7 +221,8 @@ // // let tabsWidth = 0; // draggedTabs.forEach(function(draggedTab) { -// tabsWidth += draggedTab.boxObject[size]/*.width*/; +// let style = window.getComputedStyle(draggedTab, null); +// if (style.visibility != "collapse" && style.display != "none") tabsWidth += draggedTab.boxObject[size]/*.width*/; // window['piro.sakura.ne.jp'].tabsDragUtils.fixDragData(draggedTab._dragData); // if (!("animLastScreenX" in draggedTab._dragData)) // draggedTab._dragData.animLastScreenX = draggedTab._dragData[position]/*.screenX*/; diff --git a/modules/tabbarDNDObserver.js b/modules/tabbarDNDObserver.js index 770eb4e9..3163ded8 100644 --- a/modules/tabbarDNDObserver.js +++ b/modules/tabbarDNDObserver.js @@ -996,15 +996,13 @@ catch(e) { if (tabbar._tabDropIndicator) tabbar._tabDropIndicator.collapsed = true; - var draggedTab; - if (dt.dropEffect != 'link') { - draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); - if (!draggedTab) { - aEvent.stopPropagation(); - return; - } - draggedTab.style.opacity = ''; + var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); + if (dt.dropEffect != 'link' && !draggedTab) { + aEvent.stopPropagation(); + return; } + if (draggedTab) + draggedTab.style.opacity = ''; var sourceBrowser = sv.getTabBrowserFromChild(draggedTab); if (draggedTab && sourceBrowser != b)