Backed out changeset 69be1a2ffd39 (bug 912244) for Marionette failures on a CLOSED TREE

This commit is contained in:
Ed Morley 2013-09-04 11:30:06 +01:00
Родитель cf0611032c
Коммит ea8812f02d
3 изменённых файлов: 17 добавлений и 15 удалений

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

@ -1255,7 +1255,4 @@ class Marionette(object):
'''
if element is not None:
element = element.id
lights = None
if highlights is not None:
lights = [highlight.id for highlight in highlights if highlights]
return self._send_message("screenShot", 'value', element=element, highlights=lights)
return self._send_message("screenShot", 'value', element=element, highlights=highlights)

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -1789,7 +1789,7 @@ function screenShot(msg) {
let highlights = msg.json.highlights;
var document = curWindow.document;
var rect, win, width, height, left, top;
var rect, win, width, height, left, top, needsOffset;
// node can be either a window or an arbitrary DOM node
if (node == curWindow) {
// node is a window
@ -1798,6 +1798,8 @@ function screenShot(msg) {
height = win.innerHeight;
top = 0;
left = 0;
// offset needed for highlights to take 'outerHeight' of window into account
needsOffset = true;
}
else {
// node is an arbitrary DOM node
@ -1807,6 +1809,8 @@ function screenShot(msg) {
height = rect.height;
top = rect.top;
left = rect.left;
// offset for highlights not needed as they will be relative to this node
needsOffset = false;
}
var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
@ -1823,11 +1827,19 @@ function screenShot(msg) {
ctx.save();
for (var i = 0; i < highlights.length; ++i) {
var elem = elementManager.getKnownElement(highlights[i], curWindow)
var elem = highlights[i];
rect = elem.getBoundingClientRect();
var offsetY = -top;
var offsetX = -left;
var offsetY = 0, offsetX = 0;
if (needsOffset) {
var offset = getChromeOffset(elem);
offsetX = offset.x;
offsetY = offset.y;
} else {
// Don't need to offset the window chrome, just make relative to containing node
offsetY = -top;
offsetX = -left;
}
// Draw the rectangle
ctx.strokeRect(rect.left + offsetX, rect.top + offsetY, rect.width, rect.height);