diff options
author | Justin Luth <justin.luth@collabora.com> | 2018-06-01 08:55:26 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2018-06-14 06:30:33 +0200 |
commit | 9c18b25f19855709cf4adddeefe4c9765f2f4f4f (patch) | |
tree | e6139b75ba188775e50582a7c187f166ba75c7f2 | |
parent | e10cd7f66af779347f428425f89fdd225ba5cc2e (diff) |
tdf#109190 sd MakeVisible: fix flattened loop logic error
There is a bug in the conversion from
while(rRect.Bottom() > aNewPos.Y() + aVisAreaSize.Height())
to
const long distBottom(rRect.Bottom() - aNewPos.Y() + aVisAreaSize.Height());
While the bottom of the object is lower on the page than
the visual Top position plus the height of the screen,
(in other words, it isn't in the visible range of the screen),
move the screen down by the size of the object and try again.
The loop could first be finished when the shape bottom is
exactly at the bottom of the screen:
rRect.Bottom() = aNewPos.Y() + screen Height.
or rRect.Bottom() - (aNewPos.Y() + aVisAreaSize.Height()) = 0
or rRect.Bottom() - aNewPos.Y() - aVisAreaSize.Height() = 0
Change-Id: I762a39df3cdcd5689c8f6742797a9f7b38ddb384
Reviewed-on: https://gerrit.libreoffice.org/55156
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
(cherry picked from commit 13328a36d68c4141219d9cc549e6d76e108e6076)
Reviewed-on: https://gerrit.libreoffice.org/55393
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sd/source/ui/view/drviewsh.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx index e8b4d3185a58..40454bc331c6 100644 --- a/sd/source/ui/view/drviewsh.cxx +++ b/sd/source/ui/view/drviewsh.cxx @@ -133,7 +133,7 @@ void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rW } else { - const long distRight(rRect.Right() - aNewPos.X() + aVisAreaSize.Width()); + const long distRight(rRect.Right() - aNewPos.X() - aVisAreaSize.Width()); if(distRight > 0) { @@ -178,7 +178,7 @@ void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rW } else { - const long distBottom(rRect.Bottom() - aNewPos.Y() + aVisAreaSize.Height()); + const long distBottom(rRect.Bottom() - aNewPos.Y() - aVisAreaSize.Height()); if(distBottom > 0) { |