@@ -1424,17 +1424,39 @@ void revBrowserGetProp(CWebBrowserBase *p_instance, char *args[], int nargs, cha
14241424 {
14251425 int t_left, t_top, t_right, t_bottom;
14261426 t_browser -> GetRect (t_left, t_top, t_right, t_bottom);
1427+
1428+ // IM-2014-07-09: [[ Bug 12225 ]] Convert browser rect to stack coords
1429+ MCRectangle32 t_rect;
1430+ t_rect.x = t_left;
1431+ t_rect.y = t_top;
1432+ t_rect.width = t_right - t_left;
1433+ t_rect.height = t_bottom - t_top;
1434+
1435+ int t_success;
1436+ /* UNCHECKED */ WindowToStackRect (t_browser->GetWindowId (), &t_rect, &t_success);
1437+
14271438 // AL-2013-11-01 [[ Bug 11289 ]] Use libcore methods to prevent potential buffer overflows in revbrowser
1428- MCCStringFormat (result," %d,%d,%d,%d" , t_left, t_top, t_right, t_bottom );
1439+ MCCStringFormat (result," %d,%d,%d,%d" , t_rect. x , t_rect. y , t_rect. x + t_rect. width , t_rect. y + t_rect. height );
14291440 }
14301441 break ;
14311442
14321443 case BROWSERPROP_FORMATTEDRECT:
14331444 {
14341445 int t_left, t_top, t_right, t_bottom;
14351446 t_browser -> GetFormattedRect (t_left, t_top, t_right, t_bottom);
1447+
1448+ // IM-2014-07-09: [[ Bug 12225 ]] Convert browser rect to stack coords
1449+ MCRectangle32 t_rect;
1450+ t_rect.x = t_left;
1451+ t_rect.y = t_top;
1452+ t_rect.width = t_right - t_left;
1453+ t_rect.height = t_bottom - t_top;
1454+
1455+ int t_success;
1456+ /* UNCHECKED */ WindowToStackRect (t_browser->GetWindowId (), &t_rect, &t_success);
1457+
14361458 // AL-2013-11-01 [[ Bug 11289 ]] Use libcore methods to prevent potential buffer overflows in revbrowser
1437- MCCStringFormat (result," %d,%d,%d,%d" , t_left, t_top, t_right, t_bottom );
1459+ MCCStringFormat (result," %d,%d,%d,%d" , t_rect. x , t_rect. y , t_rect. x + t_rect. width , t_rect. y + t_rect. height );
14381460 }
14391461 break ;
14401462
@@ -1630,7 +1652,17 @@ void revBrowserSetProp(CWebBrowserBase *p_instance, char *args[], int nargs, cha
16301652
16311653 if (sscanf (args[1 ], " %lf,%lf,%lf,%lf" , &t_left, &t_top, &t_right, &t_bottom) == 4 )
16321654 {
1633- t_browser -> SetRect ((int )(t_left + 0.00000001 ), (int )(t_top + 0.00000001 ), (int )(t_right + 0.00000001 ), (int )(t_bottom + 0.00000001 ));
1655+ // IM-2014-07-09: [[ Bug 12225 ]] Convert stack rect to window coords
1656+ MCRectangle32 t_rect;
1657+ t_rect.x = (int )(t_left + 0.00000001 );
1658+ t_rect.y = (int )(t_top + 0.00000001 );
1659+ t_rect.width = ((int )(t_right + 0.00000001 )) - t_rect.x ;
1660+ t_rect.height = ((int )(t_bottom + 0.00000001 )) - t_rect.y ;
1661+
1662+ int t_success;
1663+ /* UNCHECKED */ StackToWindowRect (t_browser->GetWindowId (), &t_rect, &t_success);
1664+
1665+ t_browser -> SetRect (t_rect.x , t_rect.y , t_rect.x + t_rect.width , t_rect.y + t_rect.height );
16341666 }
16351667 else
16361668 {
0 commit comments