author | Tim Taubert <tim.taubert@gmx.de> |
Thu, 03 Feb 2011 02:20:01 +0100 | |
changeset 61860 | be4f8b47377e4c75398fdf56507469a9c163f967 |
parent 61859 | fd7962a458688e92cc5edd857d30da928438ad03 |
child 61861 | 3c87074d5f50d069edf461fe21d86a5b558cfd98 |
push id | 18522 |
push user | eakhgari@mozilla.com |
push date | Thu, 03 Feb 2011 17:29:54 +0000 |
treeherder | autoland@3c87074d5f50 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ian, sdwilsh |
bugs | 618816 |
milestone | 2.0b12pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/base/content/tabview/groupitems.js +++ b/browser/base/content/tabview/groupitems.js @@ -183,20 +183,27 @@ function GroupItem(listOfEls, options) { // event fires only a keyup event. Then, we shouldn't take any // reactions but we should update our status. self.adjustTitleSize(); self.save(); }; this.$title .blur(function() { + self._titleFocused = false; self.$titleShield.show(); }) .focus(function() { - (self.$title)[0].select(); + if (!self._titleFocused) { + (self.$title)[0].select(); + self._titleFocused = true; + } + }) + .mousedown(function(e) { + e.stopPropagation(); }) .keydown(handleKeyDown) .keyup(handleKeyUp); this.$titleShield .mousedown(function(e) { self.lastMouseDownTarget = (Utils.isLeftClick(e) ? e.target : null); })
--- a/browser/base/content/test/tabview/Makefile.in +++ b/browser/base/content/test/tabview/Makefile.in @@ -81,16 +81,17 @@ include $(topsrcdir)/config/rules.mk browser_tabview_bug608184.js \ browser_tabview_bug608158.js \ browser_tabview_bug608405.js \ browser_tabview_bug610242.js \ browser_tabview_bug612470.js \ browser_tabview_bug613541.js \ browser_tabview_bug616729.js \ browser_tabview_bug616967.js \ + browser_tabview_bug618816.js \ browser_tabview_bug618828.js \ browser_tabview_bug619937.js \ browser_tabview_bug622835.js \ browser_tabview_bug622872.js \ browser_tabview_bug624265.js \ browser_tabview_bug624931.js \ browser_tabview_bug624727.js \ browser_tabview_bug624953.js \
new file mode 100644 --- /dev/null +++ b/browser/base/content/test/tabview/browser_tabview_bug618816.js @@ -0,0 +1,47 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function test() { + let cw; + + let createGroupItem = function () { + let bounds = new cw.Rect(20, 20, 400, 200); + let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true}); + + let groupItemId = groupItem.id; + registerCleanupFunction(function() { + let groupItem = cw.GroupItems.groupItem(groupItemId); + if (groupItem) + groupItem.close(); + }); + + return groupItem; + } + + let testFocusTitle = function () { + let title = 'title'; + let groupItem = createGroupItem(); + groupItem.setTitle(title); + + let target = groupItem.$titleShield[0]; + EventUtils.synthesizeMouseAtCenter(target, {}, cw); + + let input = groupItem.$title[0]; + is(input.selectionStart, 0, 'the whole text is selected'); + is(input.selectionEnd, title.length, 'the whole text is selected'); + + EventUtils.synthesizeMouseAtCenter(input, {}, cw); + is(input.selectionStart, title.length, 'caret is at the rightmost position and no text is selected'); + is(input.selectionEnd, title.length, 'caret is at the rightmost position and no text is selected'); + + groupItem.close(); + hideTabView(finish); + } + + waitForExplicitFinish(); + + showTabView(function () { + cw = TabView.getContentWindow(); + testFocusTitle(); + }); +}