Bug 118716 - Inner border of an embedded table can't be dragged around
Summary: Inner border of an embedded table can't be dragged around
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.1 rc
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.2.0 target:6.1.1 target:6.1.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2018-07-12 10:05 UTC by Telesto
Modified: 2018-07-27 08:07 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (8.26 KB, application/vnd.oasis.opendocument.text)
2018-07-12 11:21 UTC, Telesto
Details
Bibisect log (2.91 KB, text/plain)
2018-07-13 12:44 UTC, Telesto
Details
Screencast for clarification (691.35 KB, video/x-matroska)
2018-07-18 16:57 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2018-07-12 10:05:20 UTC
Description:
Inner border of an embedded table can't be dragged around

Steps to Reproduce:
1. Open attached 1435021
2. Select the embedded table
3. Open table properties
4. Change the alignment to left
5. Set Spacing Right to -2.7 (preferably with the buttons) & Press OK
6. Try to drag the inner border -> Broken 
7. Reopen the table properties dialog
8. Change the alignment automatic & back to left (dialog problem already reported)
9. Check relative checkbox & Press OK
10. Try to drag the inner border -> still not possible
11. Save the file & reload -> Inner border will move & and everything is back to normal

Actual Results:
Inner border of an embedded table can't be dragged around

Expected Results:
Should be possible. At least checking relative should make things work again (instead of save and reload)


Reproducible: Always


User Profile Reset: No



Additional Info:
Repro with
Version: 6.2.0.0.alpha0+
Build ID: bb1d5780226bb1b9156580972eea9aa849178742
CPU threads: 4; OS: Windows 6.3; UI render: GL; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-07-03_05:56:48
Locale: nl-NL (nl_NL); Calc: CL

but not with
Versie: 4.4.7.2 
Build ID: f3153a8b245191196a4b6b9abd1d0da16eead600
Locale: nl_NL
Comment 1 Telesto 2018-07-12 10:08:23 UTC
No repro with
Version: 6.0.0.1.0+
Build ID: 47cc374c0659fd3db74a1b184c870eaa56bc385b
CPU threads: 4; OS: Windows 6.3; UI render: GL; 
Locale: nl-NL (nl_NL); Calc: CL
Comment 2 Telesto 2018-07-12 11:21:08 UTC
Created attachment 143513 [details]
Example file
Comment 3 Telesto 2018-07-13 12:44:12 UTC
Created attachment 143534 [details]
Bibisect log

Bisected to
author	Noel Grandin <noel.grandin@collabora.co.uk>	2018-01-08 17:01:49 +0200
committer	Noel Grandin <noel.grandin@collabora.co.uk>	2018-01-11 07:35:43 +0100
commit f14b9d30293f180500fc56d81e5390021758e7c1 (patch)
tree a6cd0b853169203cfa0953230e6774e7b1dd81b4
parent d11120b95ee27cb4b05db466ed07f7a996dda125 (diff)
convert (a>b?a:b) to std::max(a,b)
with something like:
   git grep -nP '(.*)\s*>\s*(.*)\s*\?\s*\g1\s*:\s*\g2'
Comment 4 Telesto 2018-07-18 15:46:44 UTC
@Dieter
Could you verify this one. It's blocking me from using LibO6.1 ;-).  It does happen quite often in daily usage (this report is mere an illustration) Thanks!
Comment 5 Xisco Faulí 2018-07-18 16:57:02 UTC
Reproduced in

Version: 6.2.0.0.alpha0+
Build ID: 95b00f1bfa341003af23e150d316d943d47909cf
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

I also confirmed it's a regression from https://cgit.freedesktop.org/libreoffice/core/commit/?id=f14b9d30293f180500fc56d81e5390021758e7c1

Adding Cc: to Noel Grandin
Comment 6 Xisco Faulí 2018-07-18 16:57:31 UTC
Created attachment 143625 [details]
Screencast for clarification
Comment 7 Xisco Faulí 2018-07-18 18:56:20 UTC
Hi Noel,
This reversion fixes the issue:

--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1699,9 +1699,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
                 const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
                 const int nRgt = (bTableVertical ? nPageHeight : nPageWidth) -
                                  (aTabCols.GetLeftMin() + aTabCols.GetRight());
-
-                const sal_uInt16 nL = std::max< sal_uInt16 >(nLft, 0);
-                const sal_uInt16 nR = std::max< sal_uInt16 >(nRgt, 0);
+                const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
+                const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
 
                 SvxColumnItem aColItem(nNum, nL, nR);

However, your change seems correct...
Comment 8 Noel Grandin 2018-07-18 19:19:10 UTC
Xisco, your change is correct, my patch was inadvisable.

In this code
   int a;
   std::max<sal_uInt16>(a,0)
std::max will first convert a and b to sal_uInt16, therefore potentially converting a negative number to a positive number due to the conversion rules. Then it will take the larger number.

While this code
    int a;
    static_cast<sal_uInt16>(a > 0 ? a : 0)
will compare first, and then convert the larger number to sal_uInt16, which might result in making a "a" that is larger than 2^16 into a smaller value, but which will never convert a negative "a" value into a positive value.
Comment 9 Xisco Faulí 2018-07-18 19:47:03 UTC
Hi Noel,
Thanks for the nice clarification.
In your initial commit, I see 3 or 4 places where static_cast<sal_uInt16> was converted to std::max< sal_uInt16 >, should they be reverted just in case as well?

Would you mind providing a fix for this issue, or should I do it ?
Comment 10 Commit Notification 2018-07-23 14:36:53 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c13865a4caf7898c4e59a5b22bbd493d6dad9661

tdf#118716 Inner border of an embedded table can't be dragged around

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Xisco Faulí 2018-07-24 10:09:25 UTC
Verified in

Version: 6.2.0.0.alpha0+
Build ID: dcbb65f2a4a3ee70ccd4896d7a5e975dbd9e6509
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

@Noel, Thanks for fixing this!!!
Comment 12 Telesto 2018-07-24 10:22:18 UTC
Many thanks for fixing this! And more in general for all the useuniqueptr work :-)
Comment 13 Commit Notification 2018-07-24 13:14:34 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=af7b9609fee603756f8cb0668ae45af37c5fb4fb&h=libreoffice-6-1

tdf#118716 Inner border of an embedded table can't be dragged around

It will be available in 6.1.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2018-07-27 08:07:57 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-6-1-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5e013eab178df3a27fe036230c80611dd1dccc7d&h=libreoffice-6-1-0

tdf#118716 Inner border of an embedded table can't be dragged around

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.