loleaflet/src/control/Parts.js        |    2 
 loleaflet/src/layer/tile/GridLayer.js |    2 
 test/TileCacheTests.cpp               |   85 +++++++++++++++++-----------------
 test/TileQueueTests.cpp               |   58 +++++++++++------------
 test/WhiteBoxTests.cpp                |   21 ++++----
 test/httpwstest.cpp                   |    6 +-
 wsd/ClientSession.cpp                 |    3 -
 wsd/TileDesc.hpp                      |   40 ++++++++++++----
 8 files changed, 123 insertions(+), 94 deletions(-)

New commits:
commit f2e4e260c2abb121e206b5b75f910c130751f3bd
Author:     Mert Tumer <mert.tu...@collabora.com>
AuthorDate: Mon Oct 14 01:11:19 2019 +0300
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Sat Oct 19 20:13:39 2019 +0200

    Extend TileDesc with normalizedViewId
    
    Change-Id: I138dc9547c90eb44f86ca99b192af67fa9422b4b
    
    Include nviewid to the tests with tile messages
    
    Change-Id: I0b59e65648a402ccd136d13e5f00b52a1466f41c
    Reviewed-on: https://gerrit.libreoffice.org/81049
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js
index c428408e7..3602962da 100644
--- a/loleaflet/src/control/Parts.js
+++ b/loleaflet/src/control/Parts.js
@@ -123,6 +123,7 @@ L.Map.include({
                }
 
                this._socket.sendMessage('tile ' +
+                                                       'nviewid=0' + ' ' +
                                                        'part=' + part + ' ' +
                                                        'width=' + maxWidth * 
dpiscale + ' ' +
                                                        'height=' + maxHeight * 
dpiscale + ' ' +
@@ -147,6 +148,7 @@ L.Map.include({
                var dpiscale = L.getDpiScaleFactor();
 
                this._socket.sendMessage('tile ' +
+                                                       'nviewid=0' + ' ' +
                                                        'part=' + part + ' ' +
                                                        'width=' + width * 
dpiscale + ' ' +
                                                        'height=' + height * 
dpiscale + ' ' +
diff --git a/loleaflet/src/layer/tile/GridLayer.js 
b/loleaflet/src/layer/tile/GridLayer.js
index 3fcbbbac5..55cb0263e 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -688,6 +688,7 @@ L.GridLayer = L.Layer.extend({
 
                        if (tilePositionsX !== '' && tilePositionsY !== '') {
                                var message = 'tilecombine ' +
+                                       'nviewid=0' + ' ' +
                                        'part=' + this._selectedPart + ' ' +
                                        'width=' + this._tileWidthPx + ' ' +
                                        'height=' + this._tileHeightPx + ' ' +
@@ -1022,6 +1023,7 @@ L.GridLayer = L.Layer.extend({
 
                        twips = this._coordsToTwips(coords);
                        msg = 'tilecombine ' +
+                               'nviewid=0' + ' ' +
                                'part=' + coords.part + ' ' +
                                'width=' + this._tileWidthPx + ' ' +
                                'height=' + this._tileHeightPx + ' ' +
diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp
index 2b319c300..b6dda807f 100644
--- a/test/TileCacheTests.cpp
+++ b/test/TileCacheTests.cpp
@@ -185,6 +185,7 @@ void TileCacheTests::testSimple()
     // now, so it discards the cached data.
     TileCache tc("doc.ods", Poco::Timestamp(), "/tmp/tile_cache_tests", true);
 
+    int nviewid = 0;
     int part = 0;
     int width = 256;
     int height = 256;
@@ -192,7 +193,7 @@ void TileCacheTests::testSimple()
     int tilePosY = 0;
     int tileWidth = 3840;
     int tileHeight = 3840;
-    TileDesc tile(part, width, height, tilePosX, tilePosY, tileWidth, 
tileHeight, -1, 0, -1, false);
+    TileDesc tile(nviewid, part, width, height, tilePosX, tilePosY, tileWidth, 
tileHeight, -1, 0, -1, false);
 
     // No Cache
     std::unique_ptr<std::fstream> file = tc.lookupTile(tile);
@@ -226,13 +227,13 @@ void TileCacheTests::testSimpleCombine()
     // First.
     std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, 
documentURL, "simpleCombine-1 ");
 
-    sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 
tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
+    sendTextFrame(socket1, "tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
 
     std::vector<char> tile1a = getResponseMessage(socket1, "tile:", testname);
     CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", 
!tile1a.empty());
     std::vector<char> tile1b = getResponseMessage(socket1, "tile:", testname);
     CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", 
!tile1b.empty());
-    sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 
tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
+    sendTextFrame(socket1, "tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
 
     tile1a = getResponseMessage(socket1, "tile:", testname);
     CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", 
!tile1a.empty());
@@ -243,7 +244,7 @@ void TileCacheTests::testSimpleCombine()
     std::cerr << "Connecting second client." << std::endl;
     std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, 
documentURL, "simpleCombine-2 ", true);
 
-    sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 
tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
+    sendTextFrame(socket2, "tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
 
     std::vector<char> tile2a = getResponseMessage(socket2, "tile:", testname);
     CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", 
!tile2a.empty());
@@ -268,7 +269,7 @@ void TileCacheTests::testCancelTiles()
         std::shared_ptr<LOOLWebSocket> socket = 
loadDocAndGetSocket("setclientpart.ods", _uri, testName);
 
         // Request a huge tile, and cancel immediately.
-        sendTextFrame(socket, "tilecombine part=0 width=2560 height=2560 
tileposx=0 tileposy=0 tilewidth=38400 tileheight=38400");
+        sendTextFrame(socket, "tilecombine nviewid=0 part=0 width=2560 
height=2560 tileposx=0 tileposy=0 tilewidth=38400 tileheight=38400");
         sendTextFrame(socket, "canceltiles");
 
         const auto res = getResponseString(socket, "tile:", testName, 1000);
@@ -307,8 +308,8 @@ void TileCacheTests::testCancelTilesMultiView()
         std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, 
documentURL, "cancelTilesMultiView-1 ");
         std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, 
documentURL, "cancelTilesMultiView-2 ", true);
 
-        sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680,11520,0,3840,7680,11520 
tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840", 
"cancelTilesMultiView-1 ");
-        sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 tileheight=3840", 
"cancelTilesMultiView-2 ");
+        sendTextFrame(socket1, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 
tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840", 
"cancelTilesMultiView-1 ");
+        sendTextFrame(socket2, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 
tileheight=3840", "cancelTilesMultiView-2 ");
 
         sendTextFrame(socket1, "canceltiles");
         const auto res1 = getResponseString(socket1, "tile:", 
"cancelTilesMultiView-1 ", 500);
@@ -368,8 +369,8 @@ void TileCacheTests::testDisconnectMultiView()
         std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, 
documentURL, "disconnectMultiView-1 ");
         std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, 
documentURL, "disconnectMultiView-2 ", true);
 
-        sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680,11520,0,3840,7680,11520 
tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840", 
"cancelTilesMultiView-1 ");
-        sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 tileheight=3840", 
"cancelTilesMultiView-2 ");
+        sendTextFrame(socket1, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 
tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840", 
"cancelTilesMultiView-1 ");
+        sendTextFrame(socket2, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 
tileheight=3840", "cancelTilesMultiView-2 ");
 
         socket1->shutdown();
 
@@ -415,10 +416,10 @@ void TileCacheTests::testUnresponsiveClient()
         assertResponseString(socket2, "invalidatetiles:", "client2 ");
 
         // Ask for tiles and don't read!
-        sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680,11520,0,3840,7680,11520 
tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840");
+        sendTextFrame(socket1, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 
tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840");
 
         // Verify that we get all 8 tiles.
-        sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680,11520,0,3840,7680,11520 
tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840");
+        sendTextFrame(socket2, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 
tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840");
         for (int i = 0; i < 8; ++i)
         {
             std::vector<char> tile = getResponseMessage(socket2, "tile:", 
"client2 ");
@@ -436,7 +437,7 @@ void TileCacheTests::testImpressTiles()
         const std::string testName = "impressTiles ";
         std::shared_ptr<LOOLWebSocket> socket = 
loadDocAndGetSocket("setclientpart.odp", _uri, testName);
 
-        sendTextFrame(socket, "tile part=0 width=180 height=135 tileposx=0 
tileposy=0 tilewidth=15875 tileheight=11906 id=0", testName);
+        sendTextFrame(socket, "tile nviewid=0 part=0 width=180 height=135 
tileposx=0 tileposy=0 tilewidth=15875 tileheight=11906 id=0", testName);
         getTileMessage(*socket, testName);
     }
     catch (const Poco::Exception& exc)
@@ -501,7 +502,7 @@ void TileCacheTests::testTilesRenderedJustOnce()
         assertResponseString(socket, "invalidatetiles:", testname);
 
         // Get 3 tiles.
-        sendTextFrame(socket, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", testname);
+        sendTextFrame(socket, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", 
testname);
         assertResponseString(socket, "tile:", testname);
         assertResponseString(socket, "tile:", testname);
         assertResponseString(socket, "tile:", testname);
@@ -514,7 +515,7 @@ void TileCacheTests::testTilesRenderedJustOnce()
         CPPUNIT_ASSERT_EQUAL((i+1) * 3, renderCount2);
 
         // Get same 3 tiles.
-        sendTextFrame(socket, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", testname);
+        sendTextFrame(socket, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", 
testname);
         const auto tile1 = assertResponseString(socket, "tile:", testname);
         std::string renderId1;
         LOOLProtocol::getTokenStringFromMessage(tile1, "renderid", renderId1);
@@ -579,25 +580,25 @@ void 
TileCacheTests::testTilesRenderedJustOnceMultiClient()
         assertResponseString(socket, "invalidatetiles:", testname1);
 
         // Get 3 tiles.
-        sendTextFrame(socket, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", testname1);
+        sendTextFrame(socket, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", 
testname1);
         assertResponseString(socket, "tile:", testname1);
         assertResponseString(socket, "tile:", testname1);
         assertResponseString(socket, "tile:", testname1);
 
         assertResponseString(socket2, "invalidatetiles:", testname2);
-        sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", testname2);
+        sendTextFrame(socket2, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", 
testname2);
         assertResponseString(socket2, "tile:", testname2);
         assertResponseString(socket2, "tile:", testname2);
         assertResponseString(socket2, "tile:", testname2);
 
         assertResponseString(socket3, "invalidatetiles:", testname3);
-        sendTextFrame(socket3, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", testname3);
+        sendTextFrame(socket3, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", 
testname3);
         assertResponseString(socket3, "tile:", testname3);
         assertResponseString(socket3, "tile:", testname3);
         assertResponseString(socket3, "tile:", testname3);
 
         assertResponseString(socket4, "invalidatetiles:", testname4);
-        sendTextFrame(socket4, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", testname4);
+        sendTextFrame(socket4, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", 
testname4);
         assertResponseString(socket4, "tile:", testname4);
         assertResponseString(socket4, "tile:", testname4);
         assertResponseString(socket4, "tile:", testname4);
@@ -610,7 +611,7 @@ void TileCacheTests::testTilesRenderedJustOnceMultiClient()
         CPPUNIT_ASSERT_EQUAL((i+1) * 3, renderCount2);
 
         // Get same 3 tiles.
-        sendTextFrame(socket, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", testname1);
+        sendTextFrame(socket, "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840", 
testname1);
         const auto tile1 = assertResponseString(socket, "tile:", testname1);
         std::string renderId1;
         LOOLProtocol::getTokenStringFromMessage(tile1, "renderid", renderId1);
@@ -650,8 +651,8 @@ void TileCacheTests::testSimultaneousTilesRenderedJustOnce()
     assertResponseString(socket1, "statechanged:", "client1 ");
     assertResponseString(socket2, "statechanged:", "client2 ");
 
-    sendTextFrame(socket1, "tile part=42 width=400 height=400 tileposx=1000 
tileposy=2000 tilewidth=3000 tileheight=3000");
-    sendTextFrame(socket2, "tile part=42 width=400 height=400 tileposx=1000 
tileposy=2000 tilewidth=3000 tileheight=3000");
+    sendTextFrame(socket1, "tile nviewid=0 part=42 width=400 height=400 
tileposx=1000 tileposy=2000 tilewidth=3000 tileheight=3000");
+    sendTextFrame(socket2, "tile nviewid=0 part=42 width=400 height=400 
tileposx=1000 tileposy=2000 tilewidth=3000 tileheight=3000");
 
     const auto response1 = assertResponseString(socket1, "tile:", "client1 ");
     const auto response2 = assertResponseString(socket2, "tile:", "client2 ");
@@ -738,7 +739,7 @@ void 
TileCacheTests::checkBlackTiles(std::shared_ptr<LOOLWebSocket>& socket, con
     // render correctly and there are no black tiles.
     // Current cap of table size ends at 257280 twips (for load12.ods),
     // otherwise 2035200 should be rendered successfully.
-    const char* req = "tile part=0 width=256 height=256 tileposx=0 
tileposy=253440 tilewidth=3840 tileheight=3840";
+    const char* req = "tile nviewid=0 part=0 width=256 height=256 tileposx=0 
tileposy=253440 tilewidth=3840 tileheight=3840";
     sendTextFrame(socket, req);
 
     const std::vector<char> tile = getResponseMessage(socket, "tile:", name);
@@ -1122,21 +1123,22 @@ void 
TileCacheTests::requestTiles(std::shared_ptr<LOOLWebSocket>& socket, const
             tileHeight = tileSize;
             tileX = tileSize * itCol;
             tileY = tileSize * itRow;
-            text = Poco::format("tile part=%d width=%d height=%d tileposx=%d 
tileposy=%d tilewidth=%d tileheight=%d",
+            text = Poco::format("tile nviewid=0 part=%d width=%d height=%d 
tileposx=%d tileposy=%d tilewidth=%d tileheight=%d",
                                 part, pixTileSize, pixTileSize, tileX, tileY, 
tileWidth, tileHeight);
 
             sendTextFrame(socket, text, name);
             tile = assertResponseString(socket, "tile:", name);
-            // expected tile: part= width= height= tileposx= tileposy= 
tilewidth= tileheight=
+            // expected tile: nviewid= part= width= height= tileposx= 
tileposy= tilewidth= tileheight=
             Poco::StringTokenizer tokens(tile, " ", 
Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
             CPPUNIT_ASSERT_EQUAL(std::string("tile:"), tokens[0]);
-            CPPUNIT_ASSERT_EQUAL(part, 
std::stoi(tokens[1].substr(std::string("part=").size())));
-            CPPUNIT_ASSERT_EQUAL(pixTileSize, 
std::stoi(tokens[2].substr(std::string("width=").size())));
-            CPPUNIT_ASSERT_EQUAL(pixTileSize, 
std::stoi(tokens[3].substr(std::string("height=").size())));
-            CPPUNIT_ASSERT_EQUAL(tileX, 
std::stoi(tokens[4].substr(std::string("tileposx=").size())));
-            CPPUNIT_ASSERT_EQUAL(tileY, 
std::stoi(tokens[5].substr(std::string("tileposy=").size())));
-            CPPUNIT_ASSERT_EQUAL(tileWidth, 
std::stoi(tokens[6].substr(std::string("tileWidth=").size())));
-            CPPUNIT_ASSERT_EQUAL(tileHeight, 
std::stoi(tokens[7].substr(std::string("tileHeight=").size())));
+            CPPUNIT_ASSERT_EQUAL(part, 
std::stoi(tokens[1].substr(std::string("nviewid=").size())));
+            CPPUNIT_ASSERT_EQUAL(part, 
std::stoi(tokens[2].substr(std::string("part=").size())));
+            CPPUNIT_ASSERT_EQUAL(pixTileSize, 
std::stoi(tokens[3].substr(std::string("width=").size())));
+            CPPUNIT_ASSERT_EQUAL(pixTileSize, 
std::stoi(tokens[4].substr(std::string("height=").size())));
+            CPPUNIT_ASSERT_EQUAL(tileX, 
std::stoi(tokens[5].substr(std::string("tileposx=").size())));
+            CPPUNIT_ASSERT_EQUAL(tileY, 
std::stoi(tokens[6].substr(std::string("tileposy=").size())));
+            CPPUNIT_ASSERT_EQUAL(tileWidth, 
std::stoi(tokens[7].substr(std::string("tileWidth=").size())));
+            CPPUNIT_ASSERT_EQUAL(tileHeight, 
std::stoi(tokens[8].substr(std::string("tileHeight=").size())));
         }
     }
 }
@@ -1191,7 +1193,7 @@ void TileCacheTests::testTileRequestByZoom()
     sendTextFrame(socket, "clientzoom tilepixelwidth=256 tilepixelheight=256 
tiletwipwidth=3200 tiletwipheight=3200");
 
     // Request all tile of the visible area (it happens by zoom)
-    sendTextFrame(socket, "tilecombine part=0 width=256 height=256 
tileposx=0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800
 
tileposy=0,0,0,0,0,3200,3200,3200,3200,3200,6400,6400,6400,6400,6400,9600,9600,9600,9600,9600
 tilewidth=3200 tileheight=3200");
+    sendTextFrame(socket, "tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800
 
tileposy=0,0,0,0,0,3200,3200,3200,3200,3200,6400,6400,6400,6400,6400,9600,9600,9600,9600,9600
 tilewidth=3200 tileheight=3200");
 
     // Check that we get all the tiles without we send back the tileprocessed 
message
     for (int i = 0; i < 20; ++i)
@@ -1263,7 +1265,7 @@ void TileCacheTests::testTileProcessed()
     sendTextFrame(socket, "clientzoom tilepixelwidth=256 tilepixelheight=256 
tiletwipwidth=3200 tiletwipheight=3200");
 
     // Request a lots of tiles (more than wsd can send once)
-    sendTextFrame(socket, "tilecombine part=0 width=256 height=256 
tileposx=0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800
 
tileposy=0,0,0,0,0,3200,3200,3200,3200,3200,6400,6400,6400,6400,6400,9600,9600,9600,9600,9600,12800,12800,12800,12800,12800
 tilewidth=3200 tileheight=3200");
+    sendTextFrame(socket, "tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800,0,3200,6400,9600,12800
 
tileposy=0,0,0,0,0,3200,3200,3200,3200,3200,6400,6400,6400,6400,6400,9600,9600,9600,9600,9600,12800,12800,12800,12800,12800
 tilewidth=3200 tileheight=3200");
 
     std::vector<std::string> tileIDs;
     int arrivedTile = 0;
@@ -1278,11 +1280,12 @@ void TileCacheTests::testTileProcessed()
 
             // Store tileID, so we can send it back
             Poco::StringTokenizer tokens(tile, " ", 
Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
-            std::string tileID = tokens[1].substr(std::string("part=").size()) 
+ ":" +
-                                 
tokens[4].substr(std::string("tileposx=").size()) + ":" +
-                                 
tokens[5].substr(std::string("tileposy=").size()) + ":" +
-                                 
tokens[6].substr(std::string("tileWidth=").size()) + ":" +
-                                 
tokens[7].substr(std::string("tileHeight=").size());
+            std::string tileID = tokens[2].substr(std::string("part=").size()) 
+ ":" +
+                                 
tokens[5].substr(std::string("tileposx=").size()) + ":" +
+                                 
tokens[6].substr(std::string("tileposy=").size()) + ":" +
+                                 
tokens[7].substr(std::string("tileWidth=").size()) + ":" +
+                                 
tokens[8].substr(std::string("tileHeight=").size()) + ":" +
+                                 
tokens[1].substr(std::string("nviewid=").size());
             tileIDs.push_back(tileID);
         }
 
@@ -1399,7 +1402,7 @@ void TileCacheTests::testTileBeingRenderedHandling()
 
         CPPUNIT_ASSERT_EQUAL(1, arrivedTiles);
 
-        sendTextFrame(socket, "tileprocessed tile=0:0:0:3200:3200");
+        sendTextFrame(socket, "tileprocessed tile=0:0:0:3200:3200:0");
     }
 }
 
@@ -1458,7 +1461,7 @@ void TileCacheTests::testWireIDFilteringOnWSDSide()
 
     //2. Now request the same tiles by the other client (e.g. scroll to the 
same view)
 
-    sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840");
+    sendTextFrame(socket2, "tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840");
 
     // We expect three tiles sent to the second client
     arrivedTiles = 0;
@@ -1521,7 +1524,7 @@ void TileCacheTests::testLimitTileVersionsOnFly()
 
     // When the next tileprocessed message arrive with correct tileID
     // wsd sends the delayed tile
-    sendTextFrame(socket, "tileprocessed tile=0:0:0:3200:3200");
+    sendTextFrame(socket, "tileprocessed tile=0:0:0:3200:3200:0");
 
     int arrivedTiles = 0;
     bool gotTile = false;
diff --git a/test/TileQueueTests.cpp b/test/TileQueueTests.cpp
index 6ca1bf22f..9173e764c 100644
--- a/test/TileQueueTests.cpp
+++ b/test/TileQueueTests.cpp
@@ -70,11 +70,11 @@ class TileQueueTests : public CPPUNIT_NS::TestFixture
 
 void TileQueueTests::testTileQueuePriority()
 {
-    const std::string reqHigh = "tile part=0 width=256 height=256 tileposx=0 
tileposy=0 tilewidth=3840 tileheight=3840 oldwid=0 wid=0";
-    const std::string resHigh = "tile part=0 width=256 height=256 tileposx=0 
tileposy=0 tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1";
+    const std::string reqHigh = "tile nviewid=0 part=0 width=256 height=256 
tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840 oldwid=0 wid=0";
+    const std::string resHigh = "tile nviewid=0 part=0 width=256 height=256 
tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1";
     const TileQueue::Payload payloadHigh(resHigh.data(), resHigh.data() + 
resHigh.size());
-    const std::string reqLow = "tile part=0 width=256 height=256 tileposx=0 
tileposy=253440 tilewidth=3840 tileheight=3840 oldwid=0 wid=0";
-    const std::string resLow = "tile part=0 width=256 height=256 tileposx=0 
tileposy=253440 tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1";
+    const std::string reqLow = "tile nviewid=0 part=0 width=256 height=256 
tileposx=0 tileposy=253440 tilewidth=3840 tileheight=3840 oldwid=0 wid=0";
+    const std::string resLow = "tile nviewid=0 part=0 width=256 height=256 
tileposx=0 tileposy=253440 tilewidth=3840 tileheight=3840 oldwid=0 wid=0 
ver=-1";
     const TileQueue::Payload payloadLow(resLow.data(), resLow.data() + 
resLow.size());
 
     TileQueue queue;
@@ -116,15 +116,15 @@ void TileQueueTests::testTileQueuePriority()
 
 void TileQueueTests::testTileCombinedRendering()
 {
-    const std::string req1 = "tile part=0 width=256 height=256 tileposx=0 
tileposy=0 tilewidth=3840 tileheight=3840";
-    const std::string req2 = "tile part=0 width=256 height=256 tileposx=3840 
tileposy=0 tilewidth=3840 tileheight=3840";
-    const std::string req3 = "tile part=0 width=256 height=256 tileposx=0 
tileposy=3840 tilewidth=3840 tileheight=3840";
+    const std::string req1 = "tile nviewid=0 part=0 width=256 height=256 
tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840";
+    const std::string req2 = "tile nviewid=0 part=0 width=256 height=256 
tileposx=3840 tileposy=0 tilewidth=3840 tileheight=3840";
+    const std::string req3 = "tile nviewid=0 part=0 width=256 height=256 
tileposx=0 tileposy=3840 tilewidth=3840 tileheight=3840";
 
-    const std::string resHor = "tilecombine part=0 width=256 height=256 
tileposx=0,3840 tileposy=0,0 imgsize=0,0 tilewidth=3840 tileheight=3840 
ver=-1,-1 oldwid=0,0 wid=0,0";
+    const std::string resHor = "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840 tileposy=0,0 imgsize=0,0 tilewidth=3840 
tileheight=3840 ver=-1,-1 oldwid=0,0 wid=0,0";
     const TileQueue::Payload payloadHor(resHor.data(), resHor.data() + 
resHor.size());
-    const std::string resVer = "tilecombine part=0 width=256 height=256 
tileposx=0,0 tileposy=0,3840 imgsize=0,0 tilewidth=3840 tileheight=3840 
ver=-1,-1 oldwid=0,0 wid=0,0";
+    const std::string resVer = "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,0 tileposy=0,3840 imgsize=0,0 tilewidth=3840 
tileheight=3840 ver=-1,-1 oldwid=0,0 wid=0,0";
     const TileQueue::Payload payloadVer(resVer.data(), resVer.data() + 
resVer.size());
-    const std::string resFull = "tilecombine part=0 width=256 height=256 
tileposx=0,3840,0 tileposy=0,0,3840 imgsize=0,0,0 tilewidth=3840 
tileheight=3840 ver=-1,-1,-1 oldwid=0,0,0 wid=0,0,0";
+    const std::string resFull = "tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=0,3840,0 tileposy=0,0,3840 imgsize=0,0,0 tilewidth=3840 
tileheight=3840 ver=-1,-1,-1 oldwid=0,0,0 wid=0,0,0";
     const TileQueue::Payload payloadFull(resFull.data(), resFull.data() + 
resFull.size());
 
     TileQueue queue;
@@ -159,8 +159,8 @@ void TileQueueTests::testTileRecombining()
 {
     TileQueue queue;
 
-    queue.put("tilecombine part=0 width=256 height=256 tileposx=0,3840,7680 
tileposy=0,0,0 tilewidth=3840 tileheight=3840");
-    queue.put("tilecombine part=0 width=256 height=256 tileposx=0,3840 
tileposy=0,0 tilewidth=3840 tileheight=3840");
+    queue.put("tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840");
+    queue.put("tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
 
     // the tilecombine's get merged, resulting in 3 "tile" messages
     CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(queue.getQueue().size()));
@@ -168,7 +168,7 @@ void TileQueueTests::testTileRecombining()
     // but when we later extract that, it is just one "tilecombine" message
     std::string message(payloadAsString(queue.get()));
 
-    CPPUNIT_ASSERT_EQUAL(std::string("tilecombine part=0 width=256 height=256 
tileposx=7680,0,3840 tileposy=0,0,0 imgsize=0,0,0 tilewidth=3840 
tileheight=3840 ver=-1,-1,-1 oldwid=0,0,0 wid=0,0,0"), message);
+    CPPUNIT_ASSERT_EQUAL(std::string("tilecombine nviewid=0 part=0 width=256 
height=256 tileposx=7680,0,3840 tileposy=0,0,0 imgsize=0,0,0 tilewidth=3840 
tileheight=3840 ver=-1,-1,-1 oldwid=0,0,0 wid=0,0,0"), message);
 
     // and nothing remains in the queue
     CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(queue.getQueue().size()));
@@ -188,10 +188,10 @@ void TileQueueTests::testViewOrder()
 
     const std::vector<std::string> tiles =
     {
-        "tile part=0 width=256 height=256 tileposx=0 tileposy=0 tilewidth=3840 
tileheight=3840 oldwid=0 wid=0 ver=-1",
-        "tile part=0 width=256 height=256 tileposx=0 tileposy=7680 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1",
-        "tile part=0 width=256 height=256 tileposx=0 tileposy=15360 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1",
-        "tile part=0 width=256 height=256 tileposx=0 tileposy=23040 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1"
+        "tile nviewid=0 part=0 width=256 height=256 tileposx=0 tileposy=0 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1",
+        "tile nviewid=0 part=0 width=256 height=256 tileposx=0 tileposy=7680 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1",
+        "tile nviewid=0 part=0 width=256 height=256 tileposx=0 tileposy=15360 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1",
+        "tile nviewid=0 part=0 width=256 height=256 tileposx=0 tileposy=23040 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1"
     };
 
     for (auto &tile : tiles)
@@ -214,10 +214,10 @@ void TileQueueTests::testPreviewsDeprioritization()
     // simple case - put previews to the queue and get everything back again
     const std::vector<std::string> previews =
     {
-        "tile part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1 id=0",
-        "tile part=1 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1 id=1",
-        "tile part=2 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1 id=2",
-        "tile part=3 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1 id=3"
+        "tile nviewid=0 part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1 id=0",
+        "tile nviewid=0 part=1 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1 id=1",
+        "tile nviewid=0 part=2 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1 id=2",
+        "tile nviewid=0 part=3 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1 id=3"
     };
 
     for (auto &preview : previews)
@@ -236,8 +236,8 @@ void TileQueueTests::testPreviewsDeprioritization()
     // the previews
     const std::vector<std::string> tiles =
     {
-        "tile part=0 width=256 height=256 tileposx=0 tileposy=0 tilewidth=3840 
tileheight=3840 oldwid=0 wid=0 ver=-1",
-        "tile part=0 width=256 height=256 tileposx=0 tileposy=7680 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1"
+        "tile nviewid=0 part=0 width=256 height=256 tileposx=0 tileposy=0 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1",
+        "tile nviewid=0 part=0 width=256 height=256 tileposx=0 tileposy=7680 
tilewidth=3840 tileheight=3840 oldwid=0 wid=0 ver=-1"
     };
 
     for (auto &preview : previews)
@@ -323,9 +323,9 @@ void TileQueueTests::testSenderQueueTileDeduplication()
 
     const std::vector<std::string> part_messages =
     {
-        "tile: part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=0",
-        "tile: part=1 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=1",
-        "tile: part=2 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1"
+        "tile: nviewid=0 part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=0",
+        "tile: nviewid=0 part=1 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=1",
+        "tile: nviewid=0 part=2 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1"
     };
 
     for (const auto& msg : part_messages)
@@ -342,9 +342,9 @@ void TileQueueTests::testSenderQueueTileDeduplication()
 
     const std::vector<std::string> dup_messages =
     {
-        "tile: part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1",
-        "tile: part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=1",
-        "tile: part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=1"
+        "tile: nviewid=0 part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=-1",
+        "tile: nviewid=0 part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=1",
+        "tile: nviewid=0 part=0 width=180 height=135 tileposx=0 tileposy=0 
tilewidth=15875 tileheight=11906 ver=1"
     };
 
     for (const auto& msg : dup_messages)
diff --git a/test/WhiteBoxTests.cpp b/test/WhiteBoxTests.cpp
index 51297c17b..dd210dd7a 100644
--- a/test/WhiteBoxTests.cpp
+++ b/test/WhiteBoxTests.cpp
@@ -353,17 +353,18 @@ void WhiteBoxTests::testTokenizer()
     CPPUNIT_ASSERT_EQUAL(std::string("A"), tokens[0]);
     CPPUNIT_ASSERT_EQUAL(std::string("Z"), tokens[1]);
 
-    tokens = LOOLProtocol::tokenize("tile part=0 width=256 height=256 
tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840 ver=-1");
-    CPPUNIT_ASSERT_EQUAL(9UL, tokens.size());
+    tokens = LOOLProtocol::tokenize("tile nviewid=0 part=0 width=256 
height=256 tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840 ver=-1");
+    CPPUNIT_ASSERT_EQUAL(10UL, tokens.size());
     CPPUNIT_ASSERT_EQUAL(std::string("tile"), tokens[0]);
-    CPPUNIT_ASSERT_EQUAL(std::string("part=0"), tokens[1]);
-    CPPUNIT_ASSERT_EQUAL(std::string("width=256"), tokens[2]);
-    CPPUNIT_ASSERT_EQUAL(std::string("height=256"), tokens[3]);
-    CPPUNIT_ASSERT_EQUAL(std::string("tileposx=0"), tokens[4]);
-    CPPUNIT_ASSERT_EQUAL(std::string("tileposy=0"), tokens[5]);
-    CPPUNIT_ASSERT_EQUAL(std::string("tilewidth=3840"), tokens[6]);
-    CPPUNIT_ASSERT_EQUAL(std::string("tileheight=3840"), tokens[7]);
-    CPPUNIT_ASSERT_EQUAL(std::string("ver=-1"), tokens[8]);
+    CPPUNIT_ASSERT_EQUAL(std::string("nviewid=0"), tokens[1]);
+    CPPUNIT_ASSERT_EQUAL(std::string("part=0"), tokens[2]);
+    CPPUNIT_ASSERT_EQUAL(std::string("width=256"), tokens[3]);
+    CPPUNIT_ASSERT_EQUAL(std::string("height=256"), tokens[4]);
+    CPPUNIT_ASSERT_EQUAL(std::string("tileposx=0"), tokens[5]);
+    CPPUNIT_ASSERT_EQUAL(std::string("tileposy=0"), tokens[6]);
+    CPPUNIT_ASSERT_EQUAL(std::string("tilewidth=3840"), tokens[7]);
+    CPPUNIT_ASSERT_EQUAL(std::string("tileheight=3840"), tokens[8]);
+    CPPUNIT_ASSERT_EQUAL(std::string("ver=-1"), tokens[9]);
 
     // With custom delimeters
     tokens = LOOLProtocol::tokenize(std::string("ABC:DEF"), ':');
diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index cc8065c20..90b71d704 100644
--- a/test/httpwstest.cpp
+++ b/test/httpwstest.cpp
@@ -1791,7 +1791,7 @@ void HTTPWSTest::testCalcEditRendering()
 
     assertResponseString(socket, "cellformula: abc", testname);
 
-    const char* req = "tilecombine part=0 width=512 height=512 tileposx=3840 
tileposy=0 tilewidth=7680 tileheight=7680";
+    const char* req = "tilecombine nviewid=0 part=0 width=512 height=512 
tileposx=3840 tileposy=0 tilewidth=7680 tileheight=7680";
     sendTextFrame(socket, req, testname);
 
     const std::vector<char> tile = getResponseMessage(socket, "tile:", 
testname);
@@ -1875,7 +1875,7 @@ void HTTPWSTest::testCalcRenderAfterNewView51()
     // Wait for status due to doc resize.
     assertResponseString(socket, "status:", testname);
 
-    const char* req = "tilecombine part=0 width=256 height=256 tileposx=0 
tileposy=253440 tilewidth=3840 tileheight=3840";
+    const char* req = "tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0 tileposy=253440 tilewidth=3840 tileheight=3840";
 
     // Get tile.
     const std::vector<char> tile1 = getTileAndSave(socket, req, 
"/tmp/calc_render_51_orig.png", testname);
@@ -1921,7 +1921,7 @@ void HTTPWSTest::testCalcRenderAfterNewView53()
     sendTextFrame(socket, "key type=input char=0 key=1031", testname);
 
     // Get tile.
-    const char* req = "tilecombine part=0 width=256 height=256 tileposx=0 
tileposy=291840 tilewidth=3840 tileheight=3840 oldwid=0";
+    const char* req = "tilecombine nviewid=0 part=0 width=256 height=256 
tileposx=0 tileposy=291840 tilewidth=3840 tileheight=3840 oldwid=0";
     const std::vector<char> tile1 = getTileAndSave(socket, req, 
"/tmp/calc_render_53_orig.png", testname);
 
 
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 19cfb391c..c5182616d 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -1322,6 +1322,7 @@ void ClientSession::handleTileInvalidation(const 
std::string& message,
     if( part == -1 ) // If no part is specifed we use the part used by the 
client
         part = _clientSelectedPart;
 
+    int normalizedViewId=0;
 
     std::vector<TileDesc> invalidTiles;
     if(part == _clientSelectedPart || _isTextDocument)
@@ -1337,7 +1338,7 @@ void ClientSession::handleTileInvalidation(const 
std::string& message,
                 Util::Rectangle tileRect (j * _tileWidthTwips, i * 
_tileHeightTwips, _tileWidthTwips, _tileHeightTwips);
                 if(invalidateRect.intersects(tileRect))
                 {
-                    invalidTiles.emplace_back(part, _tileWidthPixel, 
_tileHeightPixel, j * _tileWidthTwips, i * _tileHeightTwips, _tileWidthTwips, 
_tileHeightTwips, -1, 0, -1, false);
+                    invalidTiles.emplace_back(normalizedViewId, part, 
_tileWidthPixel, _tileHeightPixel, j * _tileWidthTwips, i * _tileHeightTwips, 
_tileWidthTwips, _tileHeightTwips, -1, 0, -1, false);
 
                     TileWireId oldWireId = 0;
                     auto iter = 
_oldWireIds.find(generateTileID(invalidTiles.back()));
diff --git a/wsd/TileDesc.hpp b/wsd/TileDesc.hpp
index 17508e5f7..da6995f00 100644
--- a/wsd/TileDesc.hpp
+++ b/wsd/TileDesc.hpp
@@ -29,7 +29,8 @@ typedef uint64_t TileBinaryHash;
 class TileDesc
 {
 public:
-    TileDesc(int part, int width, int height, int tilePosX, int tilePosY, int 
tileWidth, int tileHeight, int ver, int imgSize, int id, bool broadcast) :
+    TileDesc(int normalizedViewId, int part, int width, int height, int 
tilePosX, int tilePosY, int tileWidth, int tileHeight, int ver, int imgSize, 
int id, bool broadcast) :
+        _normalizedViewId(normalizedViewId),
         _part(part),
         _width(width),
         _height(height),
@@ -44,7 +45,8 @@ public:
         _oldWireId(0),
         _wireId(0)
     {
-        if (_part < 0 ||
+        if (_normalizedViewId < 0 ||
+            _part < 0 ||
             _width <= 0 ||
             _height <= 0 ||
             _tilePosX < 0 ||
@@ -56,7 +58,8 @@ public:
             throw BadArgumentException("Invalid tile descriptor.");
         }
     }
-
+    int getNormalizedViewId() const { return _normalizedViewId; }
+    void setNormalizedViewId(const int normalizedViewId) { _normalizedViewId = 
normalizedViewId; }
     int getPart() const { return _part; }
     int getWidth() const { return _width; }
     int getHeight() const { return _height; }
@@ -127,7 +130,8 @@ public:
             other.getWidth() != getWidth() ||
             other.getHeight() != getHeight() ||
             other.getTileWidth() != getTileWidth() ||
-            other.getTileHeight() != getTileHeight())
+            other.getTileHeight() != getTileHeight() ||
+            other.getNormalizedViewId() != getNormalizedViewId())
         {
             return false;
         }
@@ -156,6 +160,7 @@ public:
     {
         std::ostringstream oss;
         oss << prefix
+            << " nviewid=" << _normalizedViewId
             << " part=" << _part
             << " width=" << _width
             << " height=" << _height
@@ -222,7 +227,7 @@ public:
         const bool broadcast = (LOOLProtocol::getTokenString(tokens, 
"broadcast", s) &&
                                 s == "yes");
 
-        TileDesc result(pairs["part"], pairs["width"], pairs["height"],
+        TileDesc result(pairs["nviewid"], pairs["part"], pairs["width"], 
pairs["height"],
                         pairs["tileposx"], pairs["tileposy"],
                         pairs["tilewidth"], pairs["tileheight"],
                         pairs["ver"],
@@ -240,6 +245,7 @@ public:
     }
 
 private:
+    int _normalizedViewId;
     int _part;
     int _width;
     int _height;
@@ -261,12 +267,13 @@ private:
 class TileCombined
 {
 private:
-    TileCombined(int part, int width, int height,
+    TileCombined(int normalizedViewId, int part, int width, int height,
                  const std::string& tilePositionsX, const std::string& 
tilePositionsY,
                  int tileWidth, int tileHeight, const std::string& vers,
                  const std::string& imgSizes, int id,
                  const std::string& oldWireIds,
                  const std::string& wireIds) :
+        _normalizedViewId(normalizedViewId),
         _part(part),
         _width(width),
         _height(height),
@@ -274,7 +281,8 @@ private:
         _tileHeight(tileHeight),
         _id(id)
     {
-        if (_part < 0 ||
+        if (_normalizedViewId < 0 ||
+            _part < 0 ||
             _width <= 0 ||
             _height <= 0 ||
             _tileWidth <= 0 ||
@@ -340,19 +348,29 @@ private:
                 throw BadArgumentException("Invalid tilecombine descriptor.");
             }
 
-            _tiles.emplace_back(_part, _width, _height, x, y, _tileWidth, 
_tileHeight, ver, imgSize, id, false);
+            _tiles.emplace_back(_normalizedViewId, _part, _width, _height, x, 
y, _tileWidth, _tileHeight, ver, imgSize, id, false);
             _tiles.back().setOldWireId(oldWireId);
             _tiles.back().setWireId(wireId);
         }
     }
 
 public:
+    int getNormalizedViewId() const { return _normalizedViewId; }
     int getPart() const { return _part; }
     int getWidth() const { return _width; }
     int getHeight() const { return _height; }
     int getTileWidth() const { return _tileWidth; }
     int getTileHeight() const { return _tileHeight; }
 
+    void setNormalizedViewId(int nViewId)
+    {
+        for (auto& tile : getTiles())
+            tile.setNormalizedViewId(nViewId);
+
+        _normalizedViewId = nViewId;
+    }
+
+
     const std::vector<TileDesc>& getTiles() const { return _tiles; }
     std::vector<TileDesc>& getTiles() { return _tiles; }
 
@@ -362,6 +380,7 @@ public:
     {
         std::ostringstream oss;
         oss << prefix
+            << " nviewid=" << _normalizedViewId
             << " part=" << _part
             << " width=" << _width
             << " height=" << _height
@@ -478,7 +497,7 @@ public:
             }
         }
 
-        return TileCombined(pairs["part"], pairs["width"], pairs["height"],
+        return TileCombined(pairs["nviewid"], pairs["part"], pairs["width"], 
pairs["height"],
                             tilePositionsX, tilePositionsY,
                             pairs["tilewidth"], pairs["tileheight"],
                             versions,
@@ -511,13 +530,14 @@ public:
         }
 
         vers.seekp(-1, std::ios_base::cur); // Remove last comma.
-        return TileCombined(tiles[0].getPart(), tiles[0].getWidth(), 
tiles[0].getHeight(),
+        return TileCombined(tiles[0].getNormalizedViewId(), 
tiles[0].getPart(), tiles[0].getWidth(), tiles[0].getHeight(),
                             xs.str(), ys.str(), tiles[0].getTileWidth(), 
tiles[0].getTileHeight(),
                             vers.str(), "", -1, oldhs.str(), hs.str());
     }
 
 private:
     std::vector<TileDesc> _tiles;
+    int _normalizedViewId;
     int _part;
     int _width;
     int _height;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to