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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 1007013002: Make scrollWidth and scrollHeight match other DOM measurement APIs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add additional test expectation 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutTextControlSingleLine.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index aa9c0c56bccd29c71180100aff6a108e5fb3b97e..f53f772728ff7af90ea0a4f784c329c0ed1382d5 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -3375,12 +3375,15 @@ IntSize WebViewImpl::contentsSize() const
WebSize WebViewImpl::contentsPreferredMinimumSize()
{
Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecatedLocalMainFrame()->document() : 0;
- if (!document || !document->layoutView() || !document->documentElement())
+ if (!document || !document->layoutView() || !document->documentElement() || !document->documentElement()->layoutBox())
return WebSize();
layout();
int widthScaled = document->layoutView()->minPreferredLogicalWidth(); // Already accounts for zoom.
- int heightScaled = static_cast<int>(document->documentElement()->scrollHeight() * zoomLevelToZoomFactor(zoomLevel()));
+ LayoutBox* documentBox = document->documentElement()->layoutBox();
+ // TODO(leviw): We truncate then zoom the height instead of rounding to match the width behavior. We
+ // should be able to call documentElement's scrollHeight() method. crbug.com/471336
+ int heightScaled = adjustLayoutUnitForAbsoluteZoom(documentBox->scrollHeight(), *documentBox).toInt() * zoomLevelToZoomFactor(zoomLevel());
return IntSize(widthScaled, heightScaled);
}
« no previous file with comments | « Source/core/layout/LayoutTextControlSingleLine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698