Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Bump LOK and fix handling full document invalidation events
Browse files Browse the repository at this point in the history
  • Loading branch information
chase committed Jul 3, 2023
1 parent 511b1ac commit 90dff48
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/electron/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vars = {
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',

'pyyaml_version': '3.12',
'libreofficekit_version': 'v0.4.11',
'libreofficekit_version': 'v0.5.2',

'chromium_git': 'https://chromium.googlesource.com',
'electron_git': 'https://github.com/electron',
Expand Down
2 changes: 1 addition & 1 deletion src/electron/ELECTRON_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.3.0-beta1
20.3.0-beta2
11 changes: 9 additions & 2 deletions src/electron/office/office_web_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,15 @@ void OfficeWebPlugin::HandleInvalidateTiles(std::string payload) {

// TODO: handle non-text document types for parts
if (payload_sv == "EMPTY") {
ScheduleAvailableAreaPaint();
} else {
base::TimeTicks now = base::TimeTicks::Now();
if (last_full_invalidation_time_.is_null() || (now - last_full_invalidation_time_) > base::Milliseconds(10)) {
ScheduleAvailableAreaPaint();
last_full_invalidation_time_ = now;
}
// weirdly, LOK seems to be issuing a full tile invalidation FOR EVERY PAGE, then the whole document
// skip those page invalidations which are of the form "EMPTY, #, #"
// rendering was getting N+1 full document re-renders where N=number of pages, that's bad
} else if (payload_sv.substr(0, 5) != "EMPTY") {
std::string_view::const_iterator start = payload_sv.begin();
gfx::Rect dirty_rect =
office::lok_callback::ParseRect(start, payload_sv.end());
Expand Down
2 changes: 2 additions & 0 deletions src/electron/office/office_web_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "cc/paint/paint_image.h"
#include "gin/handle.h"
#include "include/core/SkImage.h"
Expand Down Expand Up @@ -268,6 +269,7 @@ class OfficeWebPlugin : public blink::WebPlugin,

scoped_refptr<base::SequencedTaskRunner> task_runner_;
office::CancelFlagPtr paint_cancel_flag_;
base::TimeTicks last_full_invalidation_time_ = base::TimeTicks();

v8::Global<v8::ObjectTemplate> v8_template_;
v8::Global<v8::Object> v8_object_;
Expand Down

0 comments on commit 90dff48

Please sign in to comment.