Backed out changeset 7f6996c8b32f (bug 1521712) for breaking firefox when devtools is opened a=backout

This commit is contained in:
Oana Pop Rus 2019-01-24 12:39:40 +02:00
Родитель 75a4698880
Коммит 3192bddd22
3 изменённых файлов: 2 добавлений и 52 удалений

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

@ -122,8 +122,6 @@ skip-if = os == 'win' # bug 1413442
[browser_inspector_highlighter-measure_01.js]
[browser_inspector_highlighter-measure_02.js]
[browser_inspector_highlighter-options.js]
[browser_inspector_highlighter-pick-scrollbar.js]
skip-if = os != 'win' # Only test on windows where scrollbars are ... predictable
[browser_inspector_highlighter-preview.js]
[browser_inspector_highlighter-rulers_01.js]
[browser_inspector_highlighter-rulers_02.js]

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

@ -1,48 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Test that clicking on a scrollbar with the pick enabled does select the element that
// the scrollbar belongs to (see bug 1521712)
const TEST_URL = `data:text/html;charset=utf-8,
<div id="wrapper" style="width:300px;height:300px;overflow:scroll">
<div style="height:1000px;"></div>
</div>`;
const TEST_NODE = "#wrapper";
add_task(async function() {
const { toolbox, inspector } = await openInspectorForURL(TEST_URL);
info("Start picking");
await startPicker(toolbox);
info("Click on a scrollbar in the document and expect the test node to be selected");
const onSelect = inspector.once("inspector-updated");
const scrollbarWidth = await getScrollbarWidth(TEST_NODE);
const width = await getNodeWidth(TEST_NODE);
await BrowserTestUtils.synthesizeMouse(TEST_NODE,
width - scrollbarWidth / 2, 150, {}, gBrowser.selectedBrowser);
await onSelect;
is(inspector.selection.nodeFront.id, "wrapper", "The wrapper element was selected");
});
async function getScrollbarWidth(selector) {
return ContentTask.spawn(gBrowser.selectedBrowser, selector, s => {
const node = content.document.querySelector(s);
return node.offsetWidth - node.clientWidth;
});
}
async function getNodeWidth(selector) {
return ContentTask.spawn(gBrowser.selectedBrowser, selector, s => {
const node = content.document.querySelector(s);
const rect = node.getBoundingClientRect();
return rect.width;
});
}

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

@ -411,9 +411,9 @@ exports.HighlighterActor = protocol.ActorClassWithSpec(highlighterSpec, {
_startPickerListeners: function() {
const target = this._highlighterEnv.pageListenerTarget;
target.addEventListener("mousemove", this._onHovered, true);
target.addEventListener("mouseup", this._onPick, true);
target.addEventListener("click", this._onPick, true);
target.addEventListener("mousedown", this._preventContentEvent, true);
target.addEventListener("click", this._preventContentEvent, true);
target.addEventListener("mouseup", this._preventContentEvent, true);
target.addEventListener("dblclick", this._preventContentEvent, true);
target.addEventListener("keydown", this._onKey, true);
target.addEventListener("keyup", this._preventContentEvent, true);