Commit graph

21160 commits

Author SHA1 Message Date
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
30d088b9bb refactor to isolate where we extract pixels
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0772a786fe67dfac8200f1b9ee75f2ba5d9a2e82
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
Pedro Pinto Silva
378f96433a Dialog: don't ignore label's padding (ui-text)
Before this 8a0c8c44a7 was not being
applied furthermore better to specifically set this to only affect
labels within dialog content (since jsdialog class is also in many
other places such as sidebar and widgets)

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: Ic1cb825d6c70858a4c49123243866eaf0a6a8e50
2023-06-23 12:56:55 +02:00
Pranam Lashkari
a9b66a0adc impress: mark multiple slides as hidden or show
when user hide or show multiple selected slide,
slides were actually hidden or shown but previews did not reflect that,
only first selected preview was marked as performed action

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ie0c2eea8442feb0a4340551a63d8d39932adad3c
2023-06-23 11:48:09 +02:00
Pranam Lashkari
b49adc9534 impress: do not start slide show if all slides are hidden
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I81ea189b143ce4ad60cac02bfce5898ce9bacd4a
2023-06-23 11:48:01 +02:00
Gülşah Köse
518fb36699 Show the context menu on click empty parts of slides pane
Show New Slide and Paste (if clipboard is not empty) on context menu
when the user cliked on the empty parts of the slides pane.

Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com>
Change-Id: I3d009499cc4400612f1246c28ce5478b80469428
2023-06-23 10:35:22 +02:00
Pedro Pinto Silva
9127173d83 Dark mode: Welcome dialog, use css vars and fix it for dark mode
Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: Id68a28615b0c245d7136eab50bbf0fc8b490ccc3
2023-06-23 08:15:35 +02:00
Szymon Kłos
722d538d15 Pass ui_theme to welcome dialog
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I19270ad653540b72f5606554848eed88bded8333
2023-06-23 08:15:35 +02:00
Pedro Pinto Silva
c51b63510f Welcome: Refactoring: fix indentations and quotes
Avoid linting problems
- Use tabs as indentations
- use single quotes

All per browser/.eslintrc and browser/.stylelintrc.json

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I1bbd425b7aaf39bca3f8d18da5092b7e27e41624
2023-06-23 08:15:35 +02:00
Patrick Luby
8e6a858904 Limit memory usage of internal log storage.
Otherwise it could grow without bound; now limited to 100 entries,
each of <128 characters.

Change-Id: I6a1b96a8cb6a67f991c3870f5b724989f65e0e74
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:28:43 -04:00
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