OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 && m_viewSize.width()) | 154 && m_viewSize.width()) |
155 return IntSize(contentsSize.width(), computeHeightByAspectRatio(contents
Size.width(), m_viewSize)); | 155 return IntSize(contentsSize.width(), computeHeightByAspectRatio(contents
Size.width(), m_viewSize)); |
156 | 156 |
157 // If there is a minimum scale (or there's no content size yet), the frame s
ize should match the viewport | 157 // If there is a minimum scale (or there's no content size yet), the frame s
ize should match the viewport |
158 // size at minimum scale, since the viewport must always be contained by the
frame. | 158 // size at minimum scale, since the viewport must always be contained by the
frame. |
159 IntSize frameSize(m_viewSize); | 159 IntSize frameSize(m_viewSize); |
160 frameSize.scale(1 / finalConstraints().minimumScale); | 160 frameSize.scale(1 / finalConstraints().minimumScale); |
161 return frameSize; | 161 return frameSize; |
162 } | 162 } |
163 | 163 |
164 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
ption& description, int layoutFallbackWidth, float deviceScaleFactor, bool suppo
rtTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool lo
adWithOverviewMode, bool nonUserScalableQuirkEnabled) | 164 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
ption& description, int layoutFallbackWidth, float deviceScaleFactor, bool suppo
rtTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool sh
rinksViewportContentToFit, bool nonUserScalableQuirkEnabled) |
165 { | 165 { |
166 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie
wMode && !nonUserScalableQuirkEnabled) | 166 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && shrinksViewport
ContentToFit && !nonUserScalableQuirkEnabled) |
167 return; | 167 return; |
168 | 168 |
169 const float oldInitialScale = m_pageDefinedConstraints.initialScale; | 169 const float oldInitialScale = m_pageDefinedConstraints.initialScale; |
170 if (!loadWithOverviewMode) { | 170 if (!shrinksViewportContentToFit) { |
171 bool resetInitialScale = false; | 171 bool resetInitialScale = false; |
172 if (description.zoom == -1) { | 172 if (description.zoom == -1) { |
173 if (description.maxWidth.isAuto() || description.maxWidth.type() ==
ExtendToZoom) | 173 if (description.maxWidth.isAuto() || description.maxWidth.type() ==
ExtendToZoom) |
174 resetInitialScale = true; | 174 resetInitialScale = true; |
175 if (useWideViewport || description.maxWidth.type() == DeviceWidth) | 175 if (useWideViewport || description.maxWidth.type() == DeviceWidth) |
176 resetInitialScale = true; | 176 resetInitialScale = true; |
177 } | 177 } |
178 if (resetInitialScale) | 178 if (resetInitialScale) |
179 m_pageDefinedConstraints.initialScale = 1.0f; | 179 m_pageDefinedConstraints.initialScale = 1.0f; |
180 } | 180 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 adjustedLayoutSizeWidth = m_viewSize.width() / targetDensityDPIFacto
r; | 228 adjustedLayoutSizeWidth = m_viewSize.width() / targetDensityDPIFacto
r; |
229 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); | 229 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); | 233 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
234 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); | 234 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
235 } | 235 } |
236 | 236 |
237 } // namespace WebCore | 237 } // namespace WebCore |
OLD | NEW |