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

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

Issue 19555002: Translate viewport related meta tags into @viewport descriptors as suggested by the CSS Device Adap… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 8f73675dbf6bebf4e1066af77ae3bac139cf6359..a673f8db50236e7e73f657837a63daba5a111dad 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -38,6 +38,8 @@
#include "TypeConversions.h"
#include "bindings/v8/SerializedScriptValue.h"
#include "core/css/StyleSheetContents.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/ViewportStyleResolver.h"
#include "core/dom/ClientRect.h"
#include "core/dom/ClientRectList.h"
#include "core/dom/DOMStringList.h"
@@ -909,7 +911,7 @@ void Internals::setPagination(Document* document, const String& mode, int gap, i
page->setPagination(pagination);
}
-String Internals::configurationForViewport(Document* document, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec)
+String Internals::configurationForViewport(Document* document, float devicePixelRatio, int, int, int availableWidth, int availableHeight, ExceptionCode& ec)
{
if (!document || !document->page()) {
ec = InvalidAccessError;
@@ -917,16 +919,23 @@ String Internals::configurationForViewport(Document* document, float devicePixel
}
Page* page = document->page();
- const int defaultLayoutWidthForNonMobilePages = 980;
-
// FIXME(aelias): Remove this argument from all the fast/viewport tests.
ASSERT(devicePixelRatio == 1);
+ // Update initial viewport size.
+ IntSize initialViewportSize(availableWidth, availableHeight);
+ document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero(), initialViewportSize));
+ document->styleResolver()->viewportStyleResolver()->resolve();
+
ViewportArguments arguments = page->viewportArguments();
- PageScaleConstraints constraints = arguments.resolve(IntSize(availableWidth, availableHeight), FloatSize(deviceWidth, deviceHeight), defaultLayoutWidthForNonMobilePages);
+ PageScaleConstraints constraints = arguments.resolve(initialViewportSize);
+
constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidth);
- 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");
+ 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");
abarth-chromium 2013/07/17 18:17:18 Is there a way to make this change in smaller step
}
bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)

Powered by Google App Engine
This is Rietveld 408576698