module Applitools::Selenium::RegionProvider::FrameWindowCalculator

Public Instance Methods

frame_window(frame_chain) click to toggle source
# File lib/applitools/selenium/region_provider.rb, line 66
def frame_window(frame_chain)
  chain = Applitools::Selenium::FrameChain.new other: frame_chain
  window = nil
  frames_offset = Applitools::Location.new(0, 0)
  chain.map(&:dup).each do |frame|
    frames_offset = frame.location.offset(frames_offset).offset_negative(frame.parent_scroll_position)
    if window.nil?
      window = Applitools::Region.from_location_size(frame.location, frame.size)
    else
      window.intersect(Applitools::Region.from_location_size(frame.location, frame.size))
    end
    # exception if empty window
  end
  window
end