Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 519250

Summary: Wrong bounds used when creating a BaseSlidableAnchor for a NodeFigure with a TransparentBorder
Product: [Modeling] GMF-Runtime Reporter: Laurent Redor <laurent.redor>
Component: GeneralAssignee: Project Inbox <gmf-runtime-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: pierre-charles.david
Version: unspecified   
Target Milestone: 1.13.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/100751
https://git.eclipse.org/r/100750
https://bugs.eclipse.org/bugs/show_bug.cgi?id=519305
https://git.eclipse.org/c/gmf-runtime/org.eclipse.gmf-runtime.git/commit/?id=022b1730e7fb715cd27e48ffb89b6880e484ab25
https://git.eclipse.org/c/gmf-runtime/org.eclipse.gmf-runtime.git/commit/?id=4dadda7de48428bc197db858f8c037aa8177d353
Whiteboard:

Description Laurent Redor CLA 2017-07-05 11:35:21 EDT
For the creation of a BaseSlidableAnchor for a NodeFigure with a TransparentBorder, the getBounds() is used. Example of corresponding stack trace:

Thread [main] (Suspended (breakpoint at line 602 in Figure))	
	org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(Figure).getBounds() line: 602	
	org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(NodeFigure).createConnectionAnchor(Point) line: 174	
	org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(NodeFigure).getTargetConnectionAnchorAt(Point) line: 157	
	BorderedNodeFigure.getTargetConnectionAnchorAt(Point) line: 203	

But after, when someone want to compute the anchor location, the getHandleBounds() is used. Example of corresponding stack trace:

Thread [main] (Suspended (breakpoint at line 91 in NodeFigure))	
    org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(NodeFigure).getHandleBounds() line: 91
	org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor.getBox() line: 66
	org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor.getAnchorPosition() line: 147

The both methods do not return the same Rectangle. This can causes a shift of few pixel in some cases.
Comment 1 Eclipse Genie CLA 2017-07-05 12:28:45 EDT
New Gerrit change created: https://git.eclipse.org/r/100751
Comment 2 Eclipse Genie CLA 2017-07-05 12:28:47 EDT
New Gerrit change created: https://git.eclipse.org/r/100750
Comment 3 Laurent Redor CLA 2017-07-05 12:29:33 EDT
* https://git.eclipse.org/r/100750: A gerrit to add a test that reveal the bug
* https://git.eclipse.org/r/100751: A gerrit to fix the problem
Comment 6 Pierre-Charles David CLA 2020-02-20 11:13:59 EST
Fixed on master.