From 1ac3208ca2778c6255a2f33062dec1f2b8d590c9 Mon Sep 17 00:00:00 2001 From: piro Date: Mon, 16 Mar 2009 14:35:30 +0000 Subject: [PATCH] =?UTF-8?q?*=20=E5=AD=90=E3=82=BF=E3=83=96=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E4=BD=8D=E7=BD=AE=E3=82=92=E6=9C=80=E5=88=9D?= =?UTF-8?q?=E3=81=AE=E5=AD=90=E3=81=AB=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B?= =?UTF-8?q?=E6=99=82=E3=81=AF=E3=80=81=E3=82=BF=E3=83=96=E3=81=AE=E4=B8=8A?= =?UTF-8?q?=E3=81=AB=E3=82=BF=E3=83=96=E3=82=92=E3=83=89=E3=83=AD=E3=83=83?= =?UTF-8?q?=E3=83=97=E3=81=97=E3=81=9F=E6=99=82=E3=81=AE=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E3=82=82=E3=81=9D=E3=81=AE=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=81=AB=E5=BE=93=E3=81=86=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F=20*=20=E3=82=BF=E3=83=96=E3=81=AE=E4=B8=8A=E3=81=AB?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=82=92=E3=83=89=E3=83=AD=E3=83=83=E3=83=97?= =?UTF-8?q?=E3=81=97=E3=81=9F=E6=99=82=E3=81=AE=E6=8C=99=E5=8B=95=E3=81=8C?= =?UTF-8?q?=E5=85=A8=E4=BD=93=E7=9A=84=E3=81=AB=E3=83=90=E3=82=B0=E3=81=A3?= =?UTF-8?q?=E3=81=A6=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@3816 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 8 ++++++++ content/treestyletab/treestyletabbrowser.js | 7 +++++-- tests/unit/treestyletab_treeUtils.test.js | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 583f1c27..97c963aa 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -839,6 +839,14 @@ var TreeStyleTabService = { return lastChild; }, + getLastDescendantTab : function(aTab) + { + if (!aTab) return null; + + var tabs = this.getDescendantTabs(aTab); + return tabs.length ? tabs[tabs.length-1] : null ; + }, + getChildIndex : function(aTab, aParent) { var parent = this.getParentTab(aTab); diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 189a98e6..1d991689 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -2214,9 +2214,12 @@ TreeStyleTabBrowser.prototype = { switch (info.position) { case this.kDROP_ON: - info.action = this.kACTION_MOVE | this.kACTION_ATTACH; + info.action = this.kACTION_STAY | this.kACTION_ATTACH; info.parent = tab; - info.insertBefore = this.getNextSiblingTab(tab) || this.getNextVisibleTab(tab); + var visible = this.getNextVisibleTab(tab); + info.insertBefore = this.getTreePref('insertNewChildAt') == this.kINSERT_FISRT ? + (this.getFirstChildTab(tab) || visible) : + (this.getNextSiblingTab(tab) || this.getNextTab(this.getLastDescendantTab(tab)) || visible); break; case this.kDROP_BEFORE: diff --git a/tests/unit/treestyletab_treeUtils.test.js b/tests/unit/treestyletab_treeUtils.test.js index 95135a4e..85f8b08a 100644 --- a/tests/unit/treestyletab_treeUtils.test.js +++ b/tests/unit/treestyletab_treeUtils.test.js @@ -10,6 +10,7 @@ sv.hasChildTabs(tab) sv.getDescendantTabs(tab) sv.getFirstChildTab(tab) sv.getLastChildTab(tab) +sv.getLastDescendantTab(tab) sv.getChildIndex(tab, parent) sv.removeTabSubTree(tabs, onlychildren)