1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file provides common functionality for synthetic gesture actions.
10 function getBoundingVisibleRect(el) {
11 var bound = el.getBoundingClientRect();
12 var rect = { top: bound.top,
15 height: bound.height };
17 rect.height += rect.top;
21 rect.width += rect.left;
25 var outsideHeight = (rect.top + rect.height) - window.innerHeight;
26 var outsideWidth = (rect.left + rect.width) - window.innerWidth;
28 if (outsideHeight > 0) {
29 rect.height -= outsideHeight;
31 if (outsideWidth > 0) {
32 rect.width -= outsideWidth;
37 window.__GestureCommon_GetBoundingVisibleRect = getBoundingVisibleRect;