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

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

Issue 1071383002: Round when calculating minimum height of WebViews (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added test that rounds down Created 5 years, 7 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
« 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 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()) 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().round() ; // Already accounts for zoom. 3381 int widthScaled = document->layoutView()->minPreferredLogicalWidth().round() ; // Already accounts for zoom.
3382 int heightScaled = static_cast<int>(document->documentElement()->scrollHeigh t() * zoomLevelToZoomFactor(zoomLevel())); 3382 int heightScaled = static_cast<int>((document->documentElement()->scrollHeig ht() * zoomLevelToZoomFactor(zoomLevel())) + 0.5); // +0.5 to round rather than truncating
3383 return IntSize(widthScaled, heightScaled); 3383 return IntSize(widthScaled, heightScaled);
3384 } 3384 }
3385 3385
3386 void WebViewImpl::enableViewport() 3386 void WebViewImpl::enableViewport()
3387 { 3387 {
3388 settings()->setViewportEnabled(true); 3388 settings()->setViewportEnabled(true);
3389 } 3389 }
3390 3390
3391 void WebViewImpl::disableViewport() 3391 void WebViewImpl::disableViewport()
3392 { 3392 {
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4508 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4508 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4509 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4509 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4510 } 4510 }
4511 4511
4512 void WebViewImpl::forceNextWebGLContextCreationToFail() 4512 void WebViewImpl::forceNextWebGLContextCreationToFail()
4513 { 4513 {
4514 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4514 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4515 } 4515 }
4516 4516
4517 } // 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