loolwsd: invalidate all parts when document size changes

This is a stop-gap until Core sends these invalidations
with more precision. Otherwise, we may be wasting valuable
cache data here.

This fixes showing incorrect tiles when slides are
inserted/removed from a doc.

Change-Id: I7a02c6fb96ff27223afe71d891db639ab5b2cfae
Reviewed-on: https://gerrit.libreoffice.org/31616
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-12-04 23:45:26 -05:00 committed by Ashod Nakashian
parent 1a46557922
commit c7e5874eff

View file

@ -1115,8 +1115,26 @@ void ChildSession::loKitCallback(const int nType, const std::string& rPayload)
sendTextFrame("searchresultselection: " + rPayload);
break;
case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
getStatus("", 0);
getPartPageRectangles("", 0);
{
//TODO: clenaup and merge.
std::unique_lock<std::mutex> lock(_docManager.getDocumentMutex());
const int parts = getLOKitDocument()->getParts();
for (int i = 0; i < parts; ++i)
{
sendTextFrame("invalidatetiles:"
" part=" + std::to_string(i) +
" x=0" +
" y=0" +
" width=" + std::to_string(INT_MAX) +
" height=" + std::to_string(INT_MAX));
}
lock.unlock();
getStatus("", 0);
getPartPageRectangles("", 0);
}
break;
case LOK_CALLBACK_SET_PART:
sendTextFrame("setpart: " + rPayload);