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

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

Issue 1061153002: Remove WebViewImpl preferred size hack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use Flexbox to avoid whitespace issue Created 5 years, 8 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 3356 matching lines...) Expand 10 before | Expand all | Expand 10 after
3367 return IntSize(); 3367 return IntSize();
3368 LayoutView* root = page()->deprecatedLocalMainFrame()->contentRenderer(); 3368 LayoutView* root = page()->deprecatedLocalMainFrame()->contentRenderer();
3369 if (!root) 3369 if (!root)
3370 return IntSize(); 3370 return IntSize();
3371 return root->documentRect().size(); 3371 return root->documentRect().size();
3372 } 3372 }
3373 3373
3374 WebSize WebViewImpl::contentsPreferredMinimumSize() 3374 WebSize WebViewImpl::contentsPreferredMinimumSize()
3375 { 3375 {
3376 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : 0; 3376 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : 0;
3377 if (!document || !document->layoutView() || !document->documentElement() || !document->documentElement()->layoutBox()) 3377 if (!document || !document->layoutView() || !document->documentElement())
3378 return WebSize(); 3378 return WebSize();
3379 3379
3380 layout(); 3380 layout();
3381 int widthScaled = document->layoutView()->minPreferredLogicalWidth(); // Alr eady accounts for zoom. 3381 int widthScaled = document->layoutView()->minPreferredLogicalWidth().round() ; // Already accounts for zoom.
3382 LayoutBox* documentBox = document->documentElement()->layoutBox(); 3382 int heightScaled = static_cast<int>(document->documentElement()->scrollHeigh t() * zoomLevelToZoomFactor(zoomLevel()));
3383 // TODO(leviw): We truncate then zoom the height instead of rounding to matc h the width behavior. We
3384 // should be able to call documentElement's scrollHeight() method. crbug.com /471336
3385 int heightScaled = adjustLayoutUnitForAbsoluteZoom(documentBox->scrollHeight (), *documentBox).toInt() * zoomLevelToZoomFactor(zoomLevel());
3386 return IntSize(widthScaled, heightScaled); 3383 return IntSize(widthScaled, heightScaled);
3387 } 3384 }
3388 3385
3389 void WebViewImpl::enableViewport() 3386 void WebViewImpl::enableViewport()
3390 { 3387 {
3391 settings()->setViewportEnabled(true); 3388 settings()->setViewportEnabled(true);
3392 } 3389 }
3393 3390
3394 void WebViewImpl::disableViewport() 3391 void WebViewImpl::disableViewport()
3395 { 3392 {
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4511 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4508 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4512 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4509 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4513 } 4510 }
4514 4511
4515 void WebViewImpl::forceNextWebGLContextCreationToFail() 4512 void WebViewImpl::forceNextWebGLContextCreationToFail()
4516 { 4513 {
4517 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4514 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4518 } 4515 }
4519 4516
4520 } // namespace blink 4517 } // 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