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