summaryrefslogtreecommitdiff
path: root/vcl
AgeCommit message (Collapse)Author
2023-06-16tdf#146547 sfx2: allow read-only documents to be modifiedMichael Stahl
This is particularly useful for a Writer document that contains a section that is set to be editable in a read-only document, so that the user is warned when closing such a document without saving it. Originally this check was added in commit 27db57efc51487b3976fbf73df1868b8fb78d201 "CWS fwkbugfix05" "#i39869#: readonly docs should never become modified" but the actual problem there was that the read-only document was displayed in a wizard dialog, not in a document view, so let's instead check that the document is some kind of "internal" document. Also the dialog's Save button should do something, and since the document is read-only, a Save As dialog appears appropriate. Change-Id: I339cbe92a2c9eb74a1f5061246f921037a47f79c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153180 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-06-16ofz#59854 Null-dereference WRITECaolán McNamara
Change-Id: Iedbf21248b7d75474ea325905569d192360380f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153155 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-15Use sal_Int32 instead of overzealous use of autoKhaled Hosny
Change-Id: Ia307f398260343fe388965673da42d9404195224 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153117 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-15tdf#155161: Add testKhaled Hosny
The test document embeds Cantarell font because we don’t bundle any fonts with CFF2 table (or CFF table for that matter). Change-Id: Icdbab58ea3999baa75bc85fad60172218d9f6058 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153054 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-15Don’t add empty Fonts dictionary to Type 3 font resourcesKhaled Hosny
If the Type 3 font does not use any other fonts, skip writing Fonts to its Resources dictionary. Change-Id: I1d0489debeb9f0e24022316551eb234b279381c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153100 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-14Make encodeForXml accessible for other modulesSzymon Kłos
and share similar code Change-Id: I7729a46d40845893f577c273c1ab340f69ebb51b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151230 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151754 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-14Remove duplicate constants relating to PNGsParis Oplopoios
The PNG signature constant was defined in multiple places Change-Id: Ia90636819341295129a37a91199857a612d62177 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153032 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
2023-06-14ofz#59817 Heap-buffer-overflow READ 8Caolán McNamara
Change-Id: I442d103c7103c0bd88dd7fdefd44c3274a9c80fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153038 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-14Fix typoAndrea Gelmini
Change-Id: I042c738e5d6e037a8c658a02cbfaef8f1d23799e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152999 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-14Fix heap-buffer-overflow in vcl/PngImageReaderJulien Nabet
From Jenkins_Linux_Ubsan: 25488 ==1050==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030001a44a4 at pc 0x0000004b6b04 bp 0x7ffed00d4630 sp 0x7ffed00d3de0 25489 WRITE of size 24 at 0x6030001a44a4 thread T0 25490 #0 0x4b6b03 in __asan_memcpy /home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22 25491 #1 0x7f3dab812b94 in SvStream::ReadBytes(void*, unsigned long) /tools/source/stream/stream.cxx:1134:17 25492 #2 0x7f3da1fc7a8a in (anonymous namespace)::getImportantChunks(SvStream&, SvStream&, unsigned int, unsigned int) /vcl/source/filter/png/PngImageReader.cxx:270:27 25493 #3 0x7f3da1fb7364 in (anonymous namespace)::reader(SvStream&, Graphic&, GraphicFilterImportFlags, vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &(Bitmap::AcquireWriteAccess())>*, vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, &(AlphaMask::AcquireAlphaWriteAccess())>*) /vcl/source/filter/png/PngImageReader.cxx:714:13 25494 #4 0x7f3da1fb9663 in vcl::PngImageReader::read(Graphic&) /vcl/source/filter/png/PngImageReader.cxx:830:55 25495 #5 0x7f3d8299c092 in PngFilterTest::testApng() /vcl/qa/cppunit/png/PngFilterTest.cxx:380:32 ... since bf944e33569e4a1d6236a54671b7320cdc6ffaf6 tdf#104877 Add basic APNG format support Change-Id: Ib46637a8422e1fbb1ab84ee69bf6f95299dd84a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153003 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-13tdf#153440: Add testKhaled Hosny
Change-Id: I0c036cd1d8022e6ff265aa67ab177c57eba0c4ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152934 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-13When adding application fonts, add them also to FontConfigKhaled Hosny
This way FontConfig can use them for missing chars font fallback. Change-Id: I63be8a62db9bdacc83be2327555c558d4cd476bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152954 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-13cid#1532379 Untrusted loop boundCaolán McNamara
and cid#1532378 Untrusted loop bound Change-Id: I06f9267f02a6f41559d617c1a43671d4a8234350 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152964 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-13tdf#147021: vcl/* KeyboardReplacements SAL_N_ELEMENTS removalDr. David Alan Gilbert
A couple more tables using SAL_N_ELEMENTS. (I do wonder why these are separate). Note, I've not attacked the 'for' use of SAL_N_ELEMENTS in these files since they require some separate thinking about their indexing. Change-Id: I7fe66510fce7d59bda34b1f22417a2fb6070b065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152775 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-13tdf#155794 vcl: handle WM_GETOBJECT without SolarMutexMichael Stahl
SalFrameWndProc() handles WM_GETOBJECT by acquiring SolarMutex and calling ImplHandleGetObject(), which again acquires the SolarMutex inside Application::SetSettings(). This was introduced with commit db214684057e3ff2fa32d57c00507309dd6c24d6 due to thread-safety crashes but it turns out that it can be problematic. When loading a document on a non-main thread, WinSalFrame::SetTitle() calls SetWindowTextW which is equivalent to SendMessage(WM_SETTEXT), while holding SolarMutex, and if the main thread doesn't finish processing it then that's a deadlock. Typically Desktop::Main() has already created the mxAccessBridge, so ImplHandleGetObject() most likely doesn't need to do it, so just skip the Settings code there in case the SolarMutex is locked by another thread. In case the SolarMutex is locked by another thread, do an unsafe read of ImplGetSVData()->mxAccessBridge - this should work until ImplSVData is deleted, by which time no Windows should exist anymore that could be receiving messages. This fixes part of the problem, winaccessibility also needs to stop using SolarMutex. Change-Id: I62b027ad06d2c3eb06a5f64b052a4acd0908f79c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152958 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-06-13tdf#155376 weakly cache ScAccessibleCellNoel Grandin
the macOS accessibility framework repeatedly queries and enumerates all of the visible cells. Every time this happens we create a new set of ScAccessibleCell, which then live until the application shuts down, which then causes a very slow shutdown. So I fix the problem by caching the ScAccessibleCell so we return the same one for a given cell position. Of course, this begs the question of why the ScAccessibleCell objects are not dying when we create new ones, which means we have some kind of leak or lifecycle problem somewhere, but anyhow, this is a fairly simple and comprehensive fix. Change-Id: Id2765236ac4524f490a51b56268fb8038612fd43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152932 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-13tdf#152048: Fix measuring text width with font fallbackKhaled Hosny
This is a regression from: commit 43a5400063b17ed4ba4cbb38bdf5da4a991f60e2 Author: Khaled Hosny <khaled@libreoffice.org> Date: Thu May 25 10:59:18 2023 +0300 tdf#152048: Fix underline width for Kashida-justified text It fixed measuring width when there is Kashida justification, but broke it for font fallback, because of the way MultiSalLayout measures the text width takes the maximum of the text widths for all its layouts, but layouts with missing glyphs are now giving wrong text width as they are measuring the width of .notdef (GID 0) glyph. This change makes MultiSalLayout measure the text width by iterating over all its valid glyphs. Change-Id: I8b19e0d44326c6f0afe6e504ab6d90c6fb3575f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152933 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-13tdf#152048: Add testKhaled Hosny
Change-Id: I321e9f400b0d96b9c3193547f184342ce0c69f7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152907 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-13CppunitTest_vcl_text: use CPPUNIT_TEST_FIXTURE()Khaled Hosny
Change-Id: Ia1264ea7c5c2208d97427568166c6b12c6d89179 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152905 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-13CppunitTest_vcl_text: use CPPUNIT_TEST_FIXTURE()Khaled Hosny
Change-Id: I3e2f0c2de284d1187e3389387a4a1cc3f0d0896c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152904 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-12ofz#59762 Out-of-memoryCaolán McNamara
this one is a writable SvMemoryStream so Seek(Rel) will attempt to resize if the destination is outside the current size Change-Id: I1f29531979ced103c51bd423ea0d5665f2b5bdb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152895 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-12ofz#59759 Null-dereference READCaolán McNamara
since: commit bf944e33569e4a1d6236a54671b7320cdc6ffaf6 Date: Mon Feb 6 14:19:41 2023 +0200 tdf#104877 Add basic APNG format support Change-Id: I45080e226f0ad4ccb99b6285c77ed19b702b74d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152893 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-12Fix hanging when selecting a column or row in CalcPatrick Luby
When a Calc column is selected, the child count will be at least a million. Constructing that many C++ Calc objects takes several minutes even on a fast Silicon Mac so apply the maximum table cell limit here. Change-Id: I4e3ebf9fdf7367620313e4e10dd0918de9d6bffb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152853 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-06-11tdf#154168 Export no transparency PNGs correctlyParis Oplopoios
When bTranslucent was false the function would simply return, causing a 0 byte png. Now we just remove the alpha channel. Change-Id: Ie2578185ac12fb38b6f1b674758e564721e3973f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152840 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
2023-06-10Fix typoAndrea Gelmini
Change-Id: I797bf9d49d1a0f2cd4d9c523a46bb6ed979581e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152841 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-10Revert "tdf#151968: Fix vertical position of RTL spelling wavy line"خالد حسني
This reverts commit 5899b27e71430e490c2d3a6b87ae52c10f383ba7. Reason for revert: tdf#155001 Change-Id: I95d21689a50f6413a7b5c126d6eb6b2c8802fbc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152752 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-10tdf#104877 Add basic APNG format supportParis Oplopoios
Add basic APNG (animated PNG) format support that can correctly display simple files with no transparency Change-Id: Ibfb6e13953a8ba48a535a40b08792b3723b7dc0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140089 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-06-09trimMemory - fix crash modifying structure during clear.Michael Meeks
Re-use existing code from shutdown, to avoid ~Bitmap mutating maScaleCache while we're iterating it inside clear. Change-Id: I021d9075cf5c449702af091c2c8a4de64887f2ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152769 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-09Related: CollaboraOnline#6511 cairo backend can do transparent textCaolán McNamara
and avoid the extra work required here for the generic case. keep the transparency helper for the other backends, or any case where we may be recording to metafile, or pdf export etc Change-Id: Ic01b8b69f2d59e585605ce1e981298fda9185824 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152719 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-06-09MCGR: tdf#155479 repair gradient SVG export for MCGRArmin Le Grand (allotropia)
Unfortunately SVG export is based on metafiles and thus there is (in principle) no way to get the BGradient/ColorStop/MCGR data transfered as needed. For that, using UNO API to read the model or using B2DPrimitives would help - as is better for the export respectively. Since there is not the time to re-design SVG export I added this 'compromize' as a fix. It gets the needed data transported over the metafile (that part is the compromize). It then exports the MCGR data to SVG (at least - as was already there - if it's a linear/axial gradient). This happens now with all Gradient Stops when there is a MCGR gradient. That part is/will hopefully be re-usable if SVG export gets redesigned. I also added a handling for StepCount feature, so when used (in LO, others do not have that) 'hard' color stops get generated to make the gradient look identical for SVG export. Had to make adding of that extra-information in metafiles dependent on exporting really to SVG. There are 51 cases which use 'MetaActionType::COMMENT' which would potentially have to be adapted. Also added code to solve the problem for TransparencePrimitive2D at VclMetafileProcessor2D::processTransparencePrimitive2D. This will now - also only for SVG export - directly create the needed MetaFloatTransparentAction and add additional MCGR information. This will be used on SVG export to write a 'Mask' as was done before. This is now capable of creating fill MCGR-Masks in the sense that any number of TransparencyStops will be supported. Change-Id: Ic6d022714eae96b8fbc09e60652851ac5799b757 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152623 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-06-08Fix iOS build breakagePatrick Luby
Two new functions that are used only on macOS were added in commit 75dc3a54fca8b2dc775ba007190d8c2e188f1c0a. Change-Id: I18d0f7aaa9d1ca6634b13eafc76b4fd39dfa52ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152771 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-06-08pdfium: better suport for annotations and some fixesJaume Pujantell
Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152606 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
2023-06-07Partial fix tdf#155376 use NSAccessibilityElement instead of NSViewPatrick Luby
On macOS, accessibility is implemented by creating a native NSView for each C++ accessible element. The problem with using an NSView for each element is that NSViews are very slow to add to or remove from an NSWindow once the number of NSViews is more than a thousand or so. Fortunately, Apple added a protocol that allows adding a native accessible element using the lightweight NSAccessiblityElement class. The topmost NSAccessiblityElement elements are connected to the single SalFrameView in each NSWindow but since NSAccessiblityElements are not NSViews, they are not connected to any of NSWindow's event or draw dispatching. This makes NSAccessiblityElements significantly faster to add to or remove from an NSWindow with no apparent loss in functionality. Note: this change is a subset of the LibreOffice 4.4 code changes that I wrote for NeoOffice. Change-Id: I408108d57217db407512dfa3457fe26d2ab455de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152717 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Patrick Luby <plubius@neooffice.org>
2023-06-07tdf#155376 partially convert SvCTLOptions to officecfgNoel Grandin
When accessibility is enabled, Calc will add tens of thousands of listeners. We then spend a significant chunk of time creating SvCTLOptions objects (attached to ImpEditEngine) and adding and removing those objects from the related listener lists. But the required information is already globally cached by the officecfg module, so we can avoid that overhead and just fetch it directly from officecfg. Change-Id: I7ff55fd7c4926866eb7086812275ba8bd6e84c75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152645 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-06perf: we don't need to 'really' insert a preview when providing jsonCaolán McNamara
if we have intercepting 'image' when generating the json, then we don't need to really insert the image into the server side TreeView at all, we just need to provide it in the client json payload. so we generate each bitmap once, and its base64 png representation once. Change-Id: I1b6916b036a0b84ef4346ebf2141240c4ae5b706 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152675 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-06perf: cache the generated json for an iconview imageCaolán McNamara
before: |--13.95%--JSDialogNotifyIdle::Invoke | | | |--13.01%--JSDialogNotifyIdle::generateWidgetUpdate | | | | | |--11.03%--IconView::DumpAsPropertyTree | | | lcl_DumpEntryAndSiblings (inlined) | | | | | | | |--10.94%--extractPngString (inlined) after: |--4.86%--JSDialogNotifyIdle::Invoke ... | |--2.90%--JSDialogNotifyIdle::generateWidgetUpdate | | | | | |--0.76%--IconView::DumpAsPropertyTree | | | IconView::DumpEntryAndSiblings | | | Link<std::tuple<tools::JsonWriter&, rtl::OUString const&, std::basic_string_view<char, std::char_traits<char> > > const&, bool>::Call (inlined) | | | StylesPreviewWindow_Base::DoJsonProperty | | | | | | | |--0.55%--StylesPreviewWindow_Base::GetCachedPreviewJson Change-Id: Id234a84e36710794822945584be3adf028808625 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152630 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-05Revert "tdf#155676: Use colon in FontsUseWinMetrics config key"خالد حسني
This reverts commit a38e1537cd06367783a43cc8d3b0e8d674b6e142. Change-Id: Ic72f1acb7e38209e9b87a8fe80a39acb1eeacfe4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152547 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-05tdf#155676: Use colon in FontsUseWinMetrics config keyKhaled Hosny
The use of comma breaks editing in Expert Configuration dialog, so users effectively can’t use this. After editing <it>Celticmd,1571,-567,1571,-547,2126,559</it> becomes <it>Celticmd</it><it>1571</it><it>-567</it><it>1571</it><it>-547</it><it>2126</it><it>559</it> Using colon instead of comma seems to fix this. Change-Id: I4bba26fe9d94a33e62a0d34c3324daae0845c30b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152597 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-05gtk3 a11y: Consolidate reporting accessible nameColomban Wendling
Just like in I61c4d8d4713b2b82ebb40d9de2a8a773405591ba, avoid the any assumption on what the parent would do in its own implementation, and return ourselves when we mean to. The case of AtkObjectWrapper::get_name() is actually currently fine, because AtkObject::get_name() does what we think it does, and GtkWidgetAccessible doesn't override it, but it's safer not to rely on those assumptions. Change-Id: Ib500d8efa8501206da66c3cca4f6b93bd426cb7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152457 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-06-05gtk3 a11y: Fix reporting accessible descriptionColomban Wendling
AtkObjectWrapper::get_description() sets the AtkObject::description field and chains up to its parent, expecting it to return that member to the caller. This is a questionable assumption, but that's what AtkObject does. However, since f3b0a95f9c2f85604808c21485e46e43aebbbfed which fixed tdf#150496, the direct parent is GtkWidgetAccessible, not AtkObject. And the assumption about returning AtkObject::description doesn't hold then, because GtkWidgetAccessible short-circuits the call if it can't find the associate GtkWidget, which doesn't exist. To fix this, return the member directly when we set it, but leave it to the parent if we don't have anything better in case it could actually do something useful, and because it's customary. Change-Id: I61c4d8d4713b2b82ebb40d9de2a8a773405591ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152456 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-06-03perf: use lighter weight png generation for iconviewCaolán McNamara
before: |--9.50%--JSDialogNotifyIdle::Invoke | | | |--9.33%--JSDialogNotifyIdle::generateWidgetUpdate | | IconView::DumpAsPropertyTree | | lcl_DumpEntryAndSiblings (inlined) | | | | | |--8.99%--extractPngString (inlined) | | | | | | | |--8.21%--GraphicConverter::Export | | | | Link<ConvertData&, bool>::Call (inlined) | | | | GraphicFilter::FilterCallback | | | | GraphicFilter::ExportGraphic after: |--7.50%--JSDialogNotifyIdle::Invoke | JSDialogNotifyIdle::generateWidgetUpdate | IconView::DumpAsPropertyTree | lcl_DumpEntryAndSiblings (inlined) | | | |--7.16%--extractPngString (inlined) | | | | | |--6.84%--vcl::pngWrite Change-Id: Iae34c8bde3e0bbd075252de356f64557fd80c9ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152578 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-02Cannot self-append OUStringBuffer via concatenationStephan Bergmann
a5084d15e1b72e303e1628fbff84432036b014a9 "loplugin:stringadd in vcl" had dropped the intermediary sTemp, but which caused JunitTest_forms_unoapi_1 to fail for me once with > ==2657124==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x50c00086ca58,0x50c00086ca6a) and [0x50c00086ca48, 0x50c00086ca5a) overlap > #0 in __asan_memcpy at ~/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3 > #1 in char16_t* rtl::addDataHelper<char16_t>(char16_t*, char16_t const*, unsigned long) at include/rtl/stringconcat.hxx:80:9 > #2 in rtl::ToStringHelper<rtl::OUStringBuffer>::operator()(char16_t*, rtl::OUStringBuffer const&) const at include/rtl/ustrbuf.hxx:1765:14 > #3 in rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>::addData(char16_t*) const at include/rtl/stringconcat.hxx:195:64 > #4 in rtl::ToStringHelper<rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>>::operator()(char16_t*, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0> const&) const at include/rtl/stringconcat.hxx:207:101 > #5 in rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>::addData(char16_t*) const at include/rtl/stringconcat.hxx:195:88 > #6 in rtl::ToStringHelper<rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>>::operator()(char16_t*, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0> const&) const at include/rtl/stringconcat.hxx:207:101 > #7 in rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0>::addData(char16_t*) const at include/rtl/stringconcat.hxx:195:88 > #8 in rtl::ToStringHelper<rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0>>::operator()(char16_t*, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0> const&) const at include/rtl/stringconcat.hxx:207:101 > #9 in rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0>, char const [4], 0>::addData(char16_t*) const at include/rtl/stringconcat.hxx:195:88 > #10 in rtl::ToStringHelper<rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0>, char const [4], 0>>::operator()(char16_t*, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0>, char const [4], 0> const&) const at include/rtl/stringconcat.hxx:207:101 > #11 in rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0>, char const [4], 0>, rtl::OUStringBuffer, 0>::addData(char16_t*) const at include/rtl/stringconcat.hxx:195:88 > #12 in rtl::OUStringBuffer& rtl::OUStringBuffer::operator=<rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0>, char const [4], 0>, rtl::OUStringBuffer>(rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, rtl::StringConcat<char16_t, char const [3], rtl::OUString, 0>, char const [3], 0>, rtl::OUStringBuffer, 0>, char const [4], 0>, rtl::OUString, 0>, char const [4], 0>, rtl::OUStringBuffer, 0>&&) at include/rtl/ustrbuf.hxx:378:17 > #13 in DoubleCurrencyField::UpdateCurrencyFormat() at vcl/source/control/fmtfield.cxx:1120:20 and e.g. > OUStringBuffer b("a"); > b = "b" + b; > CPPUNIT_ASSERT_EQUAL(OUString("ba"), b.makeStringAndClear()); would indeed easily fail with > equality assertion failed > - Expected: ba > - Actual : bb Change-Id: I3108c18b7c941953a73b5731d9973914b7ba1fbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152495 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-06-02reduce memory overhead of AquaA11yWrapperNoel Grandin
we can allocate this internally, which reduces the number of heap allocations we need to do Change-Id: Id5298e70b6816cd65d8285ceea846dc8e9e4b39d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152489 Reviewed-by: Patrick Luby <plubius@neooffice.org> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-01Related: tdf#155425 use preferred_size instead of allocated_widthCaolán McNamara
the scrollbar might not actually be visible so has no real allocated width yet Change-Id: Id15af9e481b9971bf79f16da16581f820f8303d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152506 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-01tdf#155623: Revert "tdf#155557: Fix drawing mixed direction underlined text"Khaled Hosny
This reverts commit 99d22fd79c5532fd6c1b167996e1c27216b92469. Lets revert and figure out a less radical fix for the original issue. Change-Id: If3025d32019e953b7946ebe4209daf74efc5e15a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152490 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-01tdf#153440: Fix font fallback for surrogate pairs in RTL textKhaled Hosny
When checking for a font that supports the surrogate pair, code was appending code units one by one to string buffer and in RTL case this was happening in reverse order leading to invalid text and consequently failing to find any font that supports it. We now iterate over runs not individual positions, so the text of each individual run maintains its correct order regardless of the direction. Change-Id: Icf2e2aed56512bf907dc6b3c36f387a9e3ad497a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152481 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-01WaE: WhitespaceToSpace() spurious -Werror=maybe-uninitializedCaolán McNamara
vcl/source/helper/strhelper.cxx:366:9: error: ‘pBuffer[-1]’ may be used uninitialized [-Werror=maybe-uninitialized] I see this with gcc 13 too Change-Id: I3ddc5fadb9177827e6cd49f5b6366a79204e95c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152469 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-01tdf#155557: Fix drawing mixed direction underlined textKhaled Hosny
The code here first unsets the underline style, draws the text, then measures the text size, change the text to two blank spaces, sets the measured width back and tries to guess how much space was added by justification, sets the underline style back and then draws again. I have no idea why it is doing it in this highly convoluted way, but this code goes all way back to the initial import. However, it currently fails to account for Arabic justification when the Arabic text does not have any space characters. Instead of trying to guess more how much width the Arabic justification adds, I’m removing this code altogether to let the normal drawing code handle the underline drawing. Lets see what will break. Update text expectation because we now do one-less drawing. Change-Id: I8158bd15370005a78b866c8192414e4b46af2727 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152452 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-05-31vcl: one more nullptr check in Window::GetOutDev()Miklos Vajna
As it was pointed out at <https://gerrit.libreoffice.org/c/core/+/151857/2#message-ced4ba9ebaf5725ec06853682c146211824af158>, it makes little sense to have the nullptr check in the non-const version of Window::GetOutDev() but not have it in the const version, fix this. Change-Id: I2f97938a4015d3ce27e35b9971b65090f7289c11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152429 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-05-30Related: tdf#155542 drop workaround for "XB Roya" issueCaolán McNamara
Change-Id: I8323ae631c13da80cc3f4b8b8826cb9b23e788f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152384 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>