Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 1291343008: Fix crash in WebViewImpl::contentsPreferredMinimumSize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 3379 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 if (!page()->mainFrame()->isLocalFrame()) 3390 if (!page()->mainFrame()->isLocalFrame())
3391 return IntSize(); 3391 return IntSize();
3392 LayoutView* root = page()->deprecatedLocalMainFrame()->contentLayoutObject() ; 3392 LayoutView* root = page()->deprecatedLocalMainFrame()->contentLayoutObject() ;
3393 if (!root) 3393 if (!root)
3394 return IntSize(); 3394 return IntSize();
3395 return root->documentRect().size(); 3395 return root->documentRect().size();
3396 } 3396 }
3397 3397
3398 WebSize WebViewImpl::contentsPreferredMinimumSize() 3398 WebSize WebViewImpl::contentsPreferredMinimumSize()
3399 { 3399 {
3400 layout();
3401
3400 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : 0; 3402 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : 0;
3401 if (!document || !document->layoutView() || !document->documentElement() || !document->documentElement()->layoutBox()) 3403 if (!document || !document->layoutView() || !document->documentElement() || !document->documentElement()->layoutBox())
3402 return WebSize(); 3404 return WebSize();
3403 3405
3404 layout();
3405 int widthScaled = document->layoutView()->minPreferredLogicalWidth().round() ; // Already accounts for zoom. 3406 int widthScaled = document->layoutView()->minPreferredLogicalWidth().round() ; // Already accounts for zoom.
3406 int heightScaled = document->documentElement()->layoutBox()->scrollHeight(). round(); 3407 int heightScaled = document->documentElement()->layoutBox()->scrollHeight(). round();
3407 return IntSize(widthScaled, heightScaled); 3408 return IntSize(widthScaled, heightScaled);
3408 } 3409 }
3409 3410
3410 void WebViewImpl::enableViewport() 3411 void WebViewImpl::enableViewport()
3411 { 3412 {
3412 settings()->setViewportEnabled(true); 3413 settings()->setViewportEnabled(true);
3413 } 3414 }
3414 3415
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
4510 if (m_pageColorOverlay) 4511 if (m_pageColorOverlay)
4511 m_pageColorOverlay->update(); 4512 m_pageColorOverlay->update();
4512 if (m_inspectorOverlay) { 4513 if (m_inspectorOverlay) {
4513 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(); 4514 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay();
4514 if (inspectorPageOverlay) 4515 if (inspectorPageOverlay)
4515 inspectorPageOverlay->update(); 4516 inspectorPageOverlay->update();
4516 } 4517 }
4517 } 4518 }
4518 4519
4519 } // namespace blink 4520 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698