@@ -71,22 +71,22 @@ void SetWindowRectCommandHandler::ExecuteInternal(
71
71
browser_wrapper->Restore ();
72
72
73
73
HWND window_handle = browser_wrapper->GetTopLevelWindowHandle ();
74
- if (x >= 0 && y >= 0 ) {
75
- BOOL set_window_pos_result = ::SetWindowPos (window_handle, NULL , x, y, 0 , 0 , SWP_NOSIZE);
76
- if (!set_window_pos_result) {
77
- response->SetErrorResponse (ERROR_UNKNOWN_ERROR,
78
- " Unexpected error setting window size (SetWindowPos API failed)" );
79
- return ;
80
- }
74
+ RECT current_window_rect;
75
+ ::GetWindowRect (window_handle, ¤t_window_rect);
76
+ if (x < 0 || y < 0 ) {
77
+ x = current_window_rect.left ;
78
+ y = current_window_rect.top ;
79
+ }
80
+ if (height < 0 || width < 0 ) {
81
+ height = current_window_rect.bottom - current_window_rect.top ;
82
+ width = current_window_rect.right - current_window_rect.left ;
81
83
}
82
84
83
- if (width >= 0 && height >= 0 ) {
84
- BOOL set_window_size_result = ::SetWindowPos (window_handle, NULL , 0 , 0 , width, height, SWP_NOMOVE);
85
- if (!set_window_size_result) {
86
- response->SetErrorResponse (ERROR_UNKNOWN_ERROR,
87
- " Unexpected error setting window size (SetWindowPos API failed)" );
88
- return ;
89
- }
85
+ BOOL set_window_pos_result = ::SetWindowPos (window_handle, NULL , x, y, width, height, 0 );
86
+ if (!set_window_pos_result) {
87
+ response->SetErrorResponse (ERROR_UNKNOWN_ERROR,
88
+ " Unexpected error setting window size (SetWindowPos API failed)" );
89
+ return ;
90
90
}
91
91
92
92
HWND browser_window_handle = browser_wrapper->GetTopLevelWindowHandle ();
@@ -107,6 +107,9 @@ bool SetWindowRectCommandHandler::GetNumericParameter(
107
107
std::string* error_message) {
108
108
ParametersMap::const_iterator parameter_iterator = command_parameters.find (argument_name);
109
109
if (parameter_iterator != command_parameters.end ()) {
110
+ if (parameter_iterator->second .isNull ()) {
111
+ return true ;
112
+ }
110
113
if (!parameter_iterator->second .isNumeric ()) {
111
114
*error_message = argument_name + " must be a numeric parameter." ;
112
115
return false ;
0 commit comments