Chromium Code Reviews| 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 && | |
| 383 allocation.height == height) { | |
|
tony
2012/01/04 19:08:01
Nit: This condition probably fits on a single line
| |
| 381 // Nothing to do. | 384 // Nothing to do. |
| 382 return; | 385 return; |
| 383 } | 386 } |
| 384 | 387 |
| 385 gtk_widget_set_size_request(widget, width, height); | 388 gtk_widget_set_size_request(widget, width, height); |
| 386 if (widget->allocation.width > width || | 389 if (allocation.width > width || |
| 387 widget->allocation.height > height) { | 390 allocation.height > height) { |
|
tony
2012/01/04 19:08:01
Nit: This condition probably fits on a single line
| |
| 388 // We've been sized smaller. Shrink the window so it snaps back to the | 391 // We've been sized smaller. Shrink the window so it snaps back to the |
| 389 // appropriate size. | 392 // appropriate size. |
| 390 gtk_window_resize(GTK_WINDOW(m_mainWnd), 1, 1); | 393 gtk_window_resize(GTK_WINDOW(m_mainWnd), 1, 1); |
| 391 } | 394 } |
| 392 | 395 |
| 393 // We've been asked to size the content area to a particular size. | 396 // We've been asked to size the content area to a particular size. |
| 394 // GTK works asynchronously: you request a size and then it | 397 // GTK works asynchronously: you request a size and then it |
| 395 // eventually becomes that size. But layout tests need to be sure | 398 // eventually becomes that size. But layout tests need to be sure |
| 396 // the resize has gone into WebKit by the time SizeTo() returns. | 399 // the resize has gone into WebKit by the time SizeTo() returns. |
| 397 // Force the webkit resize to happen now. | 400 // Force the webkit resize to happen now. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 switch (resource_id) { | 574 switch (resource_id) { |
| 572 case IDR_BROKENIMAGE: | 575 case IDR_BROKENIMAGE: |
| 573 resource_id = IDR_BROKENIMAGE_TESTSHELL; | 576 resource_id = IDR_BROKENIMAGE_TESTSHELL; |
| 574 break; | 577 break; |
| 575 case IDR_TEXTAREA_RESIZER: | 578 case IDR_TEXTAREA_RESIZER: |
| 576 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; | 579 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; |
| 577 break; | 580 break; |
| 578 } | 581 } |
| 579 return TestShell::ResourceProvider(resource_id); | 582 return TestShell::ResourceProvider(resource_id); |
| 580 } | 583 } |
| OLD | NEW |