[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 30 19:25:04 UTC 2020
sw/source/core/layout/trvlfrm.cxx | 61 +++++++++++++++++++-------------------
1 file changed, 31 insertions(+), 30 deletions(-)
New commits:
commit d7c123efdf0870dd8ca7e0f4e2a5648b024cd36d
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jul 29 14:55:49 2020 +0200
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jul 30 21:24:28 2020 +0200
(related: tdf#134252) sw: fix assert when moving mouse pointer
SwPageFrame::GetModelPositionForViewPoint() was calling GetCharRect() on
a frame that doesn't match the passed prevTextPos; it was supposed to be
initialised by GetModelPositionForViewPoint() call but that didn't work
because the point was outside the frame so nothing was inited.
(regression from edd2db1c783bd571ff796a5298385cacc91877b9)
Change-Id: Ic064c3efc1b7f29d18d713206e5ea5ac0b67fbc8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99692
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 63308aa3b109271ffb4fd47e9fea2e3281a1552d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99780
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 8cb591d05026..9079d0a9cbab 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -289,42 +289,43 @@ bool SwPageFrame::GetCursorOfst( SwPosition *pPos, Point &rPoint,
comphelper::FlagRestorationGuard g(
pState->m_bPosMatchesBounds, true);
SwPosition prevTextPos(*pPos);
- SwLayoutFrame::GetCursorOfst(&prevTextPos, aPoint, pState);
-
- SwRect aTextRect;
- pTextFrame->GetCharRect(aTextRect, prevTextPos);
-
- if (prevTextPos.nContent < pContentNode->Len())
+ if (SwLayoutFrame::GetCursorOfst(&prevTextPos, aPoint, pState))
{
- // aRextRect is just a line on the left edge of the
- // previous character; to get a better measure from
- // lcl_getDistance, extend that to a rectangle over
- // the entire character.
- SwPosition const nextTextPos(prevTextPos.nNode,
- SwIndex(prevTextPos.nContent, +1));
- SwRect nextTextRect;
- pTextFrame->GetCharRect(nextTextRect, nextTextPos);
- SwRectFnSet aRectFnSet(pTextFrame);
- if (aRectFnSet.GetTop(aTextRect) ==
- aRectFnSet.GetTop(nextTextRect)) // same line?
+ SwRect aTextRect;
+ pTextFrame->GetCharRect(aTextRect, prevTextPos);
+
+ if (prevTextPos.nContent < pContentNode->Len())
{
- // need to handle mixed RTL/LTR portions somehow
- if (aRectFnSet.GetLeft(aTextRect) <
- aRectFnSet.GetLeft(nextTextRect))
+ // aRextRect is just a line on the left edge of the
+ // previous character; to get a better measure from
+ // lcl_getDistance, extend that to a rectangle over
+ // the entire character.
+ SwPosition const nextTextPos(prevTextPos.nNode,
+ SwIndex(prevTextPos.nContent, +1));
+ SwRect nextTextRect;
+ pTextFrame->GetCharRect(nextTextRect, nextTextPos);
+ SwRectFnSet aRectFnSet(pTextFrame);
+ if (aRectFnSet.GetTop(aTextRect) ==
+ aRectFnSet.GetTop(nextTextRect)) // same line?
{
- aRectFnSet.SetRight( aTextRect,
- aRectFnSet.GetLeft(nextTextRect));
- }
- else // RTL
- {
- aRectFnSet.SetLeft( aTextRect,
- aRectFnSet.GetLeft(nextTextRect));
+ // need to handle mixed RTL/LTR portions somehow
+ if (aRectFnSet.GetLeft(aTextRect) <
+ aRectFnSet.GetLeft(nextTextRect))
+ {
+ aRectFnSet.SetRight( aTextRect,
+ aRectFnSet.GetLeft(nextTextRect));
+ }
+ else // RTL
+ {
+ aRectFnSet.SetLeft( aTextRect,
+ aRectFnSet.GetLeft(nextTextRect));
+ }
}
}
- }
- nTextDistance = lcl_getDistance(aTextRect, rPoint);
- bValidTextDistance = true;
+ nTextDistance = lcl_getDistance(aTextRect, rPoint);
+ bValidTextDistance = true;
+ }
}
double nBackDistance = 0;
More information about the Libreoffice-commits
mailing list