OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/values.h" | 5 #include "base/values.h" |
6 #include "content/browser/renderer_host/render_view_host_impl.h" | 6 #include "content/browser/renderer_host/render_view_host_impl.h" |
7 #include "content/browser/web_contents/web_contents_impl.h" | 7 #include "content/browser/web_contents/web_contents_impl.h" |
8 #include "content/public/browser/load_notification_details.h" | 8 #include "content/public/browser/load_notification_details.h" |
9 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
10 #include "content/public/browser/notification_details.h" | 10 #include "content/public/browser/notification_details.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 void ResizeWebContentsView(Shell* shell, const gfx::Size& size, | 26 void ResizeWebContentsView(Shell* shell, const gfx::Size& size, |
27 bool set_start_page) { | 27 bool set_start_page) { |
28 // Shell::SizeTo is not implemented on Aura; WebContentsView::SizeContents | 28 // Shell::SizeTo is not implemented on Aura; WebContentsView::SizeContents |
29 // works on Win and ChromeOS but not Linux - we need to resize the shell | 29 // works on Win and ChromeOS but not Linux - we need to resize the shell |
30 // window on Linux because if we don't, the next layout of the unchanged shell | 30 // window on Linux because if we don't, the next layout of the unchanged shell |
31 // window will resize WebContentsView back to the previous size. | 31 // window will resize WebContentsView back to the previous size. |
32 // The cleaner and shorter SizeContents is preferred as more platforms convert | 32 // The cleaner and shorter SizeContents is preferred as more platforms convert |
33 // to Aura. | 33 // to Aura. |
34 #if defined(TOOLKIT_GTK) || defined(OS_MACOSX) | 34 #if defined(TOOLKIT_GTK) || defined(OS_MACOSX) |
kuan
2013/09/03 23:42:20
one thing u can try is to modify these conditional
Shrikant Kelkar
2013/09/04 00:16:53
When tried this on my machine test fails with and
| |
35 shell->SizeTo(size.width(), size.height()); | 35 shell->SizeTo(size.width(), size.height()); |
36 // If |set_start_page| is true, start with blank page to make sure resize | 36 // If |set_start_page| is true, start with blank page to make sure resize |
37 // takes effect. | 37 // takes effect. |
38 if (set_start_page) | 38 if (set_start_page) |
39 NavigateToURL(shell, GURL("about://blank")); | 39 NavigateToURL(shell, GURL("about://blank")); |
40 #else | 40 #else |
41 shell->web_contents()->GetView()->SizeContents(size); | 41 shell->web_contents()->GetView()->SizeContents(size); |
42 #endif // defined(TOOLKIT_GTK) || defined(OS_MACOSX) | 42 #endif // defined(TOOLKIT_GTK) || defined(OS_MACOSX) |
43 } | 43 } |
44 | 44 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 220 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
221 | 221 |
222 root = wc->GetFrameTreeRootForTesting(); | 222 root = wc->GetFrameTreeRootForTesting(); |
223 EXPECT_EQ(0UL, root->child_count()); | 223 EXPECT_EQ(0UL, root->child_count()); |
224 EXPECT_EQ(std::string(), root->frame_name()); | 224 EXPECT_EQ(std::string(), root->frame_name()); |
225 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); | 225 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); |
226 } | 226 } |
227 | 227 |
228 // TODO(sail): enable this for MAC when auto resizing of WebContentsViewCocoa is | 228 // TODO(sail): enable this for MAC when auto resizing of WebContentsViewCocoa is |
229 // fixed. | 229 // fixed. |
230 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 230 // TODO(shrikant): enable this for Windows when issue with |
231 // force-compositing-mode is resolved (#281726). | |
gab
2013/09/03 23:29:27
nit: s/#281726/http://crbug.com/281726
| |
232 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) | |
231 #define MAYBE_GetSizeForNewRenderView DISABLED_GetSizeForNewRenderView | 233 #define MAYBE_GetSizeForNewRenderView DISABLED_GetSizeForNewRenderView |
232 #else | 234 #else |
233 #define MAYBE_GetSizeForNewRenderView GetSizeForNewRenderView | 235 #define MAYBE_GetSizeForNewRenderView GetSizeForNewRenderView |
234 #endif | 236 #endif |
235 // Test that RenderViewHost is created and updated at the size specified by | 237 // Test that RenderViewHost is created and updated at the size specified by |
236 // WebContentsDelegate::GetSizeForNewRenderView(). | 238 // WebContentsDelegate::GetSizeForNewRenderView(). |
237 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, | 239 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, |
238 MAYBE_GetSizeForNewRenderView) { | 240 MAYBE_GetSizeForNewRenderView) { |
239 scoped_ptr<RenderViewSizeDelegate> delegate(new RenderViewSizeDelegate()); | 241 scoped_ptr<RenderViewSizeDelegate> delegate(new RenderViewSizeDelegate()); |
240 shell()->web_contents()->SetDelegate(delegate.get()); | 242 shell()->web_contents()->SetDelegate(delegate.get()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 // RenderViewSizeObserver resizes WebContentsView in NavigateToPendingEntry, | 278 // RenderViewSizeObserver resizes WebContentsView in NavigateToPendingEntry, |
277 // so both WebContentsView and RenderWidgetHostView adopt this new size. | 279 // so both WebContentsView and RenderWidgetHostView adopt this new size. |
278 new_size.Enlarge(size_insets.width(), size_insets.height()); | 280 new_size.Enlarge(size_insets.width(), size_insets.height()); |
279 EXPECT_EQ(new_size, | 281 EXPECT_EQ(new_size, |
280 shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds(). | 282 shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds(). |
281 size()); | 283 size()); |
282 EXPECT_EQ(new_size, shell()->web_contents()->GetView()->GetContainerSize()); | 284 EXPECT_EQ(new_size, shell()->web_contents()->GetView()->GetContainerSize()); |
283 } | 285 } |
284 | 286 |
285 } // namespace content | 287 } // namespace content |
OLD | NEW |