Chromium Code Reviews| 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) |