1<?php
2
3namespace Facebook\WebDriver\Interactions\Touch;
4
5use Facebook\WebDriver\WebDriverAction;
6use Facebook\WebDriver\WebDriverElement;
7
8class WebDriverScrollFromElementAction extends WebDriverTouchAction implements WebDriverAction
9{
10    private $x;
11    private $y;
12
13    /**
14     * @param WebDriverTouchScreen $touch_screen
15     * @param WebDriverElement $element
16     * @param int $x
17     * @param int $y
18     */
19    public function __construct(
20        WebDriverTouchScreen $touch_screen,
21        WebDriverElement $element,
22        $x,
23        $y
24    ) {
25        $this->x = $x;
26        $this->y = $y;
27        parent::__construct($touch_screen, $element);
28    }
29
30    public function perform()
31    {
32        $this->touchScreen->scrollFromElement(
33            $this->locationProvider,
34            $this->x,
35            $this->y
36        );
37    }
38}
39