Merge mozilla-central and fx-team

This commit is contained in:
Ed Morley 2014-08-13 17:01:33 +01:00
Родитель 76da7b9ce5 9b606fb00a
Коммит 6e005944df
4 изменённых файлов: 76 добавлений и 2 удалений

Просмотреть файл

@ -93,6 +93,7 @@ skip-if = true # Bug 1047124
[browser_profiler_tree-abstract-01.js]
[browser_profiler_tree-abstract-02.js]
[browser_profiler_tree-abstract-03.js]
[browser_profiler_tree-abstract-04.js]
[browser_profiler_tree-frame-node.js]
[browser_profiler_tree-model-01.js]
[browser_profiler_tree-model-02.js]

Просмотреть файл

@ -0,0 +1,68 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the treeview expander arrow doesn't react to dblclick events.
*/
let { AbstractTreeItem } = Cu.import("resource:///modules/devtools/AbstractTreeItem.jsm", {});
let { Heritage } = Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {});
let test = Task.async(function*() {
let container = document.createElement("vbox");
gBrowser.selectedBrowser.parentNode.appendChild(container);
// Populate the tree and test the root item...
let treeRoot = new MyCustomTreeItem(gDataSrc, { parent: null });
treeRoot.attachTo(container);
let originalTreeRootExpanded = treeRoot.expanded;
info("Double clicking on the root item arrow and waiting for focus event.");
let receivedFocusEvent = treeRoot.once("focus");
EventUtils.sendMouseEvent({ type: "dblclick" }, treeRoot.target.querySelector(".arrow"));
yield receivedFocusEvent;
is(treeRoot.expanded, originalTreeRootExpanded,
"A double click on the arrow was ignored.");
container.remove();
finish();
});
function MyCustomTreeItem(dataSrc, properties) {
AbstractTreeItem.call(this, properties);
this.itemDataSrc = dataSrc;
}
MyCustomTreeItem.prototype = Heritage.extend(AbstractTreeItem.prototype, {
_displaySelf: function(document, arrowNode) {
let node = document.createElement("hbox");
node.MozMarginStart = (this.level * 10) + "px";
node.appendChild(arrowNode);
node.appendChild(document.createTextNode(this.itemDataSrc.label));
return node;
},
_populateSelf: function(children) {
for (let childDataSrc of this.itemDataSrc.children) {
children.push(new MyCustomTreeItem(childDataSrc, {
parent: this,
level: this.level + 1
}));
}
}
});
let gDataSrc = {
label: "root",
children: [{
label: "foo",
children: []
}, {
label: "bar",
children: [{
label: "baz",
children: []
}]
}]
};

Просмотреть файл

@ -427,7 +427,12 @@ AbstractTreeItem.prototype = {
* Handler for the "dblclick" event on the element displaying this tree item.
*/
_onDoubleClick: function(e) {
this._onArrowClick(e);
// Ignore dblclick on the arrow as it has already recived and handled two
// click events.
if (!e.target.classList.contains("arrow")) {
this._onArrowClick(e);
}
this.focus();
},

Просмотреть файл

@ -6202,7 +6202,7 @@ var ViewportHandler = {
let document = target.ownerDocument;
let browser = BrowserApp.getBrowserForDocument(document);
let tab = BrowserApp.getTabForBrowser(browser);
if (tab)
if (tab && tab.contentDocumentIsDisplayed)
this.updateMetadata(tab, false);
break;
}