Repository: servo/servo
File: components/compositing/webview_renderer.rs (Rust)

Code before:
        // are processed immediately and can be ignored once they have been sent to the
        // Constellation.
        if cancelable && result {
            self.touch_handler
                .add_pending_touch_input_event(id, event_type);
        }

        result
    }

    pub(crate) fn on_touch_event(
        &mut self,
        render_api: &RenderApi,
        repaint_reason: &Cell<RepaintReason>,
        event: TouchEvent,
        id: InputEventId,
    ) {
        match event.event_type {
            TouchEventType::Down => self.on_touch_down(render_api, event, id),
            TouchEventType::Move => self.on_touch_move(render_api, event, id),
            TouchEventType::Up => self.on_touch_up(render_api, event, id),
            TouchEventType::Cancel => self.on_touch_cancel(render_api, event, id),
        }

        self.touch_handler
            .add_touch_move_refresh_obsever_if_necessary(
                self.refresh_driver.clone(),
                repaint_reason,
            );
    }

    fn on_touch_down(&mut self, render_api: &RenderApi, event: TouchEvent, id: InputEventId) {
        let point = event
            .point
            .as_device_point(self.device_pixels_per_page_pixel());
        self.touch_handler.on_touch_down(event.id, point);
        self.send_touch_event(render_api, event, id);
    }

    fn on_touch_move(&mut self, render_api: &RenderApi, mut event: TouchEvent, id: InputEventId) {
        let point = event
            .point
            .as_device_point(self.device_pixels_per_page_pixel());
        let action = self.touch_handler.on_touch_move(event.id, point);
        if let Some(action) = action {
            // if first move processed and allowed, we directly process the move event,
            // without waiting for the script handler.
            if self
                .touch_handler
                .move_allowed(self.touch_handler.current_sequence_id)
            {

Review comment (suggestion):
```suggestion
            .add_touch_move_refresh_observer_if_necessary(
```

Code after:
        let result = self.dispatch_input_event_with_hit_testing(render_api, input_event_and_id);

        // We only post-process events that are actually cancelable. Uncancelable ones
        // are processed immediately and can be ignored once they have been sent to the
        // Constellation.
        if cancelable && result {
            self.touch_handler
                .add_pending_touch_input_event(id, event_type);
        }

        result
    }

    pub(crate) fn on_touch_event(
        &mut self,
        render_api: &RenderApi,
        repaint_reason: &Cell<RepaintReason>,
        event: TouchEvent,
        id: InputEventId,
    ) {
        match event.event_type {
            TouchEventType::Down => self.on_touch_down(render_api, event, id),
            TouchEventType::Move => self.on_touch_move(render_api, event, id),
            TouchEventType::Up => self.on_touch_up(render_api, event, id),
            TouchEventType::Cancel => self.on_touch_cancel(render_api, event, id),
        }

        self.touch_handler
            .add_touch_move_refresh_observer_if_necessary(
                self.refresh_driver.clone(),
                repaint_reason,
            );
    }

    fn on_touch_down(&mut self, render_api: &RenderApi, event: TouchEvent, id: InputEventId) {
        let point = event
            .point
            .as_device_point(self.device_pixels_per_page_pixel());
        self.touch_handler.on_touch_down(event.id, point);
        self.send_touch_event(render_api, event, id);
    }

    fn on_touch_move(&mut self, render_api: &RenderApi, mut event: TouchEvent, id: InputEventId) {
        let point = event
            .point
            .as_device_point(self.device_pixels_per_page_pixel());
        let action = self.touch_handler.on_touch_move(event.id, point);
        if let Some(action) = action {
            // if first move processed and allowed, we directly process the move event,
            // without waiting for the script handler.
            if self