[Libreoffice-commits] online.git: 3 commits - loleaflet/src loolwsd/LOOLSession.cpp
Mihai Varga
mihai.varga at collabora.com
Mon Dec 14 04:57:34 PST 2015
loleaflet/src/control/Control.ColumnHeader.js | 18 +-----------------
loleaflet/src/control/Control.RowHeader.js | 21 +--------------------
loleaflet/src/layer/tile/CalcTileLayer.js | 7 +------
loolwsd/LOOLSession.cpp | 7 ++++++-
4 files changed, 9 insertions(+), 44 deletions(-)
New commits:
commit a0d6f7d6d55d323a747923ec353722cb1e2d9535
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Mon Dec 14 14:55:28 2015 +0200
loleaflet: always use fillRow/fillColumn
This avoid the case in which the row/column headers are just resized
but they are empty or invalid
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 22d19d5..f8a406a 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -62,12 +62,7 @@ L.Control.ColumnHeader = L.Control.extend({
},
viewRowColumnHeaders: function (e) {
- if (e.isZoomEnd) {
- this.updateColumns(e.data.columns, e.converter, e.context);
- }
- else {
- this.fillColumns(e.data.columns, e.converter, e.context);
- }
+ this.fillColumns(e.data.columns, e.converter, e.context);
},
fillColumns: function (columns, converter, context) {
@@ -84,17 +79,6 @@ L.Control.ColumnHeader = L.Control.extend({
}
},
- updateColumns: function (columns, converter, context) {
- var iterator, twip, width, column;
-
- for (iterator = 0; iterator < this._columns.childNodes.length; iterator++) {
- column = this._columns.childNodes[iterator];
- width = columns[iterator].size - (iterator > 0 ? columns[iterator - 1].size : 0);
- twip = new L.Point(width, width);
- column.width = Math.round(converter.call(context, twip).x) - 1 + 'px';
- }
- },
-
_onUpdatePermission: function () {
if (this._map.getDocType() === 'spreadsheet' && !this._initialized) {
this._initialize();
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index d6f4eab..1484958 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -55,12 +55,7 @@ L.Control.RowHeader = L.Control.extend({
},
viewRowColumnHeaders: function (e) {
- if (e.isZoomEnd) {
- this.updateRows(e.data.rows, e.converter, e.context);
- }
- else {
- this.fillRows(e.data.rows, e.converter, e.context);
- }
+ this.fillRows(e.data.rows, e.converter, e.context);
},
fillRows: function (rows, converter, context) {
@@ -80,19 +75,6 @@ L.Control.RowHeader = L.Control.extend({
}
},
- updateRows: function (rows, converter, context) {
- var iterator, twip, height, text;
-
- for (iterator = 0; iterator < this._rows.childNodes.length; iterator++) {
- text = this._rows.childNodes[iterator].firstChild.firstChild;
- height = rows[iterator].size - (iterator > 0 ? rows[iterator - 1].size : 0);
- twip = new L.Point(height, height);
- height = Math.round(converter.call(context, twip).y) - (iterator > 0 ? 1 : 0) + 'px';
- L.DomUtil.setStyle(text, 'line-height', height);
- L.DomUtil.setStyle(text, 'height', height);
- }
- },
-
_onUpdatePermission: function () {
if (this._map.getDocType() === 'spreadsheet' && !this._initialized) {
this._initialize();
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 47346b0..6364345 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -107,7 +107,6 @@ L.CalcTileLayer = L.TileLayer.extend({
},
_onZoomRowColumns: function () {
- this._isZoomEnd = true;
this._updateClientZoom();
if (this._clientZoom) {
L.Socket.sendMessage('clientzoom ' + this._clientZoom);
@@ -169,10 +168,8 @@ L.CalcTileLayer = L.TileLayer.extend({
this._map.fire('viewrowcolumnheaders', {
data: data,
converter: this._twipsToPixels,
- context: this,
- isZoomEnd: this._isZoomEnd
+ context: this
});
- this._isZoomEnd = false;
this._onUpdateViewPort();
}
else {
commit a3084d523500bcf4a148e1289572c5d851426061
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Mon Dec 14 14:51:35 2015 +0200
loleaflet: fixed a typo and removed some comments
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 21d3215..22d19d5 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -62,7 +62,7 @@ L.Control.ColumnHeader = L.Control.extend({
},
viewRowColumnHeaders: function (e) {
- if (e.isZoomed) {
+ if (e.isZoomEnd) {
this.updateColumns(e.data.columns, e.converter, e.context);
}
else {
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index 2085da2..d6f4eab 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -55,13 +55,12 @@ L.Control.RowHeader = L.Control.extend({
},
viewRowColumnHeaders: function (e) {
- if (e.isZoomed) {
+ if (e.isZoomEnd) {
this.updateRows(e.data.rows, e.converter, e.context);
}
else {
this.fillRows(e.data.rows, e.converter, e.context);
}
- this._map._docLayer._isZoomed = false;
},
fillRows: function (rows, converter, context) {
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 4146ac8..47346b0 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -107,8 +107,7 @@ L.CalcTileLayer = L.TileLayer.extend({
},
_onZoomRowColumns: function () {
- // TODO we need to cache those, so that we don't spawn a LOK instance unnecessarily
- this._isZoomend = true;
+ this._isZoomEnd = true;
this._updateClientZoom();
if (this._clientZoom) {
L.Socket.sendMessage('clientzoom ' + this._clientZoom);
@@ -118,8 +117,6 @@ L.CalcTileLayer = L.TileLayer.extend({
},
_onUpdateViewPort: function () {
- // sadly I don't know what this number 4 is, but without it, it does not work
- // TODO fix it
var width = parseInt(L.DomUtil.getStyle(this._map._container, 'width'));
var height = parseInt(L.DomUtil.getStyle(this._map._container, 'height'));
this._map.fire('updateviewport', {
@@ -173,8 +170,9 @@ L.CalcTileLayer = L.TileLayer.extend({
data: data,
converter: this._twipsToPixels,
context: this,
- isZoomed: this._isZoomed
+ isZoomEnd: this._isZoomEnd
});
+ this._isZoomEnd = false;
this._onUpdateViewPort();
}
else {
commit 803c89a43f2e8452c186f0672e1fa85750181fe7
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Mon Dec 14 14:38:05 2015 +0200
loolwsd: only cache font/style command values
This fixes a bug where row/column headers were cached too
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 0c8d672..7319fc0 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -277,7 +277,12 @@ bool MasterProcessSession::handleInput(const char *buffer, int length)
Var result = parser.parse(stringJSON);
Object::Ptr object = result.extract<Object::Ptr>();
std::string commandName = object->get("commandName").toString();
- peer->_tileCache->saveTextFile(std::string(buffer, length), "cmdValues" + commandName + ".txt");
+ if (commandName.find(".uno:CharFontName") != std::string::npos ||
+ commandName.find(".uno:StyleApply") != std::string::npos)
+ {
+ // other commands should not be cached
+ peer->_tileCache->saveTextFile(std::string(buffer, length), "cmdValues" + commandName + ".txt");
+ }
}
else if (tokens[0] == "partpagerectangles:")
{
More information about the Libreoffice-commits
mailing list