<commit_before>import { ElementRef } from '@angular/core';
import { Padding } from './padding';
import { Direction } from '../interfaces/direction';
import { Routines } from '../utils/domRoutines';
import { Settings } from './settings';

export class ViewportPadding {
  forward: Padding;
  backward: Padding;

  constructor(element) {
    this.forward = new Padding(element, Direction.forward);
    this.backward = new Padding(element, Direction.backward);
  }
}

export class Viewport {

  private settings: Settings;
  private host;
  scrollable;
  padding: ViewportPadding;
  syntheticScrollPosition: number;

  private lastPosition: number;

  constructor(elementRef: ElementRef, settings: Settings) {
    this.settings = settings;
    this.host = elementRef.nativeElement;
    this.scrollable = elementRef.nativeElement.parentElement;
    this.padding = new ViewportPadding(this.host);
    this.syntheticScrollPosition = null;
  }

  get children(): HTMLCollection {
    return this.host.children;
  }

  get scrollPosition(): number {
    return Routines.getScrollPosition(this.scrollable);
  }

  set scrollPosition(value: number) {
    this.syntheticScrollPosition = value;
    Routines.setScrollPosition(this.scrollable, value);
  }

  saveScrollPosition() {
    this.lastPosition = this.scrollPosition;
  }

  getLastPosition(): number {
    return this.lastPosition;
  }

  getSize(): number {
    return Routines.getSize(this.scrollable);
  }

  getScrollableSize(): number {
    return Routines.getScrollableSize(this.scrollable);
  }<commit_msg>avoid float scrollPosition in xvfb<commit_after>import { ElementRef } from '@angular/core';
import { Padding } from './padding';
import { Direction } from '../interfaces/direction';
import { Routines } from '../utils/domRoutines';
import { Settings } from './settings';

export class ViewportPadding {
  forward: Padding;
  backward: Padding;

  constructor(element) {
    this.forward = new Padding(element, Direction.forward);
    this.backward = new Padding(element, Direction.backward);
  }
}

export class Viewport {

  private settings: Settings;
  private host;
  scrollable;
  padding: ViewportPadding;
  syntheticScrollPosition: number;

  private lastPosition: number;

  constructor(elementRef: ElementRef, settings: Settings) {
    this.settings = settings;
    this.host = elementRef.nativeElement;
    this.scrollable = elementRef.nativeElement.parentElement;
    this.padding = new ViewportPadding(this.host);
    this.syntheticScrollPosition = null;
  }

  get children(): HTMLCollection {
    return this.host.children;
  }

  get scrollPosition(): number {
    return Routines.getScrollPosition(this.scrollable);
  }

  set scrollPosition(value: number) {
    Routines.setScrollPosition(this.scrollable, value);
    this.syntheticScrollPosition = this.scrollPosition;
  }

  saveScrollPosition() {
    this.lastPosition = this.scrollPosition;
  }

  getLastPosition(): number {
    return this.lastPosition;
  }

  getSize(): number {
    return Routines.getSize(this.scrollable);
  }

  getScrollableSize(): number {
    return Routines.getScrollableSize(this.scrollable);
  }
{'fraction_non_alphanumeric': 0.10935023771790808, 'fraction_numerical': 0.0, 'mean_word_length': 4.1568627450980395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7200626', 'n_tokens_mistral': 936, 'n_tokens_neox': 899, 'n_words': 202}