OLD | NEW |
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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 String Internals::configurationForViewport(Document* document, float devicePixel
Ratio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeigh
t, ExceptionCode& ec) | 895 String Internals::configurationForViewport(Document* document, float devicePixel
Ratio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeigh
t, ExceptionCode& ec) |
896 { | 896 { |
897 if (!document || !document->page()) { | 897 if (!document || !document->page()) { |
898 ec = INVALID_ACCESS_ERR; | 898 ec = INVALID_ACCESS_ERR; |
899 return String(); | 899 return String(); |
900 } | 900 } |
901 Page* page = document->page(); | 901 Page* page = document->page(); |
902 | 902 |
903 const int defaultLayoutWidthForNonMobilePages = 980; | 903 const int defaultLayoutWidthForNonMobilePages = 980; |
904 | 904 |
| 905 // FIXME(aelias): Remove this argument from all the fast/viewport tests. |
| 906 ASSERT(devicePixelRatio == 1); |
| 907 |
905 ViewportArguments arguments = page->viewportArguments(); | 908 ViewportArguments arguments = page->viewportArguments(); |
906 ViewportAttributes attributes = computeViewportAttributes(arguments, default
LayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSi
ze(availableWidth, availableHeight)); | 909 PageScaleConstraints constraints = arguments.resolve(IntSize(availableWidth,
availableHeight), FloatSize(deviceWidth, deviceHeight), defaultLayoutWidthForNo
nMobilePages); |
907 restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth,
availableHeight), devicePixelRatio); | 910 constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidt
h); |
908 restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); | |
909 | 911 |
910 return "viewport size " + String::number(attributes.layoutSize.width()) + "x
" + String::number(attributes.layoutSize.height()) + " scale " + String::number(
attributes.initialScale) + " with limits [" + String::number(attributes.minimumS
cale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " +
(attributes.userScalable ? "true" : "false"); | 912 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"); |
911 } | 913 } |
912 | 914 |
913 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) | 915 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) |
914 { | 916 { |
915 if (!textField) { | 917 if (!textField) { |
916 ec = INVALID_ACCESS_ERR; | 918 ec = INVALID_ACCESS_ERR; |
917 return false; | 919 return false; |
918 } | 920 } |
919 | 921 |
920 if (HTMLInputElement* inputElement = textField->toInputElement()) | 922 if (HTMLInputElement* inputElement = textField->toInputElement()) |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 | 1936 |
1935 RenderObject* renderer = select->renderer(); | 1937 RenderObject* renderer = select->renderer(); |
1936 if (!renderer->isMenuList()) | 1938 if (!renderer->isMenuList()) |
1937 return false; | 1939 return false; |
1938 | 1940 |
1939 RenderMenuList* menuList = toRenderMenuList(renderer); | 1941 RenderMenuList* menuList = toRenderMenuList(renderer); |
1940 return menuList->popupIsVisible(); | 1942 return menuList->popupIsVisible(); |
1941 } | 1943 } |
1942 | 1944 |
1943 } | 1945 } |
OLD | NEW |