1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00
This commit is contained in:
gorhill 2014-10-09 10:41:20 -04:00
parent 75c24a4368
commit 67495378cf

View File

@ -280,8 +280,11 @@ var highlightElements = function(elems, force) {
}
}
targetElements = elems;
var offx = window.pageXOffset;
var offy = window.pageYOffset;
// https://github.com/gorhill/uBlock/issues/210
var bodyRect = document.body.getBoundingClientRect();
var offx = bodyRect.left;
var offy = bodyRect.top;
var ow = svgRoot.getAttribute('width');
var ocean = [
'M0 0',
@ -299,14 +302,14 @@ var highlightElements = function(elems, force) {
}
r = elem.getBoundingClientRect();
ocean.push(
'M', r.left + offx, ' ', r.top + offy,
'M', r.left - offx, ' ', r.top - offy,
'h', r.width,
'v', r.height,
'h-', r.width,
'z'
);
islands.push(
'M', r.left + offx, ' ', r.top + offy,
'M', r.left - offx, ' ', r.top - offy,
'h', r.width,
'v', r.height,
'h-', r.width,