This commit is contained in:
gorhill 2014-10-09 10:41:20 -04:00
parent 75c24a4368
commit 67495378cf
1 changed files with 7 additions and 4 deletions

View File

@ -280,8 +280,11 @@ var highlightElements = function(elems, force) {
} }
} }
targetElements = elems; 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 ow = svgRoot.getAttribute('width');
var ocean = [ var ocean = [
'M0 0', 'M0 0',
@ -299,14 +302,14 @@ var highlightElements = function(elems, force) {
} }
r = elem.getBoundingClientRect(); r = elem.getBoundingClientRect();
ocean.push( ocean.push(
'M', r.left + offx, ' ', r.top + offy, 'M', r.left - offx, ' ', r.top - offy,
'h', r.width, 'h', r.width,
'v', r.height, 'v', r.height,
'h-', r.width, 'h-', r.width,
'z' 'z'
); );
islands.push( islands.push(
'M', r.left + offx, ' ', r.top + offy, 'M', r.left - offx, ' ', r.top - offy,
'h', r.width, 'h', r.width,
'v', r.height, 'v', r.height,
'h-', r.width, 'h-', r.width,