Commit e5beeb65 authored by rdsmith@chromium.org's avatar rdsmith@chromium.org

Revert 182285

> Revert 182242
> > Files.app: Add missing JSdoc for member methods/variables #1.
> > 
> > All the changes are in comment. No semantics are changed.
> > 
> > BUG=175657
> > TEST=none
> > TBR=mtomasz@chromium.org
> > 
> > Review URL: https://codereview.chromium.org/12254009
> 
> TBR=yoshiki@chromium.org
> Review URL: https://codereview.chromium.org/12254015

TBR=rdsmith@chromium.org
Review URL: https://codereview.chromium.org/12262017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182298 0039d316-1c4b-4281-b951-d872f2087c98
parent 02983a05
......@@ -30,7 +30,9 @@ ImageEditor.Mode.Adjust.prototype.cleanUpUI = function() {
this.hidePreview();
};
//TODO(JSDOC)
/**
* TODO(JSDOC)
*/
ImageEditor.Mode.Adjust.prototype.hidePreview = function() {
if (this.canvas_) {
this.canvas_.parentNode.removeChild(this.canvas_);
......@@ -38,20 +40,27 @@ ImageEditor.Mode.Adjust.prototype.hidePreview = function() {
}
};
//TODO(JSDOC)
/**
* TODO(JSDOC)
*/
ImageEditor.Mode.Adjust.prototype.cleanUpCaches = function() {
this.filter_ = null;
this.previewImageData_ = null;
};
//TODO(JSDOC)
/**
* TODO(JSDOC)
*/
ImageEditor.Mode.Adjust.prototype.reset = function() {
ImageEditor.Mode.prototype.reset.call(this);
this.hidePreview();
this.cleanUpCaches();
};
//TODO(JSDOC)
/**
* TODO(JSDOC)
* @param {Object} options //TODO(JSDOC).
*/
ImageEditor.Mode.Adjust.prototype.update = function(options) {
ImageEditor.Mode.prototype.update.apply(this, arguments);
......@@ -90,7 +99,11 @@ ImageEditor.Mode.Adjust.prototype.updatePreviewImage = function() {
* Own methods
*/
//TODO(JSDOC)
/**
* TODO(JSDOC)
* @param {Object} options //TODO(JSDOC).
* @return {function(ImageData,ImageData,number,number)} Created function.
*/
ImageEditor.Mode.Adjust.prototype.createFilter = function(options) {
return filter.create(this.name, options);
};
......@@ -106,6 +119,11 @@ ImageEditor.Mode.ColorFilter = function() {
ImageEditor.Mode.ColorFilter.prototype =
{__proto__: ImageEditor.Mode.Adjust.prototype};
/**
* TODO(JSDOC)
* @return {{r: Array.<number>, g: Array.<number>, b: Array.<number>}}
* histogram.
*/
ImageEditor.Mode.ColorFilter.prototype.getHistogram = function() {
return filter.getHistogram(this.getImageView().getThumbnail());
};
......@@ -121,6 +139,10 @@ ImageEditor.Mode.Exposure = function() {
ImageEditor.Mode.Exposure.prototype =
{__proto__: ImageEditor.Mode.ColorFilter.prototype};
/**
* TODO(JSDOC)
* @param {ImageEditor.Toolbar} toolbar The toolbar to populate.
*/
ImageEditor.Mode.Exposure.prototype.createTools = function(toolbar) {
toolbar.addRange('brightness', -1, 0, 1, 100);
toolbar.addRange('contrast', -1, 0, 1, 100);
......@@ -138,16 +160,27 @@ ImageEditor.Mode.Autofix = function() {
ImageEditor.Mode.Autofix.prototype =
{__proto__: ImageEditor.Mode.ColorFilter.prototype};
/**
* TODO(JSDOC)
* @param {ImageEditor.Toolbar} toolbar The toolbar to populate.
*/
ImageEditor.Mode.Autofix.prototype.createTools = function(toolbar) {
var self = this;
toolbar.addButton('Apply', this.apply.bind(this));
};
/**
* TODO(JSDOC)
* @return {boolean} //TODO(JSDOC)
*/
ImageEditor.Mode.Autofix.prototype.isApplicable = function() {
return this.getImageView().hasValidImage() &&
filter.autofix.isApplicable(this.getHistogram());
};
/**
* TODO(JSDOC)
*/
ImageEditor.Mode.Autofix.prototype.apply = function() {
this.update({histogram: this.getHistogram()});
};
......@@ -164,6 +197,9 @@ ImageEditor.Mode.InstantAutofix = function() {
ImageEditor.Mode.InstantAutofix.prototype =
{__proto__: ImageEditor.Mode.Autofix.prototype};
/**
* TODO(JSDOC)
*/
ImageEditor.Mode.InstantAutofix.prototype.setUp = function() {
ImageEditor.Mode.Autofix.prototype.setUp.apply(this, arguments);
this.apply();
......@@ -180,6 +216,10 @@ ImageEditor.Mode.Blur = function() {
ImageEditor.Mode.Blur.prototype =
{__proto__: ImageEditor.Mode.Adjust.prototype};
/**
* TODO(JSDOC)
* @param {ImageEditor.Toolbar} toolbar The toolbar to populate.
*/
ImageEditor.Mode.Blur.prototype.createTools = function(toolbar) {
toolbar.addRange('strength', 0, 0, 1, 100);
toolbar.addRange('radius', 1, 1, 3);
......@@ -196,6 +236,10 @@ ImageEditor.Mode.Sharpen = function() {
ImageEditor.Mode.Sharpen.prototype =
{__proto__: ImageEditor.Mode.Adjust.prototype};
/**
* TODO(JSDOC)
* @param {ImageEditor.Toolbar} toolbar The toolbar to populate.
*/
ImageEditor.Mode.Sharpen.prototype.createTools = function(toolbar) {
toolbar.addRange('strength', 0, 0, 1, 100);
toolbar.addRange('radius', 1, 1, 3);
......
......@@ -13,7 +13,10 @@ function ImageBuffer() {
this.overlays_ = [];
}
//TODO(JSDOC)
/**
* TODO(JSDOC).
* @param {ImageBuffer.Overlay} overlay //TODO(JSDOC).
*/
ImageBuffer.prototype.addOverlay = function(overlay) {
var zIndex = overlay.getZIndex();
// Store the overlays in the ascending Z-order.
......@@ -24,7 +27,10 @@ ImageBuffer.prototype.addOverlay = function(overlay) {
this.overlays_.splice(i, 0, overlay);
};
//TODO(JSDOC)
/**
* TODO(JSDOC).
* @param {ImageBuffer.Overlay} overlay //TODO(JSDOC).
*/
ImageBuffer.prototype.removeOverlay = function(overlay) {
for (var i = 0; i != this.overlays_.length; i++) {
if (this.overlays_[i] == overlay) {
......@@ -119,25 +125,58 @@ ImageBuffer.DoubleTapAction = {
* and the behavior of the ImageBuffer instance.
* @class
*/
//TODO(JSDOC)
ImageBuffer.Overlay = function() {};
//TODO(JSDOC)
/**
* TODO(JSDOC).
* @return {number} //TODO(JSDOC).
*/
ImageBuffer.Overlay.prototype.getZIndex = function() { return 0 };
//TODO(JSDOC)
/**
* TODO(JSDOC).
*/
ImageBuffer.Overlay.prototype.draw = function() {};
//TODO(JSDOC)
ImageBuffer.Overlay.prototype.getCursorStyle = function() { return null };
/**
* TODO(JSDOC).
* @param {number} x X coordinate for cursor.
* @param {number} y Y coordinate for cursor.
* @param {boolean} mouseDown If mouse button is down.
* @return {?string} A value for style.cursor CSS property or null for
* default.
*/
ImageBuffer.Overlay.prototype.getCursorStyle = function(x, y, mouseDown) {
return null;
};
//TODO(JSDOC)
ImageBuffer.Overlay.prototype.onClick = function() { return false };
/**
* TODO(JSDOC).
* @param {number} x //TODO(JSDOC).
* @param {number} y //TODO(JSDOC).
* @return {boolean} //TODO(JSDOC).
*/
ImageBuffer.Overlay.prototype.onClick = function(x, y) {
return false;
};
//TODO(JSDOC)
ImageBuffer.Overlay.prototype.getDragHandler = function() { return null };
/**
* TODO(JSDOC).
* @param {number} x Event X coordinate.
* @param {number} y Event Y coordinate.
* @param {boolean} touch True if it's a touch event, false if mouse.
* @return {function(number,number)} A function to be called on mouse drag.
*/
ImageBuffer.Overlay.prototype.getDragHandler = function(x, y, touch) {
return null;
};
//TODO(JSDOC)
/**
* TODO(JSDOC).
* @param {number} x //TODO(JSDOC).
* @param {number} y //TODO(JSDOC).
* @return {ImageBuffer.DoubleTapAction} //TODO(JSDOC).
*/
ImageBuffer.Overlay.prototype.getDoubleTapAction = function(x, y) {
return ImageBuffer.DoubleTapAction.NOTHING;
};
......@@ -7,10 +7,16 @@
*/
function ImageEncoder() {}
//TODO(JSDOC)
/**
* @type {Array.<Object>}
*/
ImageEncoder.metadataEncoders = {};
//TODO(JSDOC)
/**
* @param {function(new:ImageEncoder.MetadataEncoder)} constructor
* //TODO(JSDOC).
* @param {string} mimeType //TODO(JSDOC).
*/
ImageEncoder.registerMetadataEncoder = function(constructor, mimeType) {
ImageEncoder.metadataEncoders[mimeType] = constructor;
};
......@@ -141,6 +147,13 @@ ImageEncoder.createThumbnail = function(canvas, opt_shrinkage) {
return thumbnailCanvas;
};
/**
* TODO(JSDOC)
* @param {string} string //TODO(JSDOC).
* @param {number} from //TODO(JSDOC).
* @param {number} to //TODO(JSDOC).
* @return {ArrayBuffer} //TODO(JSDOC).
*/
ImageEncoder.stringToArrayBuffer = function(string, from, to) {
var size = to - from;
var array = new Uint8Array(size);
......@@ -168,6 +181,10 @@ ImageEncoder.MetadataEncoder = function(original_metadata) {
}
};
/**
* TODO(JSDOC)
* @return {Object} //TODO(JSDOC).
*/
ImageEncoder.MetadataEncoder.prototype.getMetadata = function() {
return this.metadata_;
};
......
......@@ -12,6 +12,9 @@ ImageEditor.Mode.Crop = function() {
ImageEditor.Mode.Crop.prototype = {__proto__: ImageEditor.Mode.prototype};
/**
* TODO(JSDOC).
*/
ImageEditor.Mode.Crop.prototype.setUp = function() {
ImageEditor.Mode.prototype.setUp.apply(this, arguments);
......@@ -65,11 +68,17 @@ ImageEditor.Mode.Crop.prototype.setUp = function() {
this.createDefaultCrop();
};
/**
* TODO(JSDOC).
*/
ImageEditor.Mode.Crop.prototype.reset = function() {
ImageEditor.Mode.prototype.reset.call(this);
this.createDefaultCrop();
};
/**
* TODO(JSDOC).
*/
ImageEditor.Mode.Crop.prototype.positionDOM = function() {
var screenClipped = this.viewport_.getScreenClipped();
......@@ -95,6 +104,9 @@ ImageEditor.Mode.Crop.prototype.positionDOM = function() {
(screenCrop.top + screenCrop.height) + 'px';
};
/**
* TODO(JSDOC).
*/
ImageEditor.Mode.Crop.prototype.cleanUpUI = function() {
ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments);
this.domOverlay_.parentNode.removeChild(this.domOverlay_);
......@@ -102,14 +114,29 @@ ImageEditor.Mode.Crop.prototype.cleanUpUI = function() {
this.editor_.hideOverlappingTools();
};
/**
* @const
* @type {number}
*/
ImageEditor.Mode.Crop.MOUSE_GRAB_RADIUS = 6;
/**
* @const
* @type {number}
*/
ImageEditor.Mode.Crop.TOUCH_GRAB_RADIUS = 20;
/**
* TODO(JSDOC).
* @return {Command.Crop} //TODO(JSDOC).
*/
ImageEditor.Mode.Crop.prototype.getCommand = function() {
var cropImageRect = this.cropRect_.getRect();
return new Command.Crop(cropImageRect);
};
/**
* TODO(JSDOC).
*/
ImageEditor.Mode.Crop.prototype.createDefaultCrop = function() {
var rect = new Rect(this.getViewport().getImageClipped());
rect = rect.inflate(
......@@ -118,10 +145,24 @@ ImageEditor.Mode.Crop.prototype.createDefaultCrop = function() {
this.positionDOM();
};
/**
* TODO(JSDOC).
* @param {number} x X coordinate for cursor.
* @param {number} y Y coordinate for cursor.
* @param {boolean} mouseDown If mouse button is down.
* @return {string} A value for style.cursor CSS property.
*/
ImageEditor.Mode.Crop.prototype.getCursorStyle = function(x, y, mouseDown) {
return this.cropRect_.getCursorStyle(x, y, mouseDown);
};
/**
* TODO(JSDOC).
* @param {number} x Event X coordinate.
* @param {number} y Event Y coordinate.
* @param {boolean} touch True if it's a touch event, false if mouse.
* @return {function(number,number)} A function to be called on mouse drag.
*/
ImageEditor.Mode.Crop.prototype.getDragHandler = function(x, y, touch) {
var cropDragHandler = this.cropRect_.getDragHandler(x, y, touch);
if (!cropDragHandler) return null;
......@@ -134,6 +175,12 @@ ImageEditor.Mode.Crop.prototype.getDragHandler = function(x, y, touch) {
};
};
/**
* TODO(JSDOC).
* @param {number} x X coordinate of the event.
* @param {number} y Y coordinate of the event.
* @return {ImageBuffer.DoubleTapAction} Action to perform as result.
*/
ImageEditor.Mode.Crop.prototype.getDoubleTapAction = function(x, y) {
return this.cropRect_.getDoubleTapAction(x, y);
};
......@@ -141,7 +188,7 @@ ImageEditor.Mode.Crop.prototype.getDoubleTapAction = function(x, y) {
/*
* A draggable rectangle over the image.
*/
//TODO(JSDOC)
//TODO(JSDOC).
function DraggableRect(rect, viewport, sensitivity) {
// The bounds are not held in a regular rectangle (with width/height).
......@@ -171,36 +218,79 @@ function DraggableRect(rect, viewport, sensitivity) {
}
// Static members to simplify reflective access to the bounds.
/**
* @const
* @type {string}
*/
DraggableRect.LEFT = 'left';
/**
* @const
* @type {string}
*/
DraggableRect.RIGHT = 'right';
/**
* @const
* @type {string}
*/
DraggableRect.TOP = 'top';
/**
* @const
* @type {string}
*/
DraggableRect.BOTTOM = 'bottom';
/**
* @const
* @type {string}
*/
DraggableRect.NONE = 'none';
//TODO(JSDOC)
/**
* TODO(JSDOC)
* @return {number} //TODO(JSDOC).
*/
DraggableRect.prototype.getLeft = function() {
return this.bounds_[DraggableRect.LEFT];
};
//TODO(JSDOC)
/**
* TODO(JSDOC)
* @return {number} //TODO(JSDOC).
*/
DraggableRect.prototype.getRight = function() {
return this.bounds_[DraggableRect.RIGHT];
};
//TODO(JSDOC)
/**
* TODO(JSDOC)
* @return {number} //TODO(JSDOC).
*/
DraggableRect.prototype.getTop = function() {
return this.bounds_[DraggableRect.TOP];
};
//TODO(JSDOC)
/**
* TODO(JSDOC)
* @return {number} //TODO(JSDOC).
*/
DraggableRect.prototype.getBottom = function() {
return this.bounds_[DraggableRect.BOTTOM];
};
//TODO(JSDOC)
DraggableRect.prototype.getRect = function() { return new Rect(this.bounds_) };
/**
* TODO(JSDOC)
* @return {Rect} //TODO(JSDOC).
*/
DraggableRect.prototype.getRect = function() {
return new Rect(this.bounds_);
};
//TODO(JSDOC)
/**
* TODO(JSDOC)
* @param {number} x X coordinate for cursor.
* @param {number} y Y coordinate for cursor.
* @param {boolean} touch //TODO(JSDOC).
* @return {Object} //TODO(JSDOC).
*/
DraggableRect.prototype.getDragMode = function(x, y, touch) {
var result = {
xSide: DraggableRect.NONE,
......@@ -248,6 +338,13 @@ DraggableRect.prototype.getDragMode = function(x, y, touch) {
return result;
};
/**
* TODO(JSDOC)
* @param {number} x X coordinate for cursor.
* @param {number} y Y coordinate for cursor.
* @param {boolean} mouseDown If mouse button is down.
* @return {string} //TODO(JSDOC).
*/
DraggableRect.prototype.getCursorStyle = function(x, y, mouseDown) {
var mode;
if (mouseDown) {
......@@ -261,6 +358,13 @@ DraggableRect.prototype.getCursorStyle = function(x, y, mouseDown) {
return this.cssSide_[mode.ySide] + this.cssSide_[mode.xSide] + '-resize';
};
/**
* TODO(JSDOC)
* @param {number} x X coordinate for cursor.
* @param {number} y Y coordinate for cursor.
* @param {boolean} touch //TODO(JSDOC).
* @return {function(number,number)} //TODO(JSDOC).
*/
DraggableRect.prototype.getDragHandler = function(x, y, touch) {
x = this.viewport_.screenToImageX(x);
y = this.viewport_.screenToImageY(y);
......@@ -355,6 +459,13 @@ DraggableRect.prototype.getDragHandler = function(x, y, touch) {
};
};
/**
* TODO(JSDOC)
* @param {number} x X coordinate for cursor.
* @param {number} y Y coordinate for cursor.
* @param {boolean} touch //TODO(JSDOC).
* @return {ImageBuffer.DoubleTapAction} //TODO(JSDOC).
*/
DraggableRect.prototype.getDoubleTapAction = function(x, y, touch) {
x = this.viewport_.screenToImageX(x);
y = this.viewport_.screenToImageY(y);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment