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

Unified Diff: Source/core/testing/Internals.cpp

Issue 14813025: Refactor viewport initialization logic out of WebViewImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix webkit_unit_tests Created 7 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 side-by-side diff with in-line comments
Download patch
« Source/core/page/Settings.h ('K') | « Source/core/page/Settings.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index e87247ee31b9f77cd1f71cf26e90b68b558f03d0..9c24337ff5b537dea4f83698fda8c219dfe93848 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -902,12 +902,14 @@ String Internals::configurationForViewport(Document* document, float devicePixel
const int defaultLayoutWidthForNonMobilePages = 980;
+ // FIXME(aelias): Remove this argument from all the fast/viewport tests.
+ ASSERT(devicePixelRatio == 1);
+
ViewportArguments arguments = page->viewportArguments();
- ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight));
- restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight), devicePixelRatio);
- restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
+ PageScaleConstraints constraints = arguments.resolve(IntSize(availableWidth, availableHeight), FloatSize(deviceWidth, deviceHeight), defaultLayoutWidthForNonMobilePages);
+ constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidth);
- return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false");
+ return "viewport size " + String::number(constraints.layoutSize.width()) + "x" + String::number(constraints.layoutSize.height()) + " scale " + String::number(constraints.initialScale) + " with limits [" + String::number(constraints.minimumScale) + ", " + String::number(constraints.maximumScale) + "] and userScalable " + (arguments.userZoom ? "true" : "false");
}
bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)
« Source/core/page/Settings.h ('K') | « Source/core/page/Settings.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698