OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <fontconfig/fontconfig.h> | 9 #include <fontconfig/fontconfig.h> |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 void TestShell::TestFinished() { | 369 void TestShell::TestFinished() { |
370 if(!test_is_pending_) | 370 if(!test_is_pending_) |
371 return; | 371 return; |
372 | 372 |
373 test_is_pending_ = false; | 373 test_is_pending_ = false; |
374 MessageLoop::current()->Quit(); | 374 MessageLoop::current()->Quit(); |
375 } | 375 } |
376 | 376 |
377 void TestShell::SizeTo(int width, int height) { | 377 void TestShell::SizeTo(int width, int height) { |
378 GtkWidget* widget = m_webViewHost->view_handle(); | 378 GtkWidget* widget = m_webViewHost->view_handle(); |
379 if (widget->allocation.width == width && | 379 |
380 widget->allocation.height == height) { | 380 GtkAllocation allocation; |
| 381 gtk_widget_get_allocation(widget, &allocation); |
| 382 if (allocation.width == width && allocation.height == height) { |
381 // Nothing to do. | 383 // Nothing to do. |
382 return; | 384 return; |
383 } | 385 } |
384 | 386 |
385 gtk_widget_set_size_request(widget, width, height); | 387 gtk_widget_set_size_request(widget, width, height); |
386 if (widget->allocation.width > width || | 388 if (allocation.width > width || allocation.height > height) { |
387 widget->allocation.height > height) { | |
388 // We've been sized smaller. Shrink the window so it snaps back to the | 389 // We've been sized smaller. Shrink the window so it snaps back to the |
389 // appropriate size. | 390 // appropriate size. |
390 gtk_window_resize(GTK_WINDOW(m_mainWnd), 1, 1); | 391 gtk_window_resize(GTK_WINDOW(m_mainWnd), 1, 1); |
391 } | 392 } |
392 | 393 |
393 // We've been asked to size the content area to a particular size. | 394 // We've been asked to size the content area to a particular size. |
394 // GTK works asynchronously: you request a size and then it | 395 // GTK works asynchronously: you request a size and then it |
395 // eventually becomes that size. But layout tests need to be sure | 396 // eventually becomes that size. But layout tests need to be sure |
396 // the resize has gone into WebKit by the time SizeTo() returns. | 397 // the resize has gone into WebKit by the time SizeTo() returns. |
397 // Force the webkit resize to happen now. | 398 // Force the webkit resize to happen now. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 switch (resource_id) { | 572 switch (resource_id) { |
572 case IDR_BROKENIMAGE: | 573 case IDR_BROKENIMAGE: |
573 resource_id = IDR_BROKENIMAGE_TESTSHELL; | 574 resource_id = IDR_BROKENIMAGE_TESTSHELL; |
574 break; | 575 break; |
575 case IDR_TEXTAREA_RESIZER: | 576 case IDR_TEXTAREA_RESIZER: |
576 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; | 577 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; |
577 break; | 578 break; |
578 } | 579 } |
579 return TestShell::ResourceProvider(resource_id); | 580 return TestShell::ResourceProvider(resource_id); |
580 } | 581 } |
OLD | NEW |