From b22d4785310eac35696df771803dfba0871a50ac Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 17 Sep 2021 21:49:21 +0200 Subject: clean up ambiguous confusing rectangle APIs like IsInside() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reading 'rectA.IsInside( rectB )' kind of suggests that the code checks whether 'rectA is inside rectB', but it's actually the other way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(), which should make it clear which way the logic goes. Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271 Reviewed-by: Noel Grandin Reviewed-by: Luboš Luňák Tested-by: Jenkins --- toolkit/source/awt/vclxaccessiblecomponent.cxx | 2 +- toolkit/source/hatchwindow/ipwin.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 101307bf1d96..b13eeb1ade52 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -667,7 +667,7 @@ uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessi { tools::Rectangle aRect = VCLRectangle( xComp->getBounds() ); Point aPos = VCLPoint( rPoint ); - if ( aRect.IsInside( aPos ) ) + if ( aRect.Contains( aPos ) ) { xChild = xAcc; break; diff --git a/toolkit/source/hatchwindow/ipwin.cxx b/toolkit/source/hatchwindow/ipwin.cxx index b21a3271e3e5..227d0a661aa2 100644 --- a/toolkit/source/hatchwindow/ipwin.cxx +++ b/toolkit/source/hatchwindow/ipwin.cxx @@ -179,12 +179,12 @@ short SvResizeHelper::SelectMove( vcl::Window * pWin, const Point & rPos ) { std::array aRects = FillHandleRectsPixel(); for( sal_uInt16 i = 0; i < 8; i++ ) - if( aRects[ i ].IsInside( rPos ) ) + if( aRects[ i ].Contains( rPos ) ) return i; // Move-Rect overlaps Handles std::array aMoveRects = FillMoveRectsPixel(); for(const auto & rMoveRect : aMoveRects) - if( rMoveRect.IsInside( rPos ) ) + if( rMoveRect.Contains( rPos ) ) return 8; } else -- cgit