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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 20 matching lines...) Expand all
31 #include "InspectorFrontendClientLocal.h" 31 #include "InspectorFrontendClientLocal.h"
32 #include "InternalProfilers.h" 32 #include "InternalProfilers.h"
33 #include "InternalRuntimeFlags.h" 33 #include "InternalRuntimeFlags.h"
34 #include "InternalSettings.h" 34 #include "InternalSettings.h"
35 #include "MallocStatistics.h" 35 #include "MallocStatistics.h"
36 #include "MockPagePopupDriver.h" 36 #include "MockPagePopupDriver.h"
37 #include "RuntimeEnabledFeatures.h" 37 #include "RuntimeEnabledFeatures.h"
38 #include "TypeConversions.h" 38 #include "TypeConversions.h"
39 #include "bindings/v8/SerializedScriptValue.h" 39 #include "bindings/v8/SerializedScriptValue.h"
40 #include "core/css/StyleSheetContents.h" 40 #include "core/css/StyleSheetContents.h"
41 #include "core/css/resolver/StyleResolver.h"
42 #include "core/css/resolver/ViewportStyleResolver.h"
41 #include "core/dom/ClientRect.h" 43 #include "core/dom/ClientRect.h"
42 #include "core/dom/ClientRectList.h" 44 #include "core/dom/ClientRectList.h"
43 #include "core/dom/DOMStringList.h" 45 #include "core/dom/DOMStringList.h"
44 #include "core/dom/Document.h" 46 #include "core/dom/Document.h"
45 #include "core/dom/DocumentMarker.h" 47 #include "core/dom/DocumentMarker.h"
46 #include "core/dom/DocumentMarkerController.h" 48 #include "core/dom/DocumentMarkerController.h"
47 #include "core/dom/Element.h" 49 #include "core/dom/Element.h"
48 #include "core/dom/ExceptionCode.h" 50 #include "core/dom/ExceptionCode.h"
49 #include "core/dom/FullscreenController.h" 51 #include "core/dom/FullscreenController.h"
50 #include "core/dom/NodeRenderingContext.h" 52 #include "core/dom/NodeRenderingContext.h"
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 else { 904 else {
903 ec = SyntaxError; 905 ec = SyntaxError;
904 return; 906 return;
905 } 907 }
906 908
907 pagination.gap = gap; 909 pagination.gap = gap;
908 pagination.pageLength = pageLength; 910 pagination.pageLength = pageLength;
909 page->setPagination(pagination); 911 page->setPagination(pagination);
910 } 912 }
911 913
912 String Internals::configurationForViewport(Document* document, float devicePixel Ratio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeigh t, ExceptionCode& ec) 914 String Internals::configurationForViewport(Document* document, float devicePixel Ratio, int, int, int availableWidth, int availableHeight, ExceptionCode& ec)
913 { 915 {
914 if (!document || !document->page()) { 916 if (!document || !document->page()) {
915 ec = InvalidAccessError; 917 ec = InvalidAccessError;
916 return String(); 918 return String();
917 } 919 }
918 Page* page = document->page(); 920 Page* page = document->page();
919 921
920 const int defaultLayoutWidthForNonMobilePages = 980;
921
922 // FIXME(aelias): Remove this argument from all the fast/viewport tests. 922 // FIXME(aelias): Remove this argument from all the fast/viewport tests.
923 ASSERT(devicePixelRatio == 1); 923 ASSERT(devicePixelRatio == 1);
924 924
925 // Update initial viewport size.
926 IntSize initialViewportSize(availableWidth, availableHeight);
927 document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero() , initialViewportSize));
928 document->styleResolver()->viewportStyleResolver()->resolve();
929
925 ViewportArguments arguments = page->viewportArguments(); 930 ViewportArguments arguments = page->viewportArguments();
926 PageScaleConstraints constraints = arguments.resolve(IntSize(availableWidth, availableHeight), FloatSize(deviceWidth, deviceHeight), defaultLayoutWidthForNo nMobilePages); 931 PageScaleConstraints constraints = arguments.resolve(initialViewportSize);
932
927 constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidt h); 933 constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidt h);
928 934
929 return "viewport size " + String::number(constraints.layoutSize.width()) + " x" + String::number(constraints.layoutSize.height()) + " scale " + String::numbe r(constraints.initialScale) + " with limits [" + String::number(constraints.mini mumScale) + ", " + String::number(constraints.maximumScale) + "] and userScalabl e " + (arguments.userZoom ? "true" : "false"); 935 return "viewport size " + String::number(constraints.layoutSize.width()) + " x" + String::number(constraints.layoutSize.height())
936 + " scale " + String::number(constraints.initialScale)
937 + " with limits [" + String::number(constraints.minimumScale) + ", " + S tring::number(constraints.maximumScale) + "]"
938 + " 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
930 } 939 }
931 940
932 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) 941 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)
933 { 942 {
934 if (!textField) { 943 if (!textField) {
935 ec = InvalidAccessError; 944 ec = InvalidAccessError;
936 return false; 945 return false;
937 } 946 }
938 947
939 if (textField->hasTagName(inputTag)) 948 if (textField->hasTagName(inputTag))
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 2008
2000 RenderObject* renderer = select->renderer(); 2009 RenderObject* renderer = select->renderer();
2001 if (!renderer->isMenuList()) 2010 if (!renderer->isMenuList())
2002 return false; 2011 return false;
2003 2012
2004 RenderMenuList* menuList = toRenderMenuList(renderer); 2013 RenderMenuList* menuList = toRenderMenuList(renderer);
2005 return menuList->popupIsVisible(); 2014 return menuList->popupIsVisible();
2006 } 2015 }
2007 2016
2008 } 2017 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698