Commit graph

20998 commits

Author SHA1 Message Date
Caolán McNamara
69820d85e8 fix js/useless-assignment-to-local warning
tile = this._tiles[key];
 if (!tile)
   tile = this.createTile(coords, key);
   ^^^^
The value assigned to tile here is unused.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iaabaa6417bcbf385ff2bde139663f8bd2e90db49
2023-06-22 14:12:54 +01:00
Michael Meeks
bdf29a5365 Comment some more ...
Change-Id: I1bf5f638bc9b5fa1cb946dc7cd58be39cd6a6c5e
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:35:22 +01:00
Caolán McNamara
9cab50049b this.hasContent -> tile.hasContent - #6369
Thanks to: Patrick Luby <patrick.luby@collabora.com>

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id58a276eade2ec3df3488ae70e1975f0f3ca527d
2023-06-22 09:35:22 +01:00
Michael Meeks
38b59a3f1c Handle canvas / tile memory more frugaly - #6369
Instead of spending time re-compressing canvases as pngs and
base64'ing these into URLs, lets just keep the nice, pre-compressed
zstd keyframe around and its associated deltas, in case we need them.

Move to a simple LRU time for cache eviction of all types: sorting
_tiles by last render time. Collect garbage regularly while working.
Enforce canvas count, compressed arrays and number of tiles limits
under a high watermark. We should have enough canvases around to
keep rendering snappy, while not jeopardising our ability to allocate
larger document canvases to render into.

Re-create canvases if/as/when we need to render them from our
cached compressed versions.

Re-factor and simplify createTile, pass section into foreachTileInArea.

  Includes parts of:

    Partial fix for issue #5876 discard excess canvas contexts

    WKWebView has a hardcoded memory limit for all canvas contexts
    so if canvas.getContext('2d') returns null, convert the canvas
    of other tiles to an image until canvas.getContext('2d') succeeds.

    Thanks to: Patrick Luby <patrick.luby@collabora.com>

Change-Id: I5117b0986aa46d2fffab6cd66d990de39dfcecea
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:35:22 +01:00
Michael Meeks
40ffe9ee03 Remove obsolete code from when tiles were Images.
We no longer need to track their loaded state, loading errors etc.

Change-Id: Icfa82807a800fc7a7406c130de22eb600324f61d
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:35:22 +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
a06f31ec77 WaE: -Werror,-Winconsistent-missing-override
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I35bbc86924cfc1f9045d8168119d022f23edeac4
2023-06-21 16:40:47 +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
Szymon Kłos
135d7a0ebb jsdialog: improve spinfields validation #6650
Fixes #6650

When opened empty hello-world.odt document and
then in dialog Format->Paragraph switched tabs
and then returned to "Indents & spacing" - some
fields were marked as invalid.

This was caused by agressive validation done by the browser.
Let's adjust step to min and max value also to avoid these
errors.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ie7784fdd85cda725a816842a7915efffcab22d0b
2023-06-21 16:24:10 +02:00
Caolán McNamara
5064d2bff1 cid#318846 Array compared against 0
array_null: Comparing an array to null is not useful: "false",
since the test will always evaluate as true.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib34694022484e9041827980c0b67fe614446f4b9
2023-06-21 11:11:42 +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
Pedro Pinto Silva
edbd19b104 Dark mode: fontwork icon: added from fee024f739 but with wrong name
Fix #6666

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: Ie145681bbfd452eaea44864fdb9496cd986b6f8c
2023-06-21 10:25:07 +02:00
Pedro Pinto Silva
699e78716c Dark mode: Add missing lc_fullscreen-presentation-toolbar-mobile.svg
Fixes #6684

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I1eb954657baf3e94add2380ac09d37d137a26c94
2023-06-21 10:17:31 +02:00
Caolán McNamara
dc044b532f cid#318910 Logically dead code
this should presumably be checking caps_none not caps and is a cnp
error

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I46f381fbec31b3e9c311f1becf0c536c192788fd
2023-06-21 08:40:21 +02:00
Caolán McNamara
c617e14d67 cid#318956 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ifcd6984042b50999a24f65479bc81428f710d38a
2023-06-21 08:40:21 +02:00
Caolán McNamara
1b8e81497c cid#318967 Uninitialized scalar field
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I508dd19109fe9d32c57b538c51bb006713d83f36
2023-06-21 08:40:21 +02:00
Gökay Şatır
bfe4060571 Revert "23.05 - Android : tapping on cells flickers the keyboard"
This reverts commit f59dd62f6f.

Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I6ffc0efc46640fc77e097e3eabf14c0c6d6c18ee
2023-06-20 19:23:22 +01:00
Pedro Pinto Silva
8a0c8c44a7 JSDialog: Add missing padding for ui-text labels
This way they:
- Align to checkbox
- And have additional padding in places such as Format > Paragraph
Line spacing 's dropdown is glued to "of" label

This also fixes one task from https://github.com/CollaboraOnline/online/issues/6647

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I53e66602dffbc96db39449cbda53d433a9dd12d8
2023-06-20 11:29:32 +02:00
Ashod Nakashian
4363e2abe0 wsd: test: correct message example in comment
Change-Id: Id7bb0fba2e7233cf3f8167e46af7e4f99901dbaf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
6892d63916 wsd: test: minor cleanup of UnitWOPIWatermark
Change-Id: I9e69c432ee0c4a4f8fab3fe64137a4c33df7c811
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
bc5e9f1ed0 wsd: test: use configCheckFileInfo instead of handleHttpRequest
Change-Id: Iff526bda55e112877df74d55f21bc8108bb384f2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
6f0199f07f wsd: test: refactor assertCheckFileInfoRequest into the handler
Change-Id: I089706147b12d75d8dce8ffb740ffe738f1354ec
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
fc80fb66bf wsd: test: refactor assertGetFileRequest into the handler
Change-Id: I4a1a17bac9694f92ffab49d1c9143bab83f22835
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
b6a8ca439b wsd: test: use sendAndShutdown
Instead of explicit send and shutdown calls.

Change-Id: Ia08ccc003b1fa6c224d2cc9bc2520c722bf5752c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
6179aac456 wsd: test: reduce manual http header creation
We have http::Response specifically for
this kind of thing.

Change-Id: I4cc24378741bb1da76967e9c01a33060d11cdc4b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
e93e7fd3b5 wsd: test: reuse getDefaultCheckFileInfoPayload
Change-Id: I7cc1aab6bac397d46c4b87e5f4f943f7a141c8e6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
901ea7969a wsd: test: refactor the default CheckFileInfo payload
Change-Id: I357e5733cba12b1826d13ca0cdc6d5de3da0afd0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian
d0d09e3d51 wsd: test: testInactiveClient may get jsdsialog message
Change-Id: Ib5df91537e91e0a658fd7c47fa5fd07610f0c786
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 09:42:49 +02:00
Ashod Nakashian
214f212571 wsd: fallback from mknode to bind-mount for random devs
In some cases we may not have permission to create devices.
This happen on nodev systems and some containers. In
those cases, we gracefully fallback to bind-mounting.

Ideally, we would like to reduce the number of bind-mount
cases we do per document, which i why mknod is preferred.

Cleaning up works without modification because the
random devices are mounted in /tmp (in the chroot),
which itself is bind-mounted. So removing it is
sufficient.

Change-Id: If9a4f0a511273952ead95d6c6855ca2becaf757f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 09:42:49 +02:00
Ashod Nakashian
67c5dbb5de mount: support mounting from character device
And improve error reporting.

Change-Id: I28b5c21e1bc4f20fccd6d7f1dfca0240b91e71fd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 09:42:49 +02:00
Ashod Nakashian
95cf60ed5c killpoco: use own file stat helper
Change-Id: I668c2aab04083689a867e7d1f77e2b52c9351969
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 09:42:49 +02:00
Ashod Nakashian
7a634d0790 wsd: support providing CSP header in the config
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 25fe0b2dfb56494d59c3502f690265d46dbbc4ff)

Change-Id: I3e1f3085846ab31326a0a788e7332b5332c10c94
2023-06-19 07:45:02 -04:00
Ashod Nakashian
df898ae3a3 wsd: more CSP refactoring
Change-Id: Id7a31fbd2e804de758abb31ebb32e419a2955194
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit c1b19c0ae6b5148dee1517dfce19de5cfa27b9d5)
2023-06-19 07:45:02 -04:00
Ashod Nakashian
cefc71b198 wsd: add ContentSecurityPolicy manager
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 995c24345eeedc7cbd9e81f9b6c151e79b695fdc)

Change-Id: I75d6da58019d218a121bdf7bc72e73dd0f320216
2023-06-19 07:45:02 -04:00
Ashod Nakashian
fa3887ad4a killpoco: replace URI::encode with our wrapper
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 3e8deb33c6459634a6ce111bfa1d01f21f04a30a)

Change-Id: I959e7943ec291f04c03237f9550ccaecf5a81aa7
2023-06-19 07:45:02 -04:00
Ashod Nakashian
d221ac276b wsd: simplify frame-ancestor handling
Change-Id: I1ae8443a8a09b485a89b69a2d25d2efc49c34a52
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit c317090f4c9ba4fa1a5521bc5b31a48dfafd2516)
2023-06-19 07:45:02 -04:00
Ashod Nakashian
9e8238310c make: failing jail cleanup is not fatal
In some cases jail cleaning up may fail.
In such a case, we still want to be able
to build a fresh set of binaries, which
are used to run coolwsd --cleanup.

Since cleaning up the jails and the
systemplate are not strictly required
to building, we now only emmit a warning
and move on.

Change-Id: I4ebf7772cf767b579810247c427d86efa5a6d3ad
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-19 07:45:02 -04:00
Darshan-upadhyay1110
f59dd62f6f 23.05 - Android : tapping on cells flickers the keyboard
Added condition for focus on textarea so ot will handle the keyboard in mobile view to stop flicker.
Signed-off-by: Darshan-upadhyay1110 <darshan.upadhyay@collabora.com>
Change-Id: I8cb6211a3605503f4144a3c48e059960cf461617
2023-06-19 12:48:18 +02:00
Pedro Pinto Silva
7bbdf7c530 Spelling dialog icon not found
addmb-menu corresponding to add to dictionary seems to be a dropdown
that is not enabled in online. And we do hide the main component by
making use of hidden class. Nevertheless, and even though that is
never visible, we keep getting the file not found in the console.
  - better to add an generic alias for that file so to avoid that error

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: Ic9ad2d9cb07fa1f496166d3653bbf81de3f310d0
2023-06-19 10:11:11 +02:00
Michael Meeks
1cf561d0ef Restore commit 80b4e6d4ae
Remove un-necessary gating of wakeup() on stop un-related to
callbacks or new sockets.

This reverts commit 25f2581a30.

Change-Id: I9f9f30fed34c973b86206677168071abb81afa6f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-16 16:08:42 +01:00
codewithvk
3e287a5968 Fix: Annotations, comments on hover
Change-Id: I3a1e9473cabc9df2b33e3b99168f9698d1beb86c
Signed-off-by: codewithvk <vivekpatel7202@gmail.com>
2023-06-16 14:01:37 +02:00
Pranam Lashkari
1eb8b9c63f impress: arrange slide/hide show menu entries better
added slide hide/show option in presentation bar
rearranged icons to align them with core UI

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ic4b121ab5d9ab21d8f48e68bb07e51a31442586e
2023-06-16 10:48:54 +02:00
Caolán McNamara
d297bccb9a "throttled" move events can be processed after moveEnd
We throttle the "move" event, but in moveEnd we always call
a _move anyway, so if there are throttled moves still
pending by the time moveEnd is called then there is no point
processing them after _moveEnd because we are up to date
already when they arrive and to do would just duplicate tile
requests

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I15c6fe5f0f1b6171a299a4519138912000dd9b68
2023-06-16 09:29:58 +01:00
Andras Timar
4ac8c8ee28 configure option to disable building unit tests
rational: building for release takes a lot of time and we
neither package, nor run (most of) these unit tests when
we make packages.
CI runs all of these tests before merging PRs, so risk is low,
if we do not run the few build-time unit tests when we package.

make -j12
--enable-tests (default): 3m 18s
--disable-test: 1m 9s
3x faster...

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I4edd98af55748432e30c65c4c910e72c0221272a
2023-06-16 09:12:21 +02:00
Gökay Şatır
a75fa06923 Use native handlers for click and doubleclick events.
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: Ieab3c17f1772a2f47fc519b8cc031c1cf50dfa52
2023-06-16 08:25:23 +03:00
Henry Castro
6c5d8f287d browser: improve _preventNonNumericalInput function
Only Chrome browser validate number inputs if it is
defined the attribute <input type="number">.

Unfortunately, it is not possible to get the cursor p
osition to validate too.

Change-Id: I73ef692498caa348a5b8d376cbfcfca0c146816b
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-06-15 18:03:04 -04:00