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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 m_constraintsDirty = true; | 51 m_constraintsDirty = true; |
52 } | 52 } |
53 | 53 |
54 const PageScaleConstraints& PageScaleConstraintsSet::defaultConstraints() const | 54 const PageScaleConstraints& PageScaleConstraintsSet::defaultConstraints() const |
55 { | 55 { |
56 return m_defaultConstraints; | 56 return m_defaultConstraints; |
57 } | 57 } |
58 | 58 |
59 void PageScaleConstraintsSet::updatePageDefinedConstraints(const ViewportDescrip
tion& description, Length legacyFallbackWidth) | 59 void PageScaleConstraintsSet::updatePageDefinedConstraints(const ViewportDescrip
tion& description, Length legacyFallbackWidth) |
60 { | 60 { |
61 m_pageDefinedConstraints = description.resolve(m_viewSize, legacyFallbackWid
th); | 61 m_pageDefinedConstraints = description.resolve(FloatSize(m_viewSize), legacy
FallbackWidth); |
62 | 62 |
63 m_constraintsDirty = true; | 63 m_constraintsDirty = true; |
64 } | 64 } |
65 | 65 |
66 void PageScaleConstraintsSet::clearPageDefinedConstraints() | 66 void PageScaleConstraintsSet::clearPageDefinedConstraints() |
67 { | 67 { |
68 m_pageDefinedConstraints = PageScaleConstraints(); | 68 m_pageDefinedConstraints = PageScaleConstraints(); |
69 m_constraintsDirty = true; | 69 m_constraintsDirty = true; |
70 } | 70 } |
71 | 71 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 if (wideViewportQuirkEnabled && (!useWideViewport || description.maxWidt
h.type() == DeviceWidth)) { | 209 if (wideViewportQuirkEnabled && (!useWideViewport || description.maxWidt
h.type() == DeviceWidth)) { |
210 adjustedLayoutSizeWidth /= targetDensityDPIFactor; | 210 adjustedLayoutSizeWidth /= targetDensityDPIFactor; |
211 adjustedLayoutSizeHeight /= targetDensityDPIFactor; | 211 adjustedLayoutSizeHeight /= targetDensityDPIFactor; |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 if (wideViewportQuirkEnabled) { | 215 if (wideViewportQuirkEnabled) { |
216 if (useWideViewport && (description.maxWidth.isAuto() || description.max
Width.type() == ExtendToZoom) && description.zoom != 1.0f) { | 216 if (useWideViewport && (description.maxWidth.isAuto() || description.max
Width.type() == ExtendToZoom) && description.zoom != 1.0f) { |
217 if (layoutFallbackWidth) | 217 if (layoutFallbackWidth) |
218 adjustedLayoutSizeWidth = layoutFallbackWidth; | 218 adjustedLayoutSizeWidth = layoutFallbackWidth; |
219 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); | 219 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, FloatSize(m_viewSize)); |
220 } else if (!useWideViewport) { | 220 } else if (!useWideViewport) { |
221 const float nonWideScale = description.zoom < 1 && description.maxWi
dth.type() != DeviceWidth && description.maxWidth.type() != DeviceHeight ? -1 :
oldInitialScale; | 221 const float nonWideScale = description.zoom < 1 && description.maxWi
dth.type() != DeviceWidth && description.maxWidth.type() != DeviceHeight ? -1 :
oldInitialScale; |
222 adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(m_viewSiz
e, nonWideScale) / targetDensityDPIFactor; | 222 adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(FloatSize
(m_viewSize), nonWideScale) / targetDensityDPIFactor; |
223 float newInitialScale = targetDensityDPIFactor; | 223 float newInitialScale = targetDensityDPIFactor; |
224 if (m_userAgentConstraints.initialScale != -1 && (description.maxWid
th.type() == DeviceWidth || ((description.maxWidth.isAuto() || description.maxWi
dth.type() == ExtendToZoom) && description.zoom == -1))) { | 224 if (m_userAgentConstraints.initialScale != -1 && (description.maxWid
th.type() == DeviceWidth || ((description.maxWidth.isAuto() || description.maxWi
dth.type() == ExtendToZoom) && description.zoom == -1))) { |
225 adjustedLayoutSizeWidth /= m_userAgentConstraints.initialScale; | 225 adjustedLayoutSizeWidth /= m_userAgentConstraints.initialScale; |
226 newInitialScale = m_userAgentConstraints.initialScale; | 226 newInitialScale = m_userAgentConstraints.initialScale; |
227 } | 227 } |
228 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); | 228 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, FloatSize(m_viewSize)); |
229 if (description.zoom < 1) { | 229 if (description.zoom < 1) { |
230 m_pageDefinedConstraints.initialScale = newInitialScale; | 230 m_pageDefinedConstraints.initialScale = newInitialScale; |
231 if (m_pageDefinedConstraints.minimumScale != -1) | 231 if (m_pageDefinedConstraints.minimumScale != -1) |
232 m_pageDefinedConstraints.minimumScale = std::min<float>(m_pa
geDefinedConstraints.minimumScale, m_pageDefinedConstraints.initialScale); | 232 m_pageDefinedConstraints.minimumScale = std::min<float>(m_pa
geDefinedConstraints.minimumScale, m_pageDefinedConstraints.initialScale); |
233 if (m_pageDefinedConstraints.maximumScale != -1) | 233 if (m_pageDefinedConstraints.maximumScale != -1) |
234 m_pageDefinedConstraints.maximumScale = std::max<float>(m_pa
geDefinedConstraints.maximumScale, m_pageDefinedConstraints.initialScale); | 234 m_pageDefinedConstraints.maximumScale = std::max<float>(m_pa
geDefinedConstraints.maximumScale, m_pageDefinedConstraints.initialScale); |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 if (nonUserScalableQuirkEnabled && !description.userZoom) { | 239 if (nonUserScalableQuirkEnabled && !description.userZoom) { |
240 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor; | 240 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor; |
241 m_pageDefinedConstraints.minimumScale = m_pageDefinedConstraints.initial
Scale; | 241 m_pageDefinedConstraints.minimumScale = m_pageDefinedConstraints.initial
Scale; |
242 m_pageDefinedConstraints.maximumScale = m_pageDefinedConstraints.initial
Scale; | 242 m_pageDefinedConstraints.maximumScale = m_pageDefinedConstraints.initial
Scale; |
243 if (description.maxWidth.isAuto() || description.maxWidth.type() == Exte
ndToZoom || description.maxWidth.type() == DeviceWidth) { | 243 if (description.maxWidth.isAuto() || description.maxWidth.type() == Exte
ndToZoom || description.maxWidth.type() == DeviceWidth) { |
244 adjustedLayoutSizeWidth = m_viewSize.width() / targetDensityDPIFacto
r; | 244 adjustedLayoutSizeWidth = m_viewSize.width() / targetDensityDPIFacto
r; |
245 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); | 245 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, FloatSize(m_viewSize)); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); | 249 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
250 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); | 250 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
251 } | 251 } |
252 | 252 |
253 } // namespace blink | 253 } // namespace blink |
OLD | NEW |