Commit 1fe914ac authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

parseInt -> '>>'

http://jsperf.com/testparseint
refactoring code

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56752 954022d7-b5bf-4e40-9824-e11837661b57
parent 55cd61b3
...@@ -454,4 +454,4 @@ var c_oAscCoAuthoringDottedDistance = 2; ...@@ -454,4 +454,4 @@ var c_oAscCoAuthoringDottedDistance = 2;
var c_oAscLockNameFrozenPane = "frozenPane"; var c_oAscLockNameFrozenPane = "frozenPane";
var c_oAscLockNameTabColor = "tabColor"; var c_oAscLockNameTabColor = "tabColor";
var FONT_THUMBNAIL_HEIGHT = parseInt(7 * 96.0 / 25.4); var FONT_THUMBNAIL_HEIGHT = (7 * 96.0 / 25.4) >> 0;
...@@ -1332,7 +1332,7 @@ ...@@ -1332,7 +1332,7 @@
if (this._canResize()) { if (this._canResize()) {
var item; var item;
var activeIndex = this.model.getActive(); var activeIndex = this.model.getActive();
for(var i in this.wsViews) if (this.wsViews.hasOwnProperty(i)) { for(var i in this.wsViews) {
item = this.wsViews[i]; item = this.wsViews[i];
// Делаем resize (для не активных сменим как только сделаем его активным) // Делаем resize (для не активных сменим как только сделаем его активным)
item.resize(/*isDraw*/i == activeIndex); item.resize(/*isDraw*/i == activeIndex);
...@@ -1374,7 +1374,7 @@ ...@@ -1374,7 +1374,7 @@
var item; var item;
var activeIndex = this.model.getActive(); var activeIndex = this.model.getActive();
for(i in this.wsViews) if (this.wsViews.hasOwnProperty(i)) { for(i in this.wsViews) {
item = this.wsViews[i]; item = this.wsViews[i];
// Меняем zoom (для не активных сменим как только сделаем его активным) // Меняем zoom (для не активных сменим как только сделаем его активным)
item.changeZoom(/*isDraw*/i == activeIndex); item.changeZoom(/*isDraw*/i == activeIndex);
...@@ -1852,7 +1852,7 @@ ...@@ -1852,7 +1852,7 @@
WorkbookView.prototype._initCommentsToSave = function () { WorkbookView.prototype._initCommentsToSave = function () {
var isFirst = true; var isFirst = true;
for (var wsKey in this.wsViews) if (this.wsViews.hasOwnProperty(wsKey)) { for (var wsKey in this.wsViews) {
var wsView = this.wsViews[wsKey]; var wsView = this.wsViews[wsKey];
var wsModel = wsView.model; var wsModel = wsView.model;
wsView.cellCommentator.prepareCommentsToSave(); wsView.cellCommentator.prepareCommentsToSave();
......
...@@ -338,7 +338,7 @@ ...@@ -338,7 +338,7 @@
* @param {Array} buffers DrawingContext + Overlay * @param {Array} buffers DrawingContext + Overlay
* @param {StringRender} stringRender StringRender * @param {StringRender} stringRender StringRender
* @param {Number} maxDigitWidth Максимальный размер цифры * @param {Number} maxDigitWidth Максимальный размер цифры
* @param {asc_CCollaborativeEditing} collaborativeEditing * @param {asc.CCollaborativeEditing} collaborativeEditing
* @param {Object} settings Settings * @param {Object} settings Settings
* *
* @constructor * @constructor
...@@ -1143,15 +1143,10 @@ ...@@ -1143,15 +1143,10 @@
var tmp; var tmp;
var arrayCells = []; var arrayCells = [];
for (var i in aCFs) { for (var i in aCFs) {
if (!aCFs.hasOwnProperty(i) )
continue;
aRules = aCFs[i].aRules; aRules = aCFs[i].aRules;
if (0 >= aRules.length) if (0 >= aRules.length)
continue; continue;
for (var j in aRules) { for (var j in aRules) {
if (!aRules.hasOwnProperty(j))
continue;
oRule = aRules[j]; oRule = aRules[j];
// ToDo aboveAverage, beginsWith, cellIs, containsBlanks, containsErrors, // ToDo aboveAverage, beginsWith, cellIs, containsBlanks, containsErrors,
// ToDo containsText, dataBar, duplicateValues, endsWith, expression, iconSet, notContainsBlanks, // ToDo containsText, dataBar, duplicateValues, endsWith, expression, iconSet, notContainsBlanks,
...@@ -1182,11 +1177,9 @@ ...@@ -1182,11 +1177,9 @@
oGradient.init(min, max); oGradient.init(min, max);
for (var cell in arrayCells) { for (var cell in arrayCells) {
if (arrayCells.hasOwnProperty(cell)) { var dxf = new CellXfs();
var dxf = new CellXfs(); dxf.fill = new Fill({bg:oGradient.calculateColor(arrayCells[cell].val)});
dxf.fill = new Fill({bg:oGradient.calculateColor(arrayCells[cell].val)}); arrayCells[cell].cell.setConditionalFormattingStyle(dxf);
arrayCells[cell].cell.setConditionalFormattingStyle(dxf);
}
} }
} }
...@@ -2377,7 +2370,7 @@ ...@@ -2377,7 +2370,7 @@
this._drawRowText(drawingCtx, row, range.c1, range.c2, offsetX, offsetY) ); this._drawRowText(drawingCtx, row, range.c1, range.c2, offsetX, offsetY) );
} }
// draw merged cells at last stage to fix cells background issue // draw merged cells at last stage to fix cells background issue
for (i in mergedCells) if (mergedCells.hasOwnProperty(i)) { for (i in mergedCells) {
mc = mergedCells[i]; mc = mergedCells[i];
this._drawRowBG(drawingCtx, mc.r1, mc.c1, mc.c1, offsetX, offsetY, mc); this._drawRowBG(drawingCtx, mc.r1, mc.c1, mc.c1, offsetX, offsetY, mc);
this._drawCellText(drawingCtx, mc.c1, mc.r1, range.c1, range.c2, offsetX, offsetY, true); this._drawCellText(drawingCtx, mc.c1, mc.r1, range.c1, range.c2, offsetX, offsetY, true);
...@@ -2466,23 +2459,23 @@ ...@@ -2466,23 +2459,23 @@
WorksheetView.prototype._drawRowText = function (drawingCtx, row, colStart, colEnd, offsetX, offsetY) { WorksheetView.prototype._drawRowText = function (drawingCtx, row, colStart, colEnd, offsetX, offsetY) {
if (this.rows[row].height < this.height_1px) {return {};} if (this.rows[row].height < this.height_1px) {return {};}
var dependentCells = {}, mergedCells = {}, i = undefined, mc; var dependentCells = {}, mergedCells = {}, i, mc, col;
// draw cells' text // draw cells' text
for (var col = colStart; col <= colEnd; ++col) { for (col = colStart; col <= colEnd; ++col) {
if (this.cols[col].width < this.width_1px) {continue;} if (this.cols[col].width < this.width_1px) {continue;}
mc = this._drawCellText(drawingCtx, col, row, colStart, colEnd, offsetX, offsetY, false); mc = this._drawCellText(drawingCtx, col, row, colStart, colEnd, offsetX, offsetY, false);
if (mc !== null) {mergedCells[mc.index] = {c1: mc.c1, r1: mc.r1, c2: mc.c2, r2: mc.r2};} if (mc !== null) {mergedCells[mc.index] = {c1: mc.c1, r1: mc.r1, c2: mc.c2, r2: mc.r2};}
// check if long text overlaps this cell // check if long text overlaps this cell
i = this._findSourceOfCellText(col, row); i = this._findSourceOfCellText(col, row);
if (i >= 0) { if (i >= 0) {
dependentCells[i] = (dependentCells[i] || []); dependentCells[i] = (dependentCells[i] || []);
dependentCells[i].push(col); dependentCells[i].push(col);
} }
} }
// draw long text that overlaps own cell's borders // draw long text that overlaps own cell's borders
for (i in dependentCells) if (dependentCells.hasOwnProperty(i)) { for (i in dependentCells) {
var arr = dependentCells[i], j = arr.length - 1; var arr = dependentCells[i], j = arr.length - 1;
col = parseInt(i, 10); col = i >> 0;
// if source cell belongs to cells range then skip it (text has been drawn already) // if source cell belongs to cells range then skip it (text has been drawn already)
if (col >= arr[0] && col <= arr[j]) {continue;} if (col >= arr[0] && col <= arr[j]) {continue;}
// draw long text fragment // draw long text fragment
...@@ -3732,8 +3725,6 @@ ...@@ -3732,8 +3725,6 @@
opt = this.settings, lengthColors = opt.formulaRangeBorderColor.length; opt = this.settings, lengthColors = opt.formulaRangeBorderColor.length;
var strokeColor, fillColor; var strokeColor, fillColor;
for (var i in arrRanges) { for (var i in arrRanges) {
if (!arrRanges.hasOwnProperty(i))
continue;
var oFormulaRange = arrRanges[i].clone(true); var oFormulaRange = arrRanges[i].clone(true);
strokeColor = fillColor = opt.formulaRangeBorderColor[i%lengthColors]; strokeColor = fillColor = opt.formulaRangeBorderColor[i%lengthColors];
this._drawElements(this, this._drawSelectionElement, oFormulaRange, isDashLine, lineWidth, this._drawElements(this, this._drawSelectionElement, oFormulaRange, isDashLine, lineWidth,
...@@ -4183,8 +4174,6 @@ ...@@ -4183,8 +4174,6 @@
continue; continue;
rowCells = rowModel.getCells(); rowCells = rowModel.getCells();
for (cellColl in rowCells) { for (cellColl in rowCells) {
if (!rowCells.hasOwnProperty(cellColl))
continue;
cellColl = cellColl - 0; cellColl = cellColl - 0;
if (this.width_1px > this.cols[cellColl].width) {continue;} if (this.width_1px > this.cols[cellColl].width) {continue;}
...@@ -4195,18 +4184,17 @@ ...@@ -4195,18 +4184,17 @@
}; };
WorksheetView.prototype._fetchRowCache = function (row) { WorksheetView.prototype._fetchRowCache = function (row) {
var rc = this.cache.rows[row] = ( this.cache.rows[row] || new CacheElement() ); return (this.cache.rows[row] = ( this.cache.rows[row] || new CacheElement() ));
return rc;
}; };
WorksheetView.prototype._fetchCellCache = function (col, row) { WorksheetView.prototype._fetchCellCache = function (col, row) {
var r = this._fetchRowCache(row), c = r.columns[col] = ( r.columns[col] || {} ); var r = this._fetchRowCache(row);
return c; return (r.columns[col] = ( r.columns[col] || {} ));
}; };
WorksheetView.prototype._fetchCellCacheText = function (col, row) { WorksheetView.prototype._fetchCellCacheText = function (col, row) {
var r = this._fetchRowCache(row), cwt = r.columnsWithText[col] = ( r.columnsWithText[col] || {} ); var r = this._fetchRowCache(row);
return cwt; return (r.columnsWithText[col] = ( r.columnsWithText[col] || {} ));
}; };
WorksheetView.prototype._getRowCache = function (row) { WorksheetView.prototype._getRowCache = function (row) {
...@@ -4554,7 +4542,7 @@ ...@@ -4554,7 +4542,7 @@
if (!r.columns[i] || 0 === this.cols[i].width) {continue;} if (!r.columns[i] || 0 === this.cols[i].width) {continue;}
var ct = r.columns[i].text; var ct = r.columns[i].text;
if (!ct) {continue;} if (!ct) {continue;}
i = parseInt(i); i >>= 0;
var lc = i - ct.sideL, var lc = i - ct.sideL,
rc = i + ct.sideR; rc = i + ct.sideR;
if (col >= lc && col <= rc) {return i;} if (col >= lc && col <= rc) {return i;}
...@@ -5591,8 +5579,6 @@ ...@@ -5591,8 +5579,6 @@
var arrRanges = this.isFormulaEditMode ? this.arrActiveFormulaRanges : this.arrActiveChartsRanges, var arrRanges = this.isFormulaEditMode ? this.arrActiveFormulaRanges : this.arrActiveChartsRanges,
targetArr = this.isFormulaEditMode ? 0 : -1; targetArr = this.isFormulaEditMode ? 0 : -1;
for (i in arrRanges) { for (i in arrRanges) {
if (!arrRanges.hasOwnProperty(i))
continue;
oFormulaRange = arrRanges[i].clone(true); oFormulaRange = arrRanges[i].clone(true);
oFormulaIn = oFormulaRange.intersection(this.visibleRange); oFormulaIn = oFormulaRange.intersection(this.visibleRange);
......
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