From 620652c4200cb2906fcd2ae259f8af0bde282551 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 20 Jan 2014 15:46:10 +0100 Subject: [PATCH] [FIX] excessive horizontal and vertical offsetting of edition button on images in webkit browsers Manually adding margins to offsets was necessary due to http://bugs.jquery.com/ticket/5445#comment:6 and the original code using $.fn.position(). When edition buttons were moved to being children of the body (rather than siblings of the image), $.fn.position() was replaced by $.fn.offset() (to get the position of the image/link relative to the body/page toplevel), the adjustment (addition of marginLeft/marginTop) was left in, even though #5445 does not apply to $.fn.offset(). bzr revid: xmo@openerp.com-20140120144610-nu8q2naemzzhekv2 --- addons/website/static/src/js/website.editor.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index 67e7277d0c5..e687dbb6a31 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -638,16 +638,14 @@ var $selected = $(this); var position = $selected.offset(); if ($selected.is('img')) { - var image_top = position.top + parseInt($selected.css('marginTop'), 10); - var image_left = position.left + parseInt($selected.css('marginLeft'), 10); $link_button.hide(); // center button on image $image_button.show().offset({ top: $selected.outerHeight() / 2 - + image_top + + position.top - $image_button.outerHeight() / 2, left: $selected.outerWidth() / 2 - + image_left + + position.left - $image_button.outerWidth() / 2, }); } else {