telemetry/telemetry/internal/actions/gesture_common.js
function getBoundingVisibleRect(el) {
    // Get the element bounding rect in the layout viewport.
    const rect = getBoundingRect(el);

    // Apply the visual viewport transform (i.e. pinch-zoom) to the bounding
    // rect. The viewportX|Y values are in CSS pixels so they don't change
    // with page scale. We first translate so that the viewport offset is
    // at the origin and then we apply the scaling factor.
    const scale = getPageScaleFactor();
    const visualViewportX = chrome.gpuBenchmarking.visualViewportX();
    const visualViewportY = chrome.gpuBenchmarking.visualViewportY();
    rect.top = (rect.top - visualViewportY) * scale;
    rect.left = (rect.left - visualViewportX) * scale;
    rect.width *= scale;
    rect.height *= scale;

    // Get the window dimensions.
    const windowHeight = getWindowHeight();
    const windowWidth = getWindowWidth();

    // Then clip the rect to the screen size.
    rect.top = clamp(0, rect.top, windowHeight);
    rect.left = clamp(0, rect.left, windowWidth);
    rect.height = clamp(0, rect.height, windowHeight - rect.top);
    rect.width = clamp(0, rect.width, windowWidth - rect.left);

    return rect;
  }
function getBoundingVisibleRect(el) {
    // Get the element bounding rect in the layout viewport.
    const rect = getBoundingRect(el);

    // Apply the visual viewport transform (i.e. pinch-zoom) to the bounding
    // rect. The viewportX|Y values are in CSS pixels so they don't change
    // with page scale. We first translate so that the viewport offset is
    // at the origin and then we apply the scaling factor.
    const scale = getPageScaleFactor();
    const visualViewportX = chrome.gpuBenchmarking.visualViewportX();
    const visualViewportY = chrome.gpuBenchmarking.visualViewportY();
    rect.top = (rect.top - visualViewportY) * scale;
    rect.left = (rect.left - visualViewportX) * scale;
    rect.width *= scale;
    rect.height *= scale;

    // Get the window dimensions.
    const windowHeight = getWindowHeight();
    const windowWidth = getWindowWidth();

    // Then clip the rect to the screen size.
    rect.top = clamp(0, rect.top, windowHeight);
    rect.left = clamp(0, rect.left, windowWidth);
    rect.height = clamp(0, rect.height, windowHeight - rect.top);
    rect.width = clamp(0, rect.width, windowWidth - rect.left);

    return rect;
  }
function getBoundingVisibleRect ( el ) { // Get the element bounding rect in the layout viewport. const rect = getBoundingRect ( el ) ; // Apply the visual viewport transform (i.e. pinch-zoom) to the bounding // rect. The viewportX|Y values are in CSS pixels so they don't change // with page scale. We first translate so that the viewport offset is // at the origin and then we apply the scaling factor. const scale = getPageScaleFactor ( ) ; const visualViewportX = chrome . gpuBenchmarking . visualViewportX ( ) ; const visualViewportY = chrome . gpuBenchmarking . visualViewportY ( ) ; rect . top = ( rect . top - visualViewportY ) * scale ; rect . left = ( rect . left - visualViewportX ) * scale ; rect . width *= scale ; rect . height *= scale ; // Get the window dimensions. const windowHeight = getWindowHeight ( ) ; const windowWidth = getWindowWidth ( ) ; // Then clip the rect to the screen size. rect . top = clamp ( 0 , rect . top , windowHeight ) ; rect . left = clamp ( 0 , rect . left , windowWidth ) ; rect . height = clamp ( 0 , rect . height , windowHeight - rect . top ) ; rect . width = clamp ( 0 , rect . width , windowWidth - rect . left ) ; return rect ; }
Returns the bounding rect in the visual viewport's coordinates.
Returns the bounding rect in the visual viewport s coordinates .