Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: LayoutTests/compositing/gestures/resources/link-highlight-helper.js

Issue 322253004: Change compositing/gestures tests to avoid a one pixel difference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/compositing/gestures/resources/link-highlight-helper.js
diff --git a/LayoutTests/compositing/gestures/resources/link-highlight-helper.js b/LayoutTests/compositing/gestures/resources/link-highlight-helper.js
index da33156550665e559f2f51cd3cd6901837a9285b..95be45164b225a9a1fe145fae6c9fc591acd52d6 100644
--- a/LayoutTests/compositing/gestures/resources/link-highlight-helper.js
+++ b/LayoutTests/compositing/gestures/resources/link-highlight-helper.js
@@ -19,28 +19,11 @@ function _createHighlight(node, classes) {
div.setAttribute('class', classes);
document.body.appendChild(div);
- var offset = _getAbsoluteOffset(node);
var clientRect = node.getBoundingClientRect();
- div.style.top = offset.top + "px";
- div.style.left = offset.left + "px";
- div.style.width = node.offsetWidth + "px";
- div.style.height = node.offsetHeight + "px";
+ div.style.top = clientRect.top + "px";
+ div.style.left = clientRect.left + "px";
+ div.style.width = clientRect.width + "px";
+ div.style.height = clientRect.height + "px";
return div;
}
-
-function _getAbsoluteOffset( elem )
-{
- var offsetLeft = 0;
- var offsetTop = 0;
- do {
- if ( !isNaN( elem.offsetLeft ) )
- offsetLeft += elem.offsetLeft - elem.scrollLeft;
-
- if ( !isNaN( elem.offsetTop ) )
- offsetTop += elem.offsetTop - elem.scrollTop;
-
- } while( elem = elem.offsetParent );
- return { top : offsetTop,
- left : offsetLeft };
-}

Powered by Google App Engine
This is Rietveld 408576698