[Libreoffice-commits] core.git: sd/source

Justin Luth justin.luth at collabora.com
Wed Jun 6 18:12:47 UTC 2018


 sd/source/ui/view/drviewsh.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 13328a36d68c4141219d9cc549e6d76e108e6076
Author: Justin Luth <justin.luth at collabora.com>
Date:   Fri Jun 1 08:55:26 2018 +0300

    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 at sil.org>
    Tested-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>

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)
                 {


More information about the Libreoffice-commits mailing list