Module: Applitools::Selenium::RegionProvider::FrameWindowCalculator

Extended by:
FrameWindowCalculator
Included in:
FrameWindowCalculator
Defined in:
lib/applitools/selenium/region_provider.rb

Instance Method Summary collapse

Instance Method Details

#frame_window(frame_chain) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# 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