--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -568,16 +568,19 @@ window.GroupItem.prototype = Utils.exten
$el = iQ(a);
item = Items.item($el);
}
Utils.assertThrow(!item.parent || item.parent == this,
"shouldn't already be in another groupItem");
item.removeTrenches();
+ if (!dropPos)
+ dropPos = {top:window.innerWidth, left:window.innerHeight};
+
if (typeof options == 'undefined')
options = {};
var self = this;
var wasAlreadyInThisGroupItem = false;
var oldIndex = this._children.indexOf(item);
if (oldIndex != -1) {
@@ -621,17 +624,17 @@ window.GroupItem.prototype = Utils.exten
}
return self._children.length;
}
return 0;
}
// Insert the tab into the right position.
- var index = dropPos ? findInsertionPoint(dropPos) : this._children.length;
+ var index = findInsertionPoint(dropPos);
this._children.splice(index, 0, item);
item.setZ(this.getZ() + 1);
$el.addClass("tabInGroupItem");
if (!wasAlreadyInThisGroupItem) {
item.droppable(false);
item.groupItemData = {};
@@ -1400,16 +1403,31 @@ window.GroupItems = {
Utils.log('GroupItems.groupItemStorageSanity: bad bounds', groupItemData.bounds);
sane = false;
}
return sane;
},
// ----------
+ // Function: getGroupItemWithTitle
+ // Returns the <GroupItem> that has the given title, or null if none found.
+ // TODO: what if there are multiple groupItems with the same title??
+ // Right now, looks like it'll return the last one. Bug 586557
+ getGroupItemWithTitle: function(title) {
+ var result = null;
+ this.groupItems.forEach(function(groupItem) {
+ if (groupItem.getTitle() == title)
+ result = groupItem;
+ });
+
+ return result;
+ },
+
+ // ----------
// Function: register
// Adds the given <GroupItem> to the list of groupItems we're tracking.
register: function(groupItem) {
Utils.assert(groupItem, 'groupItem');
Utils.assert(this.groupItems.indexOf(groupItem) == -1, 'only register once per groupItem');
this.groupItems.push(groupItem);
},
--- a/browser/base/content/tabview/tabview.css
+++ b/browser/base/content/tabview/tabview.css
@@ -166,15 +166,8 @@ body {
z-index: 99999;
display: block;
}
.iq-resizable-disabled .iq-resizable-handle,
.iq-resizable-autohide .iq-resizable-handle {
display: none;
}
-
-/* Exit button
-----------------------------------*/
-#exit-button {
- position: absolute;
- z-index: 99999;
-}
\ No newline at end of file
--- a/browser/base/content/tabview/tabview.html
+++ b/browser/base/content/tabview/tabview.html
@@ -4,18 +4,16 @@
<head>
<title> </title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<link rel="stylesheet" href="tabview.css" type="text/css"/>
<link rel="stylesheet" href="chrome://browser/skin/tabview/tabview.css" type="text/css"/>
</head>
<body transparent="true">
- <input id="exit-button" type="image" onclick="UI.onExitButtonPressed();"
- alt="" />
<div id="content">
<div id="bg" />
</div>
<script type="text/javascript;version=1.8" src="tabview.js"></script>
</body>
</html>
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -873,27 +873,16 @@ var UIManager = {
pair.item.snap();
});
this._pageBounds = Items.getPageBounds();
this._save();
},
// ----------
- // Function: onExitButtonPressed
- // Exits TabView UI.
- onExitButtonPressed: function() {
- let activeTab = this.getActiveTab();
- if (!activeTab)
- activeTab = gBrowser.selectedTab.tabItem;
- if (activeTab)
- activeTab.zoomIn();
- },
-
- // ----------
// Function: _addDevMenu
// Fills out the "dev menu" in the TabView UI.
_addDevMenu: function() {
try {
var self = this;
var $select = iQ("<select>")
.css({
@@ -935,16 +924,21 @@ var UIManager = {
self._reset();
}
}, {
*/
name: "save",
code: function() {
self._saveAll();
}
+ }, {
+ name: "group sites",
+ code: function() {
+ self._arrangeBySite();
+ }
}];
var count = commands.length;
var a;
for (a = 0; a < count; a++) {
commands[a].element = (iQ("<option>")
.val(a)
.html(commands[a].name)
@@ -998,15 +992,65 @@ var UIManager = {
// Function: _saveAll
// Saves all data associated with TabView.
// TODO: Save info items
_saveAll: function() {
this._save();
GroupItems.saveAll();
TabItems.saveAll();
},
+
+ // ----------
+ // Function: _arrangeBySite
+ // Blows away all existing groupItems and organizes the tabs into new groupItems based
+ // on domain.
+ _arrangeBySite: function() {
+ function putInGroupItem(set, key) {
+ var groupItem = GroupItems.getGroupItemWithTitle(key);
+ if (groupItem) {
+ set.forEach(function(el) {
+ groupItem.add(el);
+ });
+ } else
+ new GroupItem(set, { dontPush: true, dontArrange: true, title: key });
+ }
+
+ GroupItems.removeAll();
+
+ var groupItems = [];
+ var leftovers = [];
+ var items = TabItems.getItems();
+ items.forEach(function(item) {
+ var url = item.tab.linkedBrowser.currentURI.spec;
+ var domain = url.split('/')[2];
+
+ if (!domain)
+ leftovers.push(item.container);
+ else {
+ var domainParts = domain.split(".");
+ var mainDomain = domainParts[domainParts.length - 2];
+ if (groupItems[mainDomain])
+ groupItems[mainDomain].push(item.container);
+ else
+ groupItems[mainDomain] = [item.container];
+ }
+ });
+
+ for (key in groupItems) {
+ var set = groupItems[key];
+ if (set.length > 1) {
+ putInGroupItem(set, key);
+ } else
+ leftovers.push(set[0]);
+ }
+
+ if (leftovers.length)
+ putInGroupItem(leftovers, "mixed");
+
+ GroupItems.arrange();
+ },
};
// ----------
window.UI = UIManager;
window.UI.init();
})();
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -42,14 +42,12 @@ relativesrcdir = browser/base/content/t
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_FILES = \
browser_tabview_launch.js \
browser_tabview_dragdrop.js \
browser_tabview_group.js \
- browser_tabview_exit_button.js \
- browser_tabview_bug591706.js \
$(NULL)
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
deleted file mode 100644
--- a/browser/base/content/test/tabview/browser_tabview_bug591706.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is bug 591706 test.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Michael Yoshitaka Erlewine <mitcho@mitcho.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function test() {
- waitForExplicitFinish();
-
- window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
- if (TabView.isVisible())
- onTabViewWindowLoaded();
- else
- TabView.show();
-}
-
-function onTabViewWindowLoaded() {
- window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
-
- ok(TabView.isVisible(), "Tab View is visible");
-
- let contentWindow = document.getElementById("tab-view").contentWindow;
- let [originalTab] = gBrowser.visibleTabs;
-
- // Create a first tab and orphan it
- let firstTab = gBrowser.loadOneTab("about:blank#1", {inBackground: true});
- let firstTabItem = firstTab.tabItem;
- let currentGroup = contentWindow.GroupItems.getActiveGroupItem();
- ok(currentGroup.getChildren().some(function(child) child == firstTabItem),"The first tab was made in the current group");
- contentWindow.GroupItems.getActiveGroupItem().remove(firstTabItem);
- ok(!currentGroup.getChildren().some(function(child) child == firstTabItem),"The first tab was orphaned");
-
- // Create a group and make it active
- let box = new contentWindow.Rect(10, 10, 300, 300);
- let group = new contentWindow.GroupItem([], { bounds: box });
- ok(group.isEmpty(), "This group is empty");
- contentWindow.GroupItems.setActiveGroupItem(group);
-
- // Create a second tab in this new group
- let secondTab = gBrowser.loadOneTab("about:blank#2", {inBackground: true});
- let secondTabItem = secondTab.tabItem;
- ok(group.getChildren().some(function(child) child == secondTabItem),"The second tab was made in our new group");
- is(group.getChildren().length, 1, "Only one tab in the first group");
- isnot(firstTab.linkedBrowser.contentWindow.location, secondTab.linkedBrowser.contentWindow.location, "The two tabs must have different locations");
-
- // Add the first tab to the group *programmatically*, without specifying a dropPos
- group.add(firstTabItem);
- is(group.getChildren().length, 2, "Two tabs in the group");
- is(group.getChildren()[0].tab.linkedBrowser.contentWindow.location, secondTab.linkedBrowser.contentWindow.location, "The second tab was there first");
- is(group.getChildren()[1].tab.linkedBrowser.contentWindow.location, firstTab.linkedBrowser.contentWindow.location, "The first tab was just added and went to the end of the line");
-
- // Get rid of the group and its children
- group.closeAll();
- ok(group.isEmpty(), "The group is empty again");
-
- is(contentWindow.GroupItems.getActiveGroupItem(), null, "The active group is gone");
- contentWindow.GroupItems.setActiveGroupItem(currentGroup);
- isnot(contentWindow.GroupItems.getActiveGroupItem(), null, "There is an active group");
- is(gBrowser.tabs.length, 1, "There is only one tab left");
- is(gBrowser.visibleTabs.length, 1, "There is also only one visible tab");
-
- let onTabViewHidden = function() {
- window.removeEventListener("tabviewhidden", onTabViewHidden, false);
- finish();
- };
- window.addEventListener("tabviewhidden", onTabViewHidden, false);
- gBrowser.selectedTab = originalTab;
- if (!TabView.isVisible())
- TabView.hide();
- else
- onTabViewHidden();
-}
-
-function simulateDragDrop(srcElement, offsetX, offsetY, contentWindow) {
- // enter drag mode
- let dataTransfer;
-
- EventUtils.synthesizeMouse(
- srcElement, 1, 1, { type: "mousedown" }, contentWindow);
- event = contentWindow.document.createEvent("DragEvents");
- event.initDragEvent(
- "dragenter", true, true, contentWindow, 0, 0, 0, 0, 0,
- false, false, false, false, 1, null, dataTransfer);
- srcElement.dispatchEvent(event);
-
- // drag over
- for (let i = 4; i >= 0; i--)
- EventUtils.synthesizeMouse(
- srcElement, Math.round(offsetX/5), Math.round(offsetY/4),
- { type: "mousemove" }, contentWindow);
- event = contentWindow.document.createEvent("DragEvents");
- event.initDragEvent(
- "dragover", true, true, contentWindow, 0, 0, 0, 0, 0,
- false, false, false, false, 0, null, dataTransfer);
- srcElement.dispatchEvent(event);
-
- // drop
- EventUtils.synthesizeMouse(srcElement, 0, 0, { type: "mouseup" }, contentWindow);
- event = contentWindow.document.createEvent("DragEvents");
- event.initDragEvent(
- "drop", true, true, contentWindow, 0, 0, 0, 0, 0,
- false, false, false, false, 0, null, dataTransfer);
- srcElement.dispatchEvent(event);
-}
--- a/browser/base/content/test/tabview/browser_tabview_dragdrop.js
+++ b/browser/base/content/test/tabview/browser_tabview_dragdrop.js
@@ -34,20 +34,17 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
- if (TabView.isVisible())
- onTabViewWindowLoaded();
- else
- TabView.show();
+ TabView.toggle();
}
function onTabViewWindowLoaded() {
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
ok(TabView.isVisible(), "Tab View is visible");
let contentWindow = document.getElementById("tab-view").contentWindow;
deleted file mode 100644
--- a/browser/base/content/test/tabview/browser_tabview_exit_button.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is tabview exit button test.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Raymond Lee <raymond@appcoast.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function test() {
- waitForExplicitFinish();
-
- let onTabViewShown = function() {
- window.removeEventListener("tabviewshown", onTabViewShown, false);
- ok(TabView.isVisible(), "Tab View is visible");
-
- let contentWindow = document.getElementById("tab-view").contentWindow;
- let button = contentWindow.document.getElementById("exit-button");
-
- ok(button, "Exit button exists");
- EventUtils.synthesizeMouse(button, 1, 1, {});
- }
-
- let onTabViewHidden = function() {
- window.removeEventListener("tabviewhidden", onTabViewHidden, false);
-
- ok(!TabView.isVisible(), "Tab View is hidden");
- finish();
- }
-
- window.addEventListener("tabviewshown", onTabViewShown, false);
- window.addEventListener("tabviewhidden", onTabViewHidden, false);
- TabView.toggle();
-}
--- a/browser/themes/gnomestripe/browser/tabview/tabview.css
+++ b/browser/themes/gnomestripe/browser/tabview/tabview.css
@@ -335,24 +335,9 @@ input.defaultName {
}
.iq-resizable-se {
cursor: se-resize;
width: 12px;
height: 12px;
right: 1px;
bottom: 1px;
-}
-
-/* Exit button
-----------------------------------*/
-#exit-button {
- cursor: default;
- top: 0;
- right: 0;
- width: 28px;
- height: 27px;
- background: url(chrome://browser/skin/tabview/tabview.png) no-repeat scroll 4px 4px #b7b7b7;
- border-bottom: 1px solid #909090;
- border-left: 1px solid #B7B7B7;
- border-top: 1px solid #CFCFCF;
- -moz-border-radius: 3px 0 0 3px;
-}
+}
\ No newline at end of file
--- a/browser/themes/pinstripe/browser/tabview/tabview.css
+++ b/browser/themes/pinstripe/browser/tabview/tabview.css
@@ -335,24 +335,9 @@ input.defaultName {
}
.iq-resizable-se {
cursor: se-resize;
width: 12px;
height: 12px;
right: 1px;
bottom: 1px;
-}
-
-/* Exit button
-----------------------------------*/
-#exit-button {
- cursor: default;
- top: 0;
- right: 0;
- width: 28px;
- height: 27px;
- background: url(chrome://browser/skin/tabview/tabview.png) no-repeat scroll 4px 4px #b7b7b7;
- border-bottom: 1px solid #909090;
- border-left: 1px solid #B7B7B7;
- border-top: 1px solid #CFCFCF;
- -moz-border-radius: 3px 0 0 3px;
-}
+}
\ No newline at end of file
--- a/browser/themes/winstripe/browser/tabview/tabview.css
+++ b/browser/themes/winstripe/browser/tabview/tabview.css
@@ -335,24 +335,9 @@ input.defaultName {
}
.iq-resizable-se {
cursor: se-resize;
width: 12px;
height: 12px;
right: 1px;
bottom: 1px;
-}
-
-/* Exit button
-----------------------------------*/
-#exit-button {
- cursor: default;
- top: 0;
- right: 0;
- width: 28px;
- height: 27px;
- background: url(chrome://browser/skin/tabview/tabview.png) no-repeat scroll 4px 4px #b7b7b7;
- border-bottom: 1px solid #909090;
- border-left: 1px solid #B7B7B7;
- border-top: 1px solid #CFCFCF;
- -moz-border-radius: 3px 0 0 3px;
-}
+}
\ No newline at end of file
--- a/content/html/content/test/test_bug408231.html
+++ b/content/html/content/test/test_bug408231.html
@@ -177,17 +177,16 @@ https://bugzilla.mozilla.org/show_bug.cg
var expectedResult = expectedResults[i][1];
var result = fun(commandName);
ok(result == expectedResult, funName + '('+commandName+') result=' +result+ ' expected=' + expectedResult);
}
}
function runTests() {
document.designMode='on';
- window.getSelection().collapse(document.body, 0);
testQueryCommand(commandEnabledResults, callQueryCommandEnabled, "queryCommandEnabled");
testQueryCommand(commandStateResults, callQueryCommandState, "queryCommandState");
testQueryCommand(commandValueResults, callQueryCommandValue, "queryCommandValue");
document.designMode='off';
SimpleTest.finish();
}
window.onload = runTests;
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -3852,22 +3852,18 @@ nsEditor::IsPreformatted(nsIDOMNode *aNo
{
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
NS_ENSURE_TRUE(aResult && content, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
- // Look at the node (and its parent if it's not an element), and grab its style context
nsRefPtr<nsStyleContext> elementStyle;
- if (!content->IsElement()) {
- content = content->GetParent();
- }
- if (content && content->IsElement()) {
+ if (content->IsElement()) {
elementStyle = nsComputedDOMStyle::GetStyleContextForElement(content->AsElement(),
nsnull,
ps);
}
if (!elementStyle)
{
// Consider nodes without a style context to be NOT preformatted:
--- a/editor/libeditor/html/tests/Makefile.in
+++ b/editor/libeditor/html/tests/Makefile.in
@@ -54,17 +54,16 @@ include $(topsrcdir)/config/rules.mk
test_bug478725.html \
test_bug480972.html \
test_bug484181.html \
test_bug487524.html \
test_bug520189.html \
test_bug525389.html \
test_bug537046.html \
test_bug550434.html \
- test_bug592592.html \
test_CF_HTML_clipboard.html \
test_contenteditable_focus.html \
test_contenteditable_text_input_handling.html \
test_htmleditor_keyevent_handling.html \
test_select_all_without_body.html \
file_select_all_without_body.html \
test_root_element_replacement.html \
$(NULL)
deleted file mode 100644
--- a/editor/libeditor/html/tests/test_bug592592.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=592592
--->
-<head>
- <title>Test for Bug 592592</title>
- <script type="application/javascript" src="/MochiKit/packed.js"></script>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=592592">Mozilla Bug 592592</a>
-<p id="display"></p>
-<div id="content">
- <div id="editor" contenteditable="true" style="white-space:pre-wrap">a b</div>
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 592592 **/
-
-SimpleTest.waitForExplicitFinish();
-SimpleTest.waitForFocus(function() {
- var ed = document.getElementById("editor");
-
- // Put the selection right after "a"
- ed.focus();
- window.getSelection().collapse(ed.firstChild, 1);
-
- // Press space
- synthesizeKey(" ", {});
-
- // Make sure we haven't added an nbsp
- is(ed.innerHTML, "a b", "We should not be adding an for preformatted text");
-
- // Remove the preformatted style
- ed.removeAttribute("style");
-
- // Reset the DOM
- ed.innerHTML = "a b";
-
- // Reset the selection
- ed.focus();
- window.getSelection().collapse(ed.firstChild, 1);
-
- // Press space
- synthesizeKey(" ", {});
-
- // Make sure that we have added an nbsp
- is(ed.innerHTML, "a b", "We should add an for non-preformatted text");
-
- SimpleTest.finish();
-});
-
-</script>
-</pre>
-</body>
-</html>