<commit_before>
Ui.Element.extend('Ui.Image', 
/**@lends Ui.Image#*/
{
	src: undefined,
	loaddone: false,
	naturalWidth: undefined,
	naturalHeight: undefined,
	imageDrawing: undefined,
	setSrcLock: false,

	/**
	 * @constructs
	 * @class
	 * @extends Ui.Element
	 */
	constructor: function(config) {
		this.addEvents('ready');
		this.connect(this.imageDrawing, 'load', this.onImageLoad);
	},

	/**
	* Get the URL of the image
	*/
	getSrc: function() {
		return this.src;
	},

	/**
	* Set the URL of the image. When the image is loaded,
	* ready event is fired and getIsReady return true.
	*/
	setSrc: function(src) {
		this.setSrcLock = true;
		this.loaddone = false;
		this.naturalWidth = undefined;
		this.naturalHeight = undefined;
		this.src = src;
		this.imageDrawing.setAttribute('src', src);
		this.setSrcLock = false;
	},

	/**
	* Return the natural width of the image as defined
	* in the image file. Return undefined if the image is
	* not ready
	*/
	getNaturalWidth: function() {
		return this.naturalWidth;
	},

	/**
	* Return the natural height of the image as defined
	* in the image file. Return undefined if the image is
	* not ready
	*/
	getNaturalHeight: function() {
		return this.naturalHeight;
	},

	/**
	* Return true if the image is loaded<commit_msg>raise exception when setSrc is used with undefined in Ui.Image<commit_after>
Ui.Element.extend('Ui.Image', 
/**@lends Ui.Image#*/
{
	src: undefined,
	loaddone: false,
	naturalWidth: undefined,
	naturalHeight: undefined,
	imageDrawing: undefined,
	setSrcLock: false,

	/**
	 * @constructs
	 * @class
	 * @extends Ui.Element
	 */
	constructor: function(config) {
		this.addEvents('ready');
		this.connect(this.imageDrawing, 'load', this.onImageLoad);
	},

	/**
	* Get the URL of the image
	*/
	getSrc: function() {
		return this.src;
	},

	/**
	* Set the URL of the image. When the image is loaded,
	* ready event is fired and getIsReady return true.
	*/
	setSrc: function(src) {
		if(src == undefined)
			throw('Image src cant be undefined');
	
		this.setSrcLock = true;
		this.loaddone = false;
		this.naturalWidth = undefined;
		this.naturalHeight = undefined;
		this.src = src;
		this.imageDrawing.setAttribute('src', src);
		this.setSrcLock = false;
	},

	/**
	* Return the natural width of the image as defined
	* in the image file. Return undefined if the image is
	* not ready
	*/
	getNaturalWidth: function() {
		return this.naturalWidth;
	},

	/**
	* Return the natural height of the image as defined
	* in the image file. Return undefined if the image is
	* not ready
	*/
	getNaturalHeight: function() {
		return this.naturalHeight;
	},

	/**
	* Return true if the image is loaded
{'fraction_non_alphanumeric': 0.12316935786706722, 'fraction_numerical': 0.0, 'mean_word_length': 3.546075085324232, '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': '1404727', 'n_tokens_mistral': 925, 'n_tokens_neox': 866, 'n_words': 271}