Commit Graph

1067 Commits (master)

Author SHA1 Message Date
Michael Meeks ca2c174a7d Notify crash-dumping of an inconsistent jail.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ib3c81ad15a1386664c63818ec658f703d5359eae
2024-02-29 15:26:34 +00:00
Caolán McNamara ed5924c494 set the initial rendering state before the first invalidateCanonicalId
now that we will typically init the document theme, etc. from the
users last used settings, the current rendering state is likely the one
that the user wants to use.

The browser-side throws away all tiles, etc on getting a
canonidalidchange, so get the current document renderering state to
describe this initial state so later LOK_CALLBACK_VIEW_RENDER_STATE
events can be compared to this initial state and only emit
canonidalidchange if there is a need.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2902ff4e143f432755c335e1225149207fafdfc3
2024-02-26 10:02:32 +00:00
Aron Budea 3b8f3d07f6 Replace Util::startsWith/endsWith w/ C++20 equivalent
Replace a few cases of Util::toString(...), too.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I53c5dbbdf2f60710e94add9dd137aa9becb7bd3e
2024-02-22 08:08:32 +01:00
Michael Meeks c090b4fd21 notasync warning improvement.
Kit's GlobalCallback has an alarming habit of enabling
inputprocessing during a jsdialog popup occuring during
load, so use a stronger heuristic to avoid sending errors.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4a57685dcf63b4a3607c894e80a13e27bffaece5
2024-02-21 12:57:11 +00:00
Caolán McNamara 7154ac5d07 init document theme during load
like we do for the spelling setting, so we have the document in the
desired state early before any rendering, dropping the early full
document invalidations during initial setup

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6b762c95fd4c00c7da04cf89f7bbeef4bc57375d
2024-02-21 10:23:15 +00:00
Michael Meeks 7031c3b0ce cool#8328 - config header fixup.
config.h should be included as the 1st line in each source file.
It should not be included in headers.

config_version.h which changes on every commit should not be
included widely - so remove it from the HttpRequest heeader to
save tinderbox's ccache.

Fetch version info from helper methods rather than in-lining via
defines, to better encapsulate.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If449a36f1ac61940f04d70d5f4180db389d9b4c4
2024-02-21 09:35:25 +00:00
Michael Meeks e7e909bf3d Don't complain about non-async dialogs on load & save.
Change-Id: I2e846ea99e8d062088c80be166c4fc73bb3f004d
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-02-16 20:31:53 +00:00
Hubert Figuière cbf452b03d calc: Receive the sheet protected status
This set the CSS class 'spreadsheet-tab-protected' on the sheet tab.

Requires LOKit change https://gerrit.libreoffice.org/c/core/+/163325

Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: If199b36ba593c5e603d017346969360b6191fe5b
2024-02-14 14:05:56 +00:00
Caolán McNamara 64a4dab516 we never have an empty std::unique_ptr for .second
and don't check for it in the other cases, so drop it in these ones

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie343178869cadc127ee898968fef8f798b6068d5
2024-02-08 08:51:46 +01:00
Michael Meeks 7387d9cc04 Reduce noise of somewhat excessive trace debug.
Given the surrounding debug we should be able infer the same
state from its absence.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Id20de40f67ed52dc5535585aec9b5888131d6324
2024-02-07 21:17:48 +00:00
Michael Meeks 29fa4a40a1 signal activity dumping: enrich with session details and state.
Cue up some basic state for being signal safe dumped on crash/abort.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ibc6713aef2a0e7b878b178b05f0e13c8d40b47fc
2024-02-06 19:29:28 +00:00
Ashod Nakashian c1ced10f17 wsd: no need to create existing mount-point
The mount-point must exist already, since
we always mount read-only. There is no
directory to create, but the subsequent
chmod always fails, since the mounted
directory is read-only. Since we started
warning when chmod fails recently,
6208b37a32,
these previously-silent failures became
noisy.

Change-Id: I9efaa89182c016e9a7a5d36cc3da5bfa7ee599c2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-05 16:47:08 +00:00
Michael Meeks 27a7199fbd Warn on non-async dialog usage when in debug mode.
Change-Id: Ic623ba04b9e2735735bfd3ecc8738e12942ddee0
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-01-26 20:03:45 +00:00
Caolán McNamara 8c3bf40bbe the viewrenderedstate=string string is only used in debugging
so we can pass through the full state that the view reports
which makes it easy to see if a browser side is given a view
whose render settings are unexpected.

e.g. clicking "formatting marks" and not getting a viewrenderedstate
with 'P' or view#1 clicks their "formatting marks" and view#2
receives a 'P'ilcrow state.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I31d3a8397f02dedf2505bed5dd83576f3138b504
2024-01-26 15:17:48 +00:00
Marco Cecchetti 9f6824a620 fix linking error for clang 17
CXXLD    unittest
/usr/bin/ld: ../kit/unittest-Kit.o: in function
`Document::updateEditorSpeeds(int, int)':
/opt/shared/work/libreoffice/repo-online/online-cl/test/../kit/Kit.cpp:1488:(.text._ZN8Document18updateEditorSpeedsEii[_ZN8Document18updateEditorSpeedsEii]+0x2d9):
undefined reference to `ChildSession::getSpeed()'

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: If95662647d33f80dd98013b6bc81be897dd6ffc5
2024-01-19 08:56:13 +01:00
Michael Meeks f477e17d5e ChildSession - dump much more internal state.
Change-Id: I1441d88968040b6852bf6338e8a4dfcdf8e308f5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-01-18 20:18:56 +00:00
Mike Kaganski ed642d008d Handle LOK_CALLBACK_TOOLTIP in wsd
Send "tooltip: <payload>" to client for this callback type.
Client-side handling should be implemented separately.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I2d1a07dd36fa20a4b5ff785da788356e0f41d62f
2024-01-16 15:41:48 +03:00
Gökay Şatır ad76f8fece Fix readonly click event.
Converting the coordinates were inconsistent.
Created JSON was not valid.

This PR fixes the issues.

Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: Ibb9cf4e4517a8e3f2d5fc701fdcf287ce72b6b9c
2024-01-12 08:34:20 +03:00
Aron Budea ed53c00fde kit: Only log smaps_rollup open failure when it actually failed
...not when it wasn't even attempted.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Ide56c46b1a2d99c3639aace430cec099c6afcbf4
2024-01-11 14:26:54 +00:00
Caolán McNamara 0f922c2322 Rewinding and rereading proc/smaps_rollup doubles the values on some kernels
So this only affects the case where we reuse the fd from opening smaps_rollup

Bug seen in 4.15.0 and not in 6.5.10, suspected to be fixed by:
258f669e7e
included in >= v4.19

Test for this in coolwsd and set a flag if it is broken

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0a4aca77b9d9201e4f70172340296e5eb5460229
2024-01-10 17:30:46 +00:00
Patrick Luby c4737dfc58 Implement LOK_CALLBACK_EXPORT_FILE for download requests in the iOS app
Have the document's DocumentViewController display a save dialog and
export a copy of the file written by the LibreOffice code.

Signed-off-by: Patrick Luby <guibomacdev@gmail.com>
Change-Id: Idf8136bc321893f18010eb74f9c39b21f0f698d5
2024-01-10 14:31:46 +01:00
Michael Meeks b10b9276b8 Use /proc/self/smaps_rollup for improved perf #7927
Using the aggregated file saves a hundred+ system-calls per
pid we're getting data for, and presumably also lots of time.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I41c40982ebbec44aba72a1d15dabf24a8986f59e
2024-01-03 20:20:02 +00:00
Gökay Şatır 924f13f106 Changes for handling readonly mode click events:
* These changes are made primarily for reading the hyperlink data from the document in readonly mode.
* Added readonlyclick event.
* Added readonlyhyperlinkclicked event.
* And the handlers for these.

When user clicks on document in readonly mode, a readonlyclick event is sent to the server.
Childsession checks if there is a hyperlink at the clicked location.
If so, the information of the hyperlink is sent to the client.

Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I9c104a1ec770491725337b9bbb1e2d1c2851321b
2023-12-27 09:24:28 +03:00
Jaume Pujantell 35d6e2925f use isKitInProcess() instead of KIT_IN_PROCESS
Removed all uses of KIT_IN_PROCESS, used Utils::isKitInProcess()
when necessary. Also removed the now unused parameter 'limit' from
forkLibreOfficeKit.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I068d3f55ab49076590f111847c87b3188f4d25d0
2023-12-18 10:34:10 +00:00
Jaume Pujantell eca990920a add logic to sapwn threads intead of processes
Added code that spawns forkit and lokit in threads instead of new processes.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I6b6ad6dccfedaf28ebd0d68851205c540b9a0317
2023-12-18 10:34:10 +00:00
Jaume Pujantell 8f178ef6cd extract some functions to extra files for in process mode
Extract some functions from ForKit.cpp and COOLWSD.cpp to new files
so we can do a kit in process mode without using ifdef directives.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I7529f8f46a8026318244666b27d1ce72ed5ad4ca
2023-12-18 10:34:10 +00:00
Caolán McNamara 7f2b8c0aef duplicate jsdialog messages seen in UnitBadDocLoad
debugging some intermittent failures in UnitBadDocLoad I see that there
are some duplicate jsdialog messages appearing which is easily
reproducible by just opening test/data/corrupted.odt in online.

probably has been like this since:

commit 7f70197723
Date:   Mon Dec 28 11:37:27 2020 -0400

    kit: enable input process when early dialog show

and possibly not the problem I was originally trying to chase

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I7aa342e86ad9ae73082cb71f1b2c9b2bf0f212b9
2023-12-05 11:38:24 +00:00
Szymon Kłos 30ccc1ef2e Avoid duplicated / in paths
Also use some allowed path for HOME and XDG_CONFIG_HOME so we start correctly.
Setup Work path for pdf/epub export.
Enable osl allowed paths for nocap only.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I4fa058fe5fabc5eafdff7630dfcc72dedfe22e4a
2023-12-01 12:31:33 +01:00
Michael Meeks f11cad502b Use the OSL sandbox as well: belt + braces.
Also move the nocaps TMPDIR into the jail folder, to sandbox better.

Change-Id: I161695b4585a2c6003779caa88152b744d36266b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-12-01 12:31:33 +01:00
Jan Holesovsky 9d8e00312d Kill some copy/paste
Signed-off-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 1ca42964447b6f25acaa63d754f5f42320bea047)

Change-Id: I30fe4421c2305af0da677ebc3731c682e21dae22
2023-11-27 10:48:44 +00:00
Darshan-upadhyay1110 3f46c1db44 kit-in-process: pure re-factor to a run-time function to flag this.
Avoids a number of compile time conditionals and adds flexibility.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Iff6b294b504526e70715e436ad33d47c8df4752c
2023-11-22 17:06:29 +00:00
Michael Meeks 7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Marco Cecchetti 4dfe164f3f Make wsd aware of LOK_CALLBACK_CORE_LOG callback
Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: Ief478ba97ac33f386d7b09aa551168e2c05259de
2023-11-14 13:16:30 +01:00
Marco Cecchetti f6f5325f8d a11y: impress: help screen reader to report shape selection
Avoid screen reader to wrongly report text when a shape or image is
selected:
- Got editable area to be made empty when user is not editing text
- Got default for any input to be prevented (except for some special
cases) when user is not editing text so editable area is kept empty

The selection action and the selected object name (e.g. "Rectangle",
"Presentation Title", etc.) are sent to the client.
That allows screen reader to report: "Presentation Title selected" or
"Rectangle unselected", according to the action type.
Selection text content is reported too when available.

Something alike is reported on cell navigation in a spreadsheet.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I75a8b66ef8cb7b24b28d749f0b24afe2587de45e
2023-10-26 20:35:20 +02:00
Areg Nakashian 8a735d4faf Remove unused requestloksession command
This removes the unused requestloksession command
and all references to it, including protocol documentation.

Signed-off-by: Areg Nakashian <ss4crifice@gmail.com>
Change-Id: I8c410460a5f500f724996fbcbf8f9650028daaf9
2023-10-24 21:35:38 -04:00
Caolán McNamara 80566a9bfe cid#318836 silence Resource leak
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I57255fe9fd13558a4edf2edd06681c7f08b25e51
2023-10-24 09:23:47 +02:00
Ashod Nakashian 90a7c26535 wsd: clang tidy fix
Change-Id: I983b25e11cdf2a535a826449ad23601cb0960ff7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 09:20:32 +02:00
Gülşah Köse 81c2f16302 coolwsd.xml.in: Add possibility to disable overwrite mode
It seems large groups of people don't have a use for overwrite mode
- Would like to avoid enable it by default

This is just the first step on improving the user experience here.

------

The whole plan would be to:
- 1st Follow up PR
  - Where we disable the overwrite mode when enableExperimental is true
  this we will be able to see if community likes that change or not before making it everywhere
- Other possible improvements
  - Triger a snackbar for the first time the user press the Insert key
    - If the feature is disabled we would show snackbar with timeout
      "Overwrite is disabled. Please contact admin."[Dismiss]
    - If the feature is enabled we would show snackbar with timeout
      "Overwrite mode is now enabled" [Disable] (Disable here means the same action as pressing again the **Insert** does)

Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com>
Change-Id: I060b3d2d9d1e7e29a18f5ea1d619c9349eae67c3
Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
2023-10-20 06:39:18 +02:00
Cosmin Humeniuc 7dae294a71 Avoid logging messages when anonymization is on
Signed-off-by: Cosmin Humeniuc <cosmin.humeniuc@1and1.ro>
Change-Id: I5bcf615521d13758b2b70a0c9466a3bbc1a0a918
2023-10-18 16:22:31 +01:00
Caolán McNamara e95489864b keep quarantine files on SIGABRT too
AdminModel::cleanupResourceConsumingDocs uses SIGABRT as first
attept to kill misbehaving documents, we should give
DocumentBroker a chance to quarantine documents killed off by
SIGABRT as we do SIGSEGV/SIGBUS

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic3a703572393050379b5a1444a5380bbeafcf2d3
2023-10-16 14:27:27 +02:00
Caolán McNamara 8d42849156 ProcSMapsFile might not be a valid file descriptor
in which case don't send it, which then implies we might have
an empty shareFDs which we can treat the same as a nonexisting
shareFDs

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I80a78a01c69dbee5ee28a64442a5069a6c2b4dbe
2023-10-14 12:56:15 +01:00
Skyler Grey ee57d3af74 Fix tile dumping when /tmp is not temporary directory
On iOS, each app has its own sandbox which has a temporary directory.
The FileUtil::getSysTempDirectoryPath() method successfully gets this
directory and we create a tiledump directory under it. Sadly, we then
try to write to /tmp regardless of where the temporary directory is.

This commit makes us also write our file in the directory returned by
FileUtil::getSysTempDirectoryPath()

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: Ic8425cb94d1d85ac9c77212eb84d0ca7c46cd34e
2023-10-10 08:24:21 +00:00
Caolán McNamara 14d4d18701 don't immediately delete jails where there was a crash
skip deleting those jails for a few minutes to allow
the DocumentBroker to quarantine the document

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I781eeb77d491fe82a0bfe42eb09439c88f2454b7
2023-10-04 17:29:25 +01:00
Caolán McNamara cceebfed94 cid#323636 Uninitialized pointer field
and use online standard member prefix

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia7681870128185ecba27da0e344912e393e9114b
2023-10-04 09:57:39 +02:00
Caolán McNamara 672f3cee2c rework URP to use a dedicated channel
Instead of fighting the SolarMutex to get the messages
processed by the main loop. Simple and no additional
threading, mutexes etc.

messages from the external uno client are just
written to URPtoLoFD and the core reads from that

messages to the external uno client are written
to URPfromLoFD by core, that fd is in poll, and
activity there triggers a read by the DocBroker
to send it to the external uno client.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib1f0a0d5fb5ab22eee476d5d740b290c51de59dc
2023-10-03 10:15:55 +01:00
Skyler Grey e6d9c1f87c Add support for URP messages in COOLWSD
- Allow COOLWSD client sessions to forward messages with the prefix
  'urp' to the child, and return messages with 'urp:' to the client,
  communicating with binary
- Make COOLWSD child sessions use the FunctionBasedURPConnection from
  https://gerrit.libreoffice.org/c/core/+/155100
  (core change ID I2bda3d0b988bef7883f9b6829eeb5b7ae8075f27) to start a
  new URP session
- Make COOLWSD child sessions submit messages to this URP session,
  stripping and adding the 'urp' and 'urp:' prefixes so the Java client
  from https://gerrit.libreoffice.org/c/core/+/154680
  (core change ID I91ee52922a24688a6b94512cb7e7bc760bf25ec9) can
  use the connection (and to avoid interference with any other websocket
  messages)
- Add a COOLWSD option for enabling/disabling URP given the security
  implications around allowing anyone to write URP (e.g. URP lets you
  run shell commands so a mallicious actor can take over the child
  session)

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: Idadfe288a78cfd72b01253dfdade150d506e3f05
2023-10-03 10:15:55 +01:00
Ashod Nakashian 150663cc28 wsd: stop the rendering thread pool before exiting
Change-Id: I8a084ee1fd583f6c37ba4ca8c1ebf8abe74288a2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-02 20:14:53 +01:00
Rash419 9d6b1d148b don't request new tiles unnecessarily on canonicalidchange
- it applies for 2 cases:
1. when document is loaded for the first time document already has
tiles of respective theme
2. when Kit loads the document it sends canonicalidchange  unconditionally
(5520965b15/kit/Kit.cpp (L1708))
we don't need to request new tiles for that also

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I42cdc5a03e70c3d3d653f3124d3d5ed9382e22c0
2023-10-02 13:29:25 +05:30
Patrick Luby 4b71e988b4 Fix compiler warnings when building on macOS Sonoma
Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: I7e88e0ba272fc00892059c96a2cd0237657e23b9
2023-10-02 08:50:52 +01:00
Caolán McNamara 14dce568f0 cid#318836 Resource leak
in error branches dlclose unusable dso, leave it open on success

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3a2eafceb573cc59ada922d98ae6a9b421d6accc
2023-10-02 08:30:42 +02:00
Szymon Kłos 75cbb26305 Correctly extract file name for exported file
We assumed in the code that LO will return in a
LOK_CALLBACK_EXPORT_FILE url starting with "file:///tmp/"
But that is not true for all the cases. Let's use
more generic approach to extract file name.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ib415f129b10c7e54172536f43a820e4bd3e9bfd2
2023-09-27 15:44:23 +02:00
Caolán McNamara c28dd7f08a cid#323355 Logically dead code
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie2909237e604a4815ba110281335f039c7d792da
2023-09-27 10:25:28 +02:00
Caolán McNamara 0f5c171433 do init_gather_lut at start if simd::init succeeds
and avoid local static in simd_initPixRowSimd

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Idb89d5069da5ff10b346b5e4d767374d4529a96f
2023-09-26 08:39:20 +01:00
Ashod Nakashian 3d93e69e49 wsd: use a smaller value when trimming after inactivity
This is to differentiate between a complete
trimming when idle compared to trimming
when inactive.

Change-Id: I61b309968e0a5199fe4f0fb445437a953c0e468a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 19:29:12 -04:00
Caolán McNamara 77d1424b8d rleMask->rleMaskBlock in non-simd branch
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I09d0c900535eba6b274e294ff39ea71a9d9c323f
2023-09-25 16:55:04 +01:00
Michael Meeks fde98db394 Factor out CPU RLE into a function with similar signature.
Performance testing suggests that:
 + dense text this is 2x faster.
 + 'hello world' text this is 1.7x faster.

Change-Id: I4ff940663c44d0b22c9187deb4ee397a9d9953b0
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Michael Meeks 8f2c7f4de7 Add idea to save an instruction by masking at the same time ...
Change-Id: I9ecd35c1655bd72994a297b8897db473a921bc20
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Michael Meeks 2e1e0c1260 Save another variable and rename.
Change-Id: I279df2615f972acd3f8107b236d67232c3d6015f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Michael Meeks 81a8bb4589 Switch to a single loop to reduce branching.
Simply calculate our loop variables from the iteration we're on.

Change-Id: I0bb73302fb09963b2a1f5b3d93ef302316ef1d4f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Michael Meeks ad768d2337 Handle only 256 pixel runs, to drop another variable.
Change-Id: I5e28b4f86ae191b181a69b82511d3393b5fc8c20
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Michael Meeks 0153ddb554 First cut at getting aligned loads and simpler loop structure.
Remove the special case for the first pixel, and instead have a
previous pixel run initialized to zero.

AVX2 has no effective shift for the while si256 so use permutation
to shift the last pixel of the previous run into the right place,
mask it and combine.

Saves a second un-aligned load of the same data, and branch.

Change-Id: I77c9cdead13d37aaf4d9f31d98cbd5c4a9c5ce24
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Michael Meeks 743fa7d91f Use a LUT and SIMD packing logic to accelerate RLE pixel copy.
Change-Id: I6874f1b33acf6f0f3c72c86f9fbe232e1f5a560a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Caolán McNamara 42e98bb2e4 experimentally bootstrap something using avx2 to generate bitmap
just enough to get the same results as before

https://github.com/CollaboraOnline/online/issues/7165

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I109c9b8f1e7935782c72e0179aa0ed48712eadb6
2023-09-25 16:55:04 +01:00
Michael Meeks 6d6425336d SIMD - first cut at building LUT for vpermd gather.
Change-Id: I6ae13be0a36b4e30b3d535029313d8402da7de1d
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Michael Meeks cce3767ba8 First cut SIMD wrappers / separation to accelerate RLE code.
Split it out as a C file, to avoid accidental C++ header inclusion,
and C is a cross-platform assembler anyway so a good match.

Change-Id: I6c042781713aecaf143b9663af8377659a7deaf1
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Henry Castro a125259787 kit: add 'readonly' property to status message
Change-Id: I8068da5a28f3176023013c84eb6599a6cedbb3f5
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-09-15 10:21:53 -04:00
Paris Oplopoios e5b7464bbf Invalidate canonical id unconditionally
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I061e34af1a1676e5bba5d476ea9e7ff5758744a1
2023-09-12 00:49:18 +02:00
Patrick Luby 0898e05e3a Invalidate canonical ID for Draw and PDF files so that the slides
in the slide pane will render

Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: I43f93c0c02d801391eaea9916ab1bd8e827249a9
2023-09-12 00:49:18 +02:00
Miklos Vajna 790a19ab25 kit: improve date format of UNO commands in crashreports
Old format:

	kit-27634-02839 2023-08-30 11:08:43.590564 +0000 [ kitbroker_17a ] SIG   Fatal signal received: SIGSEGV code: 1 for address: 0x4f00000007
	      unoCommand(2552f) : ToolbarMode?Mode:string=notebookbar_online.ui - Wed, 30 Aug 2023 11:08:31

New format:

	kit-30199-30197 2023-09-06 14:30:21.417817 +0200 [ kitbroker_001 ] SIG   Fatal signal received: SIGABRT code: 18446744073709551610 for address: 0x3e8000075f7
	Recent activity:
		unoCommand(064) : ToolbarMode?Mode:string=notebookbar_online.ui - 2023-09-06 12:29:56

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Idf62ea18c75c453d188d8c25723a43824d5fc147
2023-09-11 10:07:19 +02:00
Paris Oplopoios 0621aa4825 Fix canonical id related unit tests
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Ie4b965c3bac8cddd48a47343d2d1c5f387d8bd41
2023-09-06 10:28:26 +02:00
Paris Oplopoios 5409175a2a Add assertions for bad canonicalviewid
Change-Id: I2621e08123ca9cac30e027b0c018c0e9cc40750d
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
2023-09-06 10:28:26 +02:00
Paris Oplopoios cfd1d2e01f Revert "Give new sockets a canonical view id in tests"
This reverts commit a003126a65.

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
2023-09-06 10:28:26 +02:00
Michael Meeks f34efeecd3 Add trimming to activity log in case of crash.
Also rename trimIfExcessive to trimAfterInactivity.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I62166a3ed5d70d1e6fd9804e91e07452978523fd
2023-08-29 20:18:23 +01:00
Caolán McNamara 492f678996 add and use 'N_ELEMENTS' in lieu of std::size
which isn't available in the current android toolchain

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5834adb7c6211c7aad38f5977a7e425d9ca257fd
2023-08-23 12:06:31 +02:00
Caolán McNamara 205f6d3119 Related: #7079 handle tile requests inside viewport first
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie25c7711485f37ab4d038a1c1d1dc1e4d4a8dd4f
2023-08-21 20:48:31 +01:00
Caolán McNamara 6d5c78dec0 move "combined" bit inside TileCombined class
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I274c5844660acbf69e50587cce3f4ddcae414723
2023-08-21 20:48:31 +01:00
Ashod Nakashian efe874f89c wsd: simplify shutdown and termination flagging
With the use of a single flag for both, the
logic is now less ambiguous, as we cannot have
termination flagged without also implying
shutting down.
The assertions are no longer needed.

Now that setting the termination flag
explicitly implies having the shut down flag
as well, the checks are simpler. We only
need to check that the shutdown is not set
to continue running as normal, since having
the termination flag must perfoce mean shut
down is also set, there is no need to check
both.

Change-Id: I99e22f5668385182b0594040a8e3354b55e74642
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-14 16:32:50 +02:00
Marco Cecchetti 96a7cfb25e a11y: provide info about current table and cell to screen reader
When we get in one or more tables screen reader reports row and column
count.
When we get out one or more table screen report reports "out of table"
for each table.
When the fosused cell changes screen reader reports new row/col index.
Screen reader reports cell paragraph content, too.
Added also cypress tests for checking that the table/cell description
string is correct.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I078b29a2f76f91df479f75db76113c80405f7169
2023-08-10 09:29:09 +02:00
Paris Oplopoios a003126a65 Give new sockets a canonical view id in tests
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I0c8a534fccb8088ab303852304802b4926369058
2023-08-05 12:00:08 +03:00
Paris Oplopoios d0c5321aaf Fix getting canonical view id of 1000
Also tilecombine request now uses the canonicalviewid

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Ib386edcf78de17cb4fc3d8c3c6ce65f6b52c8b5f
2023-08-05 12:00:08 +03:00
Jaume Pujantell 63473360b1 save-as preserves document password
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: Ibaa00fbe4e83c8e4edfe2a70ede861f9adbd20bf
2023-08-03 11:09:35 +01:00
Ashod Nakashian 347b3c90e5 wsd: correct assertion
Change-Id: I07d6ec53c08a5f4d7d259224452db4d533e14689
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian 5b52f7d8eb wsd: smart pointer cleanup
std::make_shared and std::make_unique
are superior to explict smart pointer
construction. Where we have private
constructors, we can't use them.

Change-Id: I492122f58e958113c6e6d31445c6614ad98c89aa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Michael Meeks 6c382f5415 rle: optimize inner loop bit-bashing.
Simplified code:

+ re-use the bit mask as an inner loop counter.
+ turn alpha only rows into zero length with agreed lastPix.
+ keep lastPix around on the stack.
+ handle odd widths in a duplicate slow-path

Change-Id: Ibc7630f7187ea5f4904c6fed14dda28cdfbf7523

rle: further optimize the pixel reading & de-compression.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ifcaaa45d1de6532b3fd43015c47a37daf56c2ea5
2023-07-31 21:31:13 +01:00
Michael Meeks 7256b59bba deltas: don't drop delta cache on 10 seconds idleness.
This would have only a small impact on memory use, and a large
impact on interactivity, performance and bandwidth use. So lets
not do that.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I07b2538cd4f5cd2c91926cfabeaa159dd992b068
2023-07-20 18:32:59 -04:00
Szymon Kłos eaeaee4134 LOK_CALLBACK_DOCUMENT_SIZE_CHANGED is different per view
In calc and impress we send different data depending on the view
in status: message which is triggered by LOK_CALLBACK_DOCUMENT_SIZE_CHANGED.
Every view can be on a different part / sheet / slide where document
size can be also independent.

This helps to reduce status: messages sent to other view when
switching sheets in other view.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I5b287f377a551affcfb4d12b6114dffa0fd51992
2023-07-19 19:50:19 +05:30
Ashod Nakashian a82acb6c6e wsd: trim memory on idling
When all users idle their activities
for at least 10 seconds, we take the
opportunity to trim the memory footprint.

We are careful not to issue a subsequent
trimming too soon. A minimum of 30 seconds
needs to pass to trim again. This should
give a decent balance between performance
and reduced memory footprint.

Change-Id: I1c8b2c4a265c9aa0ac5033762695706ad970f11e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-19 11:40:54 +02:00
Michael Meeks b700ea08a8 deltas: further increase Kit delta cache to 96 tiles.
Should help for single user with large screens.
Also dump delta cache sizes on USR1.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Id16a287be6b05cee5681abe1d9d2dc0ec61cda2a
2023-07-18 09:43:34 +02:00
Michael Meeks cfa831ee68 memory: add dump_malloc_stats helper.
gdb seems to really struggle with versioned symbols & types in glibc.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ic59020c2e5c88fbeb7799d3f5c06752097a5ad40
2023-07-18 09:43:34 +02:00
Michael Meeks 4d9070b1da Remove long obsolete ENABLE_DELTAS conditional.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I7f254328ba1be8074d8f1feabd7b89304166281d
2023-07-17 11:35:25 +02:00
Michael Meeks d309d7199a deltas: fold the update: command back into an empty delta: command.
Also: address parts of #6897, primarily:

* remove the problematic aspect of bumping the last wid in our
  TileData, when this could trigger a re-send of a previously
  sent delta, causing tile corruption.
    * instead append an empty wid entry.
    * as an optimization - if the last entry is empty update
      the wid - since re-sending an empty delta is of no
      concern.

* simplify a number of code-paths that special-case zero length
  deltas. All deltas now commence with 'D'.

* still track updates in the JS - by detecting empty deltas.

* shares more code and simplifies various paths.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I02af6d4b152524c201b6985b7a3497da7f08a517
2023-07-17 11:35:25 +02:00
Marco Cecchetti abca8e5dd3 Adding support for enabling/disabling a11y support from the ui
Added toggle button/menu entry for enable/disable accessibility support.
This ui feature is available for Online Writer only.
The button/menu entry is added only when accessibility is enabled at
server level.
That allows to enable/disable accessibility per view.
By default, the accessibility support is disabled.
Anyway the accessibility support state is saved to local storage
if available.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: If5968a47f17922038b9da3d320cbed84ebb7688b
2023-07-10 16:02:18 +02:00
Michael Meeks 789dd2963c Append the wid properly to invalidatetiles and parse it too.
also re-work parseInvalidateMsg to not use std::pair<> returns.

Change-Id: I724783b7050a1ee251dfbe9b2f1e0ea02e7d45f2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-08 13:08:59 +01:00
Caolán McNamara da10eb9996 return failure early in case of oversized tiles
it shouldn't happen, but return early if it does

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1733d346ff370827fd882caacebca111f790bbe1
2023-07-06 14:25:31 +01:00
Caolán McNamara 7833e8ce02 asan error seen in testRleComplex
=============== START DeltaTests::testRleComplex
../kit/Delta.hpp:98:23: runtime error: index 4 out of bounds for type 'const uint64_t[4]' (aka 'const unsigned long[4]')
    #0 0x55d29dacd21b in DeltaGenerator::DeltaBitmapRow::PixIterator::next() libreoffice/online-san/test/../kit/Delta.hpp:98:23
    #1 0x55d29da8d514 in DeltaTests::testRleComplex() libreoffice/online-san/test/DeltaTests.cpp:316:16
    #2 0x55d29daf7a87 in void std::__invoke_impl<void, void (DeltaTests::*&)(), DeltaTests*&>(std::__invoke_memfun_deref, void (DeltaTests::*&)(), DeltaTests*&) /usr/bin/../lib64/gcc/x86_64-suse-linux/9/../../../../include/c++/9/bits/invoke.h:73:14

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib6e13eaf0fb89ad086a99251d5b8edcdcedd6800
2023-07-06 11:40:48 +01:00
Caolán McNamara 28f5273ad7 cid#318876 Wrapper object use after free
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: If80119af29ffde7ca437047da4646c0876d98014
2023-07-05 14:49:59 +02:00
Caolán McNamara 76a5a9baff transport in rgba order
so if core is compiled with a cairo using rgba the pixels can
be sent without need to reorder in server or client

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iaf0410f1eaa605b9ce2716625f6c968bca523ccb
2023-07-05 11:58:54 +01:00
Michael Meeks 36818e9153 tiles: track invalidation by monotonic timestamp.
We want to keep pre-loaded, and invalidated tiles around so that
we have something to render in lots of cases, particularly for
other parts, and slides. However - we need to know that it is
invalid so we can on-demand fetch something better.

It is very important that this invalid state doesn't race with
tile arrivals ie. in a banal way:

	invalidate, req, invalidate, req, tile, invalidate, req, tile

it is unclear whether the latest tile is still invalid; similarly,
if we request(req) a tile and there is no change to it we get no
response.

To disambiguate this, use the monotonic wid to check we are in-sync.

Re-factor:
	setup debug tile layer more pro-active.y
	rename HasContent to NeedsFetch to be more explicit.

Remove:
	previous _invalidCount that was perhaps a similar idea.
	previous .loaded concept.
	previous _pruneTiles concept - now it seems we can be
	confident in cached tiles from other slides and sheets.

Change-Id: Ibc6d3b6050e756ace91a9bd53d3e4efe12b023cf
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-03 20:27:07 +01:00
Caolán McNamara 52338a50f1 cid#318841 String not null terminated
help coverity see that this is not true

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie2b72e7c0bcc649509310edc5498ec7adc7ebe72
2023-06-29 08:03:00 -04:00
Paris Oplopoios 738de114d7 Make writer page background match document color
It used to be that scrolling in dark mode would show a white color while
the tiles were loading - now shows the document background color.

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Id4c3881e728ae18496bf276e8c565a7abc1de7b5
2023-06-29 11:22:04 +01:00
Jaume Pujantell aceb8912fd Handle LOK_CALLBACK_DOCUMENT_PASSWORD_RESET
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: Ibc2be5bc7676b1b67b7494c200011e4622a5b294
2023-06-23 18:17:14 +02:00
Caolán McNamara 490b0c0d0d drop non-standard width=400 height=400 tile request in unit test
there since:

commit 232499f542
Date:   Thu Apr 21 12:34:30 2016 +0300

and

commit bf66f7a908
Date:   Mon Jun 13 20:31:14 2016 -0400

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I04745be0581a697bbc3b15ba1d8bb94207320a7a
2023-06-23 16:55:25 +01:00
Caolán McNamara 2e64ad700d push unpremultiply to client
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I4aef21179a4ace084762f83f5235c7022d670752
2023-06-23 14:20:42 +01:00
Caolán McNamara 962ecba493 push bgra->rgba conversion to the client
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I425655bfd5e6fd9e1e3ca0b6bcc914511ba188b3
2023-06-23 14:20:42 +01:00
Caolán McNamara 9c780bec82 double delta cache
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I4f06f9c4bd6f6fc41b6eed23eb2331daa26f0b5b
2023-06-23 14:07:31 +01:00
Michael Meeks 12e0830b1b Kill canceltiles support completely.
This stopped working well a long time ago, and is already disabled
on the coolwsd side, so dung out the rest of the code & docs on this.

Change-Id: I2e0b73fe9780e16c3cc74ae3a38ae6b04434717a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:35:22 +01:00
Caolán McNamara d3ecb6c95f the tile is assumed to be 256 in width
but as seen with unit-tiletest that is not always the case

==24170==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x63400001e808 at pc 0x558a6f505973 bp 0x7ffc0670e7d0 sp 0x7ffc0670e7c8
READ of size 8 at 0x63400001e808 thread T0 (kitbroker_002)
    #0 0x558a6f505972 in DeltaGenerator::DeltaBitmapRow::initRow(unsigned int const*, unsigned int) Delta.hpp:129:36
    #1 0x558a6f4fc318 in DeltaGenerator::DeltaData::DeltaData(unsigned int, unsigned char*, unsigned long, unsigned long, int, int, TileLocation const&, int, int) Delta.hpp:233:21
    #2 0x558a6f4f8a22 in DeltaGenerator::createDelta(unsigned char*, unsigned long, unsigned long, int, int, int, int, TileLocation const&, std::vector<char, std::allocator<char> >&, unsigned int, bool) Delta.hpp:574:17
    #3 0x558a6f4f2a35 in DeltaGenerator::compressOrDelta(unsigned char*, unsigned long, unsigned long, int, int, int, int, TileLocation const&, std::vector<char, std::allocator<char> >&, unsigned int, bool, bool, LibreOfficeKitTileMode) Delta.hpp:669:14
    #4 0x558a6f41f300 in RenderTiles::doRender(std::shared_ptr<lok::Document>, DeltaGenerator&, TileCombined&, ThreadPool&, bool, std::function<void (unsigned char*, int, int, unsigned long, unsigned long, int, int, LibreOfficeKitTileMode)> const&, std::function<void (char const*, unsigned long)> const&, unsigned int, int, bool)::$_0::operator()() const /home/vmiklos/git/libreoffice/online-san/./common/RenderTiles.hpp:304:38

so just use the rle cache for the first 256 pixels

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8d34ea53bd20b69184e100b56017dfc0a904eaab
2023-06-21 21:31:48 +01:00
Caolán McNamara cc809fda24 fix asan build test
../kit/Delta.hpp:96:23: runtime error: index 4 out of bounds for type 'const uint64_t[4]' (aka 'const unsigned long[4]')
    #0 0x558e8e0f800b in DeltaGenerator::DeltaBitmapRow::PixIterator::next() libreoffice/online-san/test/../kit/Delta.hpp:96:23
    #1 0x558e8e0b8304 in DeltaTests::testRleComplex() libreoffice/online-san/test/DeltaTests.cpp:317:16

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I01da1e99b5d224411344659dce8bd2f29e7d74b0
2023-06-21 17:09:24 +02:00
Michael Meeks 28808ebf6a delta: Add unit tests for RLE encoding, and debugging support.
Change-Id: Ie0b62dbad8af2ab6ff95d6279c69de083c2cd888
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-21 10:00:10 +01:00
Michael Meeks 9d8e84effb deltas: RLE compress pixel runs to save space & time.
Store a bitmap of whether a pixel is identical to the last
pixel in a set of four 64bit members. These double as a
simple CRC. Store the allocated row size too, and use the
stack as a temporary scratch-space to do the building in.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-21 10:00:10 +01:00
Michael Meeks 74a1047452 deltas: pure re-factor, store pixels in each DeltaBitmapRow.
Un-necessary allocation overhead for now, but more follows.

Change-Id: I1012678daf021cf63d8fc6e52d25d2dec703c4fb
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-21 10:00:10 +01:00
Michael Meeks 675c41c644 deltas: pure re-factor: extract out diffRowTo.
Change-Id: I908a486c0c67beaee7b41a85a3bde911f9fe141a
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-21 10:00:10 +01:00
Caolán McNamara 1063fdbcba cid#318963 Uninitialized scalar field
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I459f70a41e5c1bab2e575c8d9ee699e213f2456e
2023-06-14 10:10:46 +02:00
Caolán McNamara c8c49c5b53 cid#318908 Uninitialized scalar field
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I24f1ec683651439761fda48d2db68fee19afcc62
2023-06-14 10:10:46 +02:00
Caolán McNamara 2d6b190805 cid#318977 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Idea2efdb46d1b819b8210a380bd026789d666e2b
2023-06-14 10:10:46 +02:00
Tomaž Vajngerl d23ddf1342 support callback for changing the color palette
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I8d0dec4afd91bcdf66799f3afba1fd77cbc223db
2023-06-09 14:30:45 +02:00
Miklos Vajna a901db436c kit: fix missing init of _isDumpingTiles in ChildSession
This was forgotten in commit 21966e1a9c
(Fix copy command going out of bounds during delta creation,
2023-05-31).

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I91ce26f46cc6cb7a2dc3ab0665dc9aeea8a5c00f
2023-06-09 01:36:58 +03:00
Marco Cecchetti d01bedc09c a11y: add config for enable/disable accessibility in general
A new section about accessibility has been appended to coolwsd.xml
config file

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I086abdf73646639283eb655ae60f200fb64e495a
2023-06-08 00:00:51 +02:00
Paris Oplopoios 21966e1a9c Fix copy command going out of bounds during delta creation
When creating a delta, the copy command could copy from rows that are
bigger than the height of the tile. This would go unnoticed on light
mode because the js side that applied the delta would apply these out of
bounds rows with a white color, but it is noticable in dark mode. Made
it so the copy command stops copying from out of bounds.

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I4d05cb411958d0945933edb5c812de2dfd9c1abd
2023-06-05 08:59:39 +01:00
Paris Oplopoios baaecac852 Add debug option that allows tile dumping
Added a debug option (triggerable using the about debug menu) that
allows you to dump tiles as they come in

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: If5939b816c1e3598e50c2db4971710524f855909
2023-06-05 08:59:39 +01:00
Paris Oplopoios b6d4c88f90 Replace documentbackgroundcolor with applicationbackgroundcolor
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I31dc013f239daec039b194a2b15365a6f3d71621
2023-06-05 08:59:39 +01:00
Marco Cecchetti b9f9cef60a a11y: populating editable area with focused paragraph
We handle notification from core about currently focused paragraph:
content, caret position, text selection start/end.
Notifications are sent on any text changes, even when the text has
been modified in another view.
Moreover we can request such info to core at any time.
That allows AT software to read focused paragraph and selected text.
All that keeping editing still working.
A set of new cypress tests for checking clipboard content has been
developed.

failing cpp unit test:
- HTTPWSTest::testInactiveClient
'unexpected message' assertion was failing since an idle client can
receive an a11yfocuschanged message when the same paragraph has focus
in both view and the active view is editing the paragraph.

failing cypress tests:
desktop
- calc/autofilter_spec.js
  - added more wait time before performing clickOnFirstCell
- impress/undo_redo_spec.js
  - Repair Document was broken
    - we need to select 'Hello world' in order to overwrite it

mobile
- impress/spellchecking_spec.js
  - Apply suggestion
    - better use selectTextOfShape instead of Ctrl-A

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I070d390543fa66fe786c4a0661fa09f891b9883e
2023-05-31 22:43:51 +02:00
Ashod Nakashian cec4cf087a wsd: test: initialize logs before unit-tests
Make sure that the logging subsystem is
already initialized before starting
unit-tests.

Change-Id: I2ce3ffdb2d3b0094ae7ed496d7cacfc02af89c21
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-31 07:40:11 -04:00
Szymon Kłos 376e8fdd97 linking-api: zoom document to avoid empty space on thumbnail
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I572dc8bd239265a9ab9311aa109e82b1d4e06efb
2023-05-17 16:43:54 +02:00
Ashod Nakashian fd87ab6b32 wsd: clang tidy fixes
Change-Id: I7b3b08c8040ba4397ce660c5eaa1d0413c3ec611
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian ff1657934a wsd: simplify log streaming
Change-Id: Id22de0bc06680f957e7475f142bcaf1131fdbdb9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Gökay Şatır 9d6296e4b3 Remove unused document signing code.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I30cf381d1fa282cf222ab5abc676374ab7eefb6c
2023-05-08 21:51:47 +03:00
Paris Oplopoios 26c55fc417 Handle LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR in ChildSession
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Icef1e490e847ca21bc525dfd989190940b746b78
2023-05-05 12:38:59 +03:00
Michael Meeks f6bd976f00 Jail cleanup - include coolwsd pid + hash into a jails sub-directory.
This avoids removing the jails of other running coolwsd that share
the same jails/ directory, such as unit-tests, cypress tests etc.

Assert on fatal system error to help catch this during test builds.

Remove old unit-test specific approach, and generalize it, since
apparently we did a recursive cleanup of other people's jails anyway.

Remove over-complicated recursive approach, for a rather simpler
one-level scheme. Avoid following symlinks too for safety.

Remove obsolete lo_jail_subpath setting.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I371f8c0e22f64fb2befb4b58f72cefa39567f3b5
2023-04-25 10:41:57 +01:00
Tor Lillqvist bc6b3bbaee Fix build for iOS (and possibly for Android)
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5eb5187b896b7e80aaab5660a8f10268b565dc8f
2023-04-24 17:15:47 +03:00
Ashod Nakashian 2097e936f5 wsd: only external insertfile names
Change-Id: I76e63dcbf724249e23003353a6fdd2237570fd39
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-24 14:04:43 +02:00
Michael Meeks 07d1260058 Consistency checking at various points: load, save.
Check that everything is where it should be; catch and warn
about jails that are corrupted beyond our control, or perhaps
manually un-mounted etc.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ib5f7769ded119d7c6126984b040d0e5565ca8055
2023-04-21 19:20:50 -04:00
Ashod Nakashian fecad56715 wsd: shutdown the Kit socket before terminating to flush
In some rare cases we can't write to the socket
before we terminate, and the last message is
lost. This is observed in tests and especially
when we simulate socket write failure.

Change-Id: I9fb298edfe53de3c7ea0c2f31c02ba370167f96e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 11:30:14 +01:00
Michael Meeks 7444decf9f trim memory when user is inactive.
Builds on a new LOK API to do the same in the core.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4443cd2ffbb6c7af0726162aec2ba78fc354d901
2023-03-23 11:31:24 +00:00
Paris Oplopoios 8ade29f112 Handle LOK_CALLBACK_VIEW_RENDER_STATE in the Kit
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Ie4d03a3600cb9ebdf9b76ee4779d62da30ad3eb6
2023-03-17 17:34:05 +00:00
Paris Oplopoios ab176b13a8 Move canonicalId creation to the Kit
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I943bfa0436487e517b25d3fce19157ebd576604f
2023-03-17 17:34:05 +00:00
Paris Oplopoios d26c425dae Move _canonicalViewId out of Session
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I9c06440ed47eb217e973d2f530f2c3646d55d85b
2023-03-17 17:34:05 +00:00
Tor Lillqvist 43a8ed3f1c Rename variables to match meaning and add a few comments
It is misleading to use the word "pixel" in a variable name when the
variable specifies a size in twips.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Idc59c3dafd63a9ae73601f9c367b37c495e1593a
2023-03-13 12:33:49 +01:00
Tor Lillqvist 12c22706f9 We aparently want thumbnails to be of size 1200x630 pixels
Tweak the "zoom" variabe to be 1 so that with this thumbnail size, for
a typical document we get more of it into the thumbnail.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I419afccbf57eae23062ab4c849dd41293f068f00
2023-03-13 12:33:49 +01:00
Tor Lillqvist b72edec3b5 There is no separate paintThumbnail() API in LibreOfficeKit any longer
It was just a thin wrapper around paintTile() anyway.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I7cca1b05b1ded754ae1f50a0e9d434b505247e70
2023-03-10 19:41:16 +00:00
Szymon Kłos 7cb8005df9 Send thumbnail in binary format
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Iad5aec0cfa699f7e38a28c3c6812426ea345bafb
2023-03-10 19:41:16 +00:00
Szymon Kłos 50b5c06ad7 Scroll to target
using URL parameter we setup documents position on load.
example: ...&target=image6.png|graphic

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I855bdb148819966e0d51dde217a94474003a6437
2023-03-10 19:41:16 +00:00
Szymon Kłos e82aa05293 Handle target in get-thumbnail
Using target parameter we move cursor to the desired position.
Thumbnail then is created and sent to the client.
Example target: "image7.png|graphic"

Original author was Mert Tümer.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I170f6af6fd29c420565feca69b8bef034fd91a66
2023-03-10 19:41:16 +00:00
Szymon Kłos 3bec642b02 Add get-thumbnail endpoint
Which generates PNG of selected link target in the document

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Icfdca2f0b58ea370ca0125c188759e942aacc2e0
2023-03-10 19:41:16 +00:00
Szymon Kłos 18e304e87c Add extract-link-targets endpoint
Original author was Mert Tümer.

Example output for: POST http://localhost:9980/cool/extract-link-targets/

{
    "Targets": {
        "Tables": {
            "Table1": "Table1|table"
        },
        "Frames": {},
        "Images": {
            "image7.png": "image7.png|graphic"
        },
        "OLE objects": {},
        "Sections": {
            "Table of Contents1": "Table of Contents1|region"
        },
        "Headings": {},
        "Bookmarks": {
            "_lh2zfxamp5al": "_lh2zfxamp5al"
        },
        "Drawing objects": {}
    }
}

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Iab55ec631d78dbe25b2800ed9296bc0cb8997e97
2023-03-10 19:41:16 +00:00
Ashod Nakashian 9c39ebad1f wsd: string::empty() is clearer than size() == 0
Change-Id: If2e25d344b5718c35cb9ae7b7519010ee88f0f60
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-10 07:45:12 -05:00
Ashod Nakashian 74d6739f0d wsd: time the duration of fork
Change-Id: I92f624139f274df95a47f430802a29d33d587689
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-06 08:43:37 -05:00
Ashod Nakashian 3fda293103 wsd: name fields in logs and standardize bracketing
Change-Id: I3fe0acf47ebdb0b2551ad20299fe7d720872cbb2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-06 08:43:37 -05:00
Ashod Nakashian 0f9dc9460b wsd: support per-user timezone
Change-Id: I5e2318a34cb39d8d56ec3cf4977ebd75588a7627
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-31 15:38:08 +01:00
Ashod Nakashian ecc8bc5bbc wsd: exit code 0 for the exit command to kit
No reason to consider the 'exit' command
unexpected or a cause for error, so the
process exit code needs not be anything
but 0.

Change-Id: I352f706c6f174b66e9a4814fc35bb95b1a3bf3d6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00