This file is indexed.

/usr/share/kde4/apps/plasma/dashboard/AppleClasses/AppleScrollArea.js is in plasma-scriptengine-webkit 4:4.11.8-0ubuntu6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * Copyright 2008 Stefan Buller <hikingpete@cain.afraid.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) version 3, or any
 * later version accepted by the membership of KDE e.V. (or its
 * successor approved by the membership of KDE e.V.), which shall
 * act as a proxy defined in Section 6 of version 3 of the license.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public 
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

function AppleScrollArea(content) {
	for (var i = 0; i < arguments.length; i++) {
		this.addScrollbar(arguments[i]);
	}
	var that=this;
	var handler=function(e) {
		switch(e.which) {
			case 37: //left
				that.horizontalScrollTo(that.content.scrollLeft -
						that.singlepressScrollPixels);
				break;
			case 38: //up
				that.verticalScrollTo(that.content.scrollTop -
						that.singlepressScrollPixels);
				break;
			case 39: //right
				that.horizontalScrollTo(that.content.scrollLeft +
						that.singlepressScrollPixels);
				break;
			case 40: //down
				that.verticalScrollTo(that.content.scrollTop +
						that.singlepressScrollPixels);
				break;
			default:
				//the event may contiue to propagate
				return true;
		}
		//arrest propagation
		return false;
	}
	content.addEventListener('keydown',handler,false);

	//Apple mandated properties that must be reacted to.
	this.scrollsVertically = false;
	this.scrollsHorizontally = false;
	this.singlepressScrollPixels = 10; //Somebody change this. Please.

	//Apple mandated properties that are `read only'.
	this.viewHeight = content.clientHeight;
	this.viewToContentHeightRatio = content.clientHeight / content.scrollHeight;
	this.viewWidth = content.clientWidth;
	this.viewToContentWidthRatio = content.clientWidth / content.scrollWidth;
	//I'm worried that the scrollHeight/Width could change on me. If that turns
	//out to be a problem, then getters would be the way to go.

	//extras
	this.scrollbars = [];
	this.content = content;
}

AppleScrollArea.prototype.addScrollbar = function(scrollbar) {
	this.scrollbars.push(scrollbar);
	scrollbar.setScrollArea(this);
}

AppleScrollArea.prototype.removeScrollbar = function(scrollbar) {
	this.scrollbars.filter(function(element){return (element === scrollbar);});
	scrollbar.setScrollArea(null); //Just a guess. This might not be right.
}

AppleScrollArea.prototype.remove = function() {
	//Remove the div, or remove the effects of AppleScrollArea?
	//Perhaps this can all be replaced with a simple removeChild()
	content.scrollTop = 0;
	content.scrollLeft = 0;
	for (var i = 0; i < this.scrollbars.length; i++) {
		this.scrollbars[i].remove();
		delete this.scrollbars[i];
	}
	delete this;
}

AppleScrollArea.prototype.reveal = function(element) {
	//First we find it
	var distX = 0;
	var distY = 0;
	var el = element;
	while (el !== this.content) {
		distX += (+el.offsetTop);
		distY += (+el.offsetLeft);
		el = el.parentNode;
		if (el == null) {
			throw "Target element not in ScrollArea.";
		}
	}

	this.verticalScrollTo(distY);
	this.horizontalScrollTo(distX);
}

AppleScrollArea.prototype.focus = function() {
	this.content.focus();
}

AppleScrollArea.prototype.blur = function() {
	this.content.blur();
}

AppleScrollArea.prototype.verticalScrollTo = function(position) {
	this.scrollTop = position;
}

AppleScrollArea.prototype.horizontalScrollTo = function(position) {
	this.scrollLeft = position;
}