| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "webkit/tools/test_shell/webview_host.h" | 7 #include "webkit/tools/test_shell/webview_host.h" |
| 8 #include "webkit/tools/test_shell/mac/test_shell_webview.h" | 8 #include "webkit/tools/test_shell/mac/test_shell_webview.h" |
| 9 | 9 |
| 10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 13 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 14 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 15 #include "webkit/glue/webpreferences.h" | 16 #include "webkit/glue/webpreferences.h" |
| 16 #include "webkit/tools/test_shell/test_shell.h" | 17 #include "webkit/tools/test_shell/test_shell.h" |
| 17 #include "webkit/tools/test_shell/test_webview_delegate.h" | 18 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 18 | 19 |
| 19 using WebKit::WebDevToolsAgentClient; | 20 using WebKit::WebDevToolsAgentClient; |
| 20 using WebKit::WebSize; | 21 using WebKit::WebSize; |
| 21 using WebKit::WebView; | 22 using WebKit::WebView; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 content_rect.size.height -= 32; | 36 content_rect.size.height -= 32; |
| 36 host->view_ = [[TestShellWebView alloc] initWithFrame:content_rect]; | 37 host->view_ = [[TestShellWebView alloc] initWithFrame:content_rect]; |
| 37 // make the height and width track the window size. | 38 // make the height and width track the window size. |
| 38 [host->view_ setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; | 39 [host->view_ setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; |
| 39 [parent_view addSubview:host->view_]; | 40 [parent_view addSubview:host->view_]; |
| 40 [host->view_ release]; | 41 [host->view_ release]; |
| 41 | 42 |
| 42 host->webwidget_ = WebView::create(delegate); | 43 host->webwidget_ = WebView::create(delegate); |
| 43 host->webview()->setDevToolsAgentClient(dev_tools_client); | 44 host->webview()->setDevToolsAgentClient(dev_tools_client); |
| 44 prefs.Apply(host->webview()); | 45 prefs.Apply(host->webview()); |
| 46 host->webview()->settings()->setExperimentalCSSGridLayoutEnabled(true); |
| 45 host->webview()->initializeMainFrame(delegate); | 47 host->webview()->initializeMainFrame(delegate); |
| 46 host->webwidget_->resize(WebSize(NSWidth(content_rect), | 48 host->webwidget_->resize(WebSize(NSWidth(content_rect), |
| 47 NSHeight(content_rect))); | 49 NSHeight(content_rect))); |
| 48 | 50 |
| 49 return host; | 51 return host; |
| 50 } | 52 } |
| 51 | 53 |
| 52 WebView* WebViewHost::webview() const { | 54 WebView* WebViewHost::webview() const { |
| 53 return static_cast<WebView*>(webwidget_); | 55 return static_cast<WebView*>(webwidget_); |
| 54 } | 56 } |
| 55 | 57 |
| 56 void WebViewHost::SetIsActive(bool active) { | 58 void WebViewHost::SetIsActive(bool active) { |
| 57 // Ignore calls in layout test mode so that tests don't mess with each other | 59 // Ignore calls in layout test mode so that tests don't mess with each other |
| 58 // when running in parallel. | 60 // when running in parallel. |
| 59 if (!TestShell::layout_test_mode()) | 61 if (!TestShell::layout_test_mode()) |
| 60 webview()->setIsActive(active); | 62 webview()->setIsActive(active); |
| 61 } | 63 } |
| OLD | NEW |