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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 void PageScaleConstraintsSet::didChangeViewSize(const IntSize& size) | 136 void PageScaleConstraintsSet::didChangeViewSize(const IntSize& size) |
137 { | 137 { |
138 if (m_viewSize == size) | 138 if (m_viewSize == size) |
139 return; | 139 return; |
140 | 140 |
141 m_viewSize = size; | 141 m_viewSize = size; |
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(int contentWidthIncludingScrollba
r) const |
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 && contentWidthIncludingScrollbar |
152 && m_viewSize.width()) { | 152 && m_viewSize.width()) { |
153 return expandedIntSize(FloatSize(contentsSize.width(), computeHeightByAs
pectRatio(contentsSize.width(), m_viewSize))); | 153 return expandedIntSize(FloatSize( |
| 154 contentWidthIncludingScrollbar, |
| 155 computeHeightByAspectRatio(contentWidthIncludingScrollbar, m_viewSiz
e))); |
154 } | 156 } |
155 | 157 |
156 // If there is a minimum scale (or there's no content size yet), the frame s
ize should match the viewport | 158 // 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. | 159 // size at minimum scale, since the viewport must always be contained by the
frame. |
158 FloatSize frameSize(m_viewSize); | 160 FloatSize frameSize(m_viewSize); |
159 frameSize.scale(1 / finalConstraints().minimumScale); | 161 frameSize.scale(1 / finalConstraints().minimumScale); |
160 return expandedIntSize(frameSize); | 162 return expandedIntSize(frameSize); |
161 } | 163 } |
162 | 164 |
163 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
ption& description, int layoutFallbackWidth, float deviceScaleFactor, bool suppo
rtTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool lo
adWithOverviewMode, bool nonUserScalableQuirkEnabled) | 165 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
ption& description, int layoutFallbackWidth, float deviceScaleFactor, bool suppo
rtTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool lo
adWithOverviewMode, bool nonUserScalableQuirkEnabled) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 adjustedLayoutSizeWidth = m_viewSize.width() / targetDensityDPIFacto
r; | 229 adjustedLayoutSizeWidth = m_viewSize.width() / targetDensityDPIFacto
r; |
228 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); | 230 adjustedLayoutSizeHeight = computeHeightByAspectRatio(adjustedLayout
SizeWidth, m_viewSize); |
229 } | 231 } |
230 } | 232 } |
231 | 233 |
232 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); | 234 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
233 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); | 235 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
234 } | 236 } |
235 | 237 |
236 } // namespace blink | 238 } // namespace blink |
OLD | NEW |