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

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

Issue 1291723005: Update WebViewImpl::contentsPreferredMinimumSize to be agnostic to the scrolling element (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 | no next file » | 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 return IntSize(); 3390 return IntSize();
3391 LayoutView* root = page()->deprecatedLocalMainFrame()->contentLayoutObject() ; 3391 LayoutView* root = page()->deprecatedLocalMainFrame()->contentLayoutObject() ;
3392 if (!root) 3392 if (!root)
3393 return IntSize(); 3393 return IntSize();
3394 return root->documentRect().size(); 3394 return root->documentRect().size();
3395 } 3395 }
3396 3396
3397 WebSize WebViewImpl::contentsPreferredMinimumSize() 3397 WebSize WebViewImpl::contentsPreferredMinimumSize()
3398 { 3398 {
3399 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : 0; 3399 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : 0;
3400 if (!document || !document->layoutView() || !document->documentElement()) 3400 if (!document || !document->layoutView() || !document->documentElement() || !document->documentElement()->layoutBox())
3401 return WebSize(); 3401 return WebSize();
3402 3402
3403 layout(); 3403 layout();
3404 int widthScaled = document->layoutView()->minPreferredLogicalWidth().round() ; // Already accounts for zoom. 3404 int widthScaled = document->layoutView()->minPreferredLogicalWidth().round() ; // Already accounts for zoom.
3405 int heightScaled = static_cast<int>((document->documentElement()->scrollHeig ht() * zoomLevelToZoomFactor(zoomLevel())) + 0.5); // +0.5 to round rather than truncating 3405 LayoutBox* box = document->documentElement()->layoutBox();
3406 int heightScaled = static_cast<int>(adjustLayoutUnitForAbsoluteZoom(box->scr ollHeight(), *box) * zoomLevelToZoomFactor(zoomLevel()) + 0.5); // +0.5 to round rather than truncating
bokan 2015/08/13 15:49:04 Did you forget to remove the second zoom factor? I
Rick Byers 2015/08/13 16:51:54 I was attempting to leave the behavior exactly the
3406 return IntSize(widthScaled, heightScaled); 3407 return IntSize(widthScaled, heightScaled);
3407 } 3408 }
3408 3409
3409 void WebViewImpl::enableViewport() 3410 void WebViewImpl::enableViewport()
3410 { 3411 {
3411 settings()->setViewportEnabled(true); 3412 settings()->setViewportEnabled(true);
3412 } 3413 }
3413 3414
3414 void WebViewImpl::disableViewport() 3415 void WebViewImpl::disableViewport()
3415 { 3416 {
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
4501 if (m_pageColorOverlay) 4502 if (m_pageColorOverlay)
4502 m_pageColorOverlay->update(); 4503 m_pageColorOverlay->update();
4503 if (m_inspectorOverlay) { 4504 if (m_inspectorOverlay) {
4504 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(); 4505 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay();
4505 if (inspectorPageOverlay) 4506 if (inspectorPageOverlay)
4506 inspectorPageOverlay->update(); 4507 inspectorPageOverlay->update();
4507 } 4508 }
4508 } 4509 }
4509 4510
4510 } // namespace blink 4511 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698