<commit_before>//deps includes.js

// BufferedView draws the ChunkView and the labels, shows the loaders,
// and presents the splash screen for a YLCV.
//
// This view makes sure that the splash screen never appears for too short a time period,
// and provides a grace period for new content to load after old content is invalidated.
function BufferedView(config) {
  EventEmitter.call(this);

  this._splashScreen = config.splashScreen;
  this._leftLoader = config.loader1;
  this._rightLoader = config.loader2;

  this._element = document.createElement('div');
  this._canvas = document.createElement('canvas');

  this._element.appendChild(this._splashScreen.element());

  var elements = [this._canvas, this._element, this._splashScreen.element()];
  makeElementsFillAndAbsolute(elements);

  this._width = 0;
  this._height = 0;

  this._context = null;
  this._pixelRatio = 0;
  this._crystalCallback = this._updatePixelRatio.bind(this, true);

  this._animate = false;
  this._state = BufferedView.STATE_SPLASH;
  this._splashStartTime = 0;
  this._timeout = null;

  this._chunkViewOffset = 0;
  this._chunkView = null;
  this._yLabels = null;

  this._currentCursorPosition = null;
  this._registerPointerEvents();

  this._boundDraw = this.draw.bind(this);
}

BufferedView.STATE_SPLASH = 0;
BufferedView.STATE_EPHEMERAL_SPLASH = 1;
BufferedView.STATE_CONTENT = 2;
BufferedView.STATE_EPHEMERAL_CONTENT = 3;

BufferedView.EPHEMERAL_CONTENT_TIME = 100;
BufferedView.EPHEMERAL_SPLASH_TIME = 300;

BufferedView.prototype = Object.create(EventEmitter.prototype);

// element returns the root DOM element of the view.
BufferedView.prototype.element = function() {
  return this._element;
};

// dispose removes any registered ChunkView event listeners.
BufferedView.prototype.dispose = function() {
  if (this._chunkView) {
    this._chunkView.removeListener('redraw', this._boundDraw);
  }
};

// context returns the 2D drawing context for the view's canvas.
// This may return null if the view is not visible.
BufferedView.prototype.context = function() {
  return this._context;
};

// layout updates the size of the BufferedView.
//
// You should manually call draw() after calling this.
BufferedView.prototype.layout = function(w, h) {
  w = Math.ceil(w);
  h = Math.ceil(h);<commit_msg>ylcv: BufferedView listens for superficial style changes<commit_after>//deps includes.js

// BufferedView draws the ChunkView and the labels, shows the loaders,
// and presents the splash screen for a YLCV.
//
// This view makes sure that the splash screen never appears for too short a time period,
// and provides a grace period for new content to load after old content is invalidated.
function BufferedView(config) {
  EventEmitter.call(this);

  this._splashScreen = config.splashScreen;
  this._leftLoader = config.loader1;
  this._rightLoader = config.loader2;
  this._visualStyle = config.visualStyle;

  this._element = document.createElement('div');
  this._canvas = document.createElement('canvas');

  this._element.appendChild(this._splashScreen.element());

  var elements = [this._canvas, this._element, this._splashScreen.element()];
  makeElementsFillAndAbsolute(elements);

  this._width = 0;
  this._height = 0;

  this._context = null;
  this._pixelRatio = 0;
  this._crystalCallback = this._updatePixelRatio.bind(this, true);

  this._animate = false;
  this._state = BufferedView.STATE_SPLASH;
  this._splashStartTime = 0;
  this._timeout = null;

  this._chunkViewOffset = 0;
  this._chunkView = null;
  this._yLabels = null;

  this._currentCursorPosition = null;
  this._registerPointerEvents();

  this._boundDraw = this.draw.bind(this);
  this._visualStyle.on('superficialChange', this._boundDraw);
}

BufferedView.STATE_SPLASH = 0;
BufferedView.STATE_EPHEMERAL_SPLASH = 1;
BufferedView.STATE_CONTENT = 2;
BufferedView.STATE_EPHEMERAL_CONTENT = 3;

BufferedView.EPHEMERAL_CONTENT_TIME = 100;
BufferedView.EPHEMERAL_SPLASH_TIME = 300;

BufferedView.prototype = Object.create(EventEmitter.prototype);

// element returns the root DOM element of the view.
BufferedView.prototype.element = function() {
  return this._element;
};

// dispose removes any registered event listeners on the ChunkView and VisualStyle.
BufferedView.prototype.dispose = function() {
  if (this._chunkView) {
    this._chunkView.removeListener('redraw', this._boundDraw);
  }
  this._visualStyle.removeListener('superficialChange', this._boundDraw);
};

// context returns the 2D drawing context for the view's canvas.
// This may return null if the view is not visible.
BufferedView.prototype.context = function() {
  return this._context;
};

// layout updates the size of the BufferedView.
//
// You should manually call draw() after calling this.
BufferedView.prototype.layout = function(w, h) {
  w = Math.ceil(w);
  h = Math.ceil(h);
{'fraction_non_alphanumeric': 0.10570955730244104, 'fraction_numerical': 0.007447248655357882, 'mean_word_length': 4.506833712984054, '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': '3363954', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1461, 'n_words': 389}