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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 m_constraintsDirty = true; | 142 m_constraintsDirty = true; |
143 } | 143 } |
144 | 144 |
145 IntSize PageScaleConstraintsSet::mainFrameSize(const IntSize& contentsSize) cons
t | 145 IntSize PageScaleConstraintsSet::mainFrameSize(const IntSize& contentsSize) cons
t |
146 { | 146 { |
147 // If there's no explicit minimum scale factor set, size the frame so that i
ts width == content width | 147 // If there's no explicit minimum scale factor set, size the frame so that i
ts width == content width |
148 // so there's no horizontal scrolling at the minimum scale. | 148 // so there's no horizontal scrolling at the minimum scale. |
149 if (m_pageDefinedConstraints.minimumScale < finalConstraints().minimumScale | 149 if (m_pageDefinedConstraints.minimumScale < finalConstraints().minimumScale |
150 && m_userAgentConstraints.minimumScale < finalConstraints().minimumScale | 150 && m_userAgentConstraints.minimumScale < finalConstraints().minimumScale |
151 && contentsSize.width() | 151 && contentsSize.width() |
152 && m_viewSize.width()) | 152 && m_viewSize.width()) { |
153 return IntSize(contentsSize.width(), computeHeightByAspectRatio(contents
Size.width(), m_viewSize)); | 153 return expandedIntSize(FloatSize(contentsSize.width(), computeHeightByAs
pectRatio(contentsSize.width(), m_viewSize))); |
| 154 } |
154 | 155 |
155 // If there is a minimum scale (or there's no content size yet), the frame s
ize should match the viewport | 156 // If there is a minimum scale (or there's no content size yet), the frame s
ize should match the viewport |
156 // size at minimum scale, since the viewport must always be contained by the
frame. | 157 // size at minimum scale, since the viewport must always be contained by the
frame. |
157 IntSize frameSize(m_viewSize); | 158 FloatSize frameSize(m_viewSize); |
158 frameSize.scale(1 / finalConstraints().minimumScale); | 159 frameSize.scale(1 / finalConstraints().minimumScale); |
159 return frameSize; | 160 return expandedIntSize(frameSize); |
160 } | 161 } |
161 | 162 |
162 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
ption& description, int layoutFallbackWidth, float deviceScaleFactor, bool suppo
rtTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool lo
adWithOverviewMode, bool nonUserScalableQuirkEnabled) | 163 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
ption& description, int layoutFallbackWidth, float deviceScaleFactor, bool suppo
rtTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool lo
adWithOverviewMode, bool nonUserScalableQuirkEnabled) |
163 { | 164 { |
164 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie
wMode && !nonUserScalableQuirkEnabled) | 165 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie
wMode && !nonUserScalableQuirkEnabled) |
165 return; | 166 return; |
166 | 167 |
167 const float oldInitialScale = m_pageDefinedConstraints.initialScale; | 168 const float oldInitialScale = m_pageDefinedConstraints.initialScale; |
168 if (!loadWithOverviewMode) { | 169 if (!loadWithOverviewMode) { |
169 bool resetInitialScale = false; | 170 bool resetInitialScale = false; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 adjustedLayoutSizeWidth = m_viewSize.width() / targetDensityDPIFacto
r; | 227 adjustedLayoutSizeWidth = m_viewSize.width() / targetDensityDPIFacto
r; |
227 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); | 228 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); |
228 } | 229 } |
229 } | 230 } |
230 | 231 |
231 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); | 232 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
232 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); | 233 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
233 } | 234 } |
234 | 235 |
235 } // namespace blink | 236 } // namespace blink |
OLD | NEW |