@@ -2547,15 +2547,19 @@ public Point map (Control from, Control to, int x, int y) {
25472547checkDevice ();
25482548if (from !=null &&from .isDisposed ())error (SWT .ERROR_INVALID_ARGUMENT );
25492549if (to !=null &&to .isDisposed ())error (SWT .ERROR_INVALID_ARGUMENT );
2550- //Element hwndFrom = from != null ? from.handle : null;
2551- //Element hwndTo = to != null ? to.handle : null;
2550+ if (from ==to )return new Point (x ,y );
2551+ Element hwndFrom =from !=null ?from .handle :document .body ;
2552+ Element hwndTo =to !=null ?to .handle :document .body ;
25522553
25532554//POINT point = new POINT ();
25542555//point.x = x;
25552556//point.y = y;
25562557//OS.MapWindowPoints (hwndFrom, hwndTo, point, 1);
25572558//return new Point (point.x, point.y);
2558- return new Point (0 ,0 );
2559+ Point p =OS .calcuateRelativePosition (hwndFrom ,hwndTo );
2560+ p .x +=x ;
2561+ p .y +=y ;
2562+ return p ;
25592563}
25602564
25612565/**
@@ -2642,8 +2646,9 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei
26422646checkDevice ();
26432647if (from !=null &&from .isDisposed ())error (SWT .ERROR_INVALID_ARGUMENT );
26442648if (to !=null &&to .isDisposed ())error (SWT .ERROR_INVALID_ARGUMENT );
2645- //Element hwndFrom = from != null ? from.handle : null;
2646- //Element hwndTo = to != null ? to.handle : null;
2649+ if (from ==to )return new Rectangle (x ,y ,width ,height );
2650+ Element hwndFrom =from !=null ?from .handle :document .body ;
2651+ Element hwndTo =to !=null ?to .handle :document .body ;
26472652
26482653//RECT rect = new RECT ();
26492654//rect.left = x;
@@ -2652,7 +2657,10 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei
26522657//rect.bottom = y + height;
26532658//OS.MapWindowPoints (hwndFrom, hwndTo, rect, 2);
26542659//return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
2655- return new Rectangle (0 ,0 ,0 ,0 );
2660+ Point p =OS .calcuateRelativePosition (hwndFrom ,hwndTo );
2661+ p .x +=x ;
2662+ p .y +=y ;
2663+ return new Rectangle (p .x +x ,p .y +y ,OS .getContainerWidth (hwndTo ),OS .getContainerHeight (hwndTo ));
26562664}
26572665
26582666/*