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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 else if (description.deprecatedTargetDensityDPI != ViewportDescription::Valu eAuto) | 122 else if (description.deprecatedTargetDensityDPI != ViewportDescription::Valu eAuto) |
123 targetDPI = description.deprecatedTargetDensityDPI; | 123 targetDPI = description.deprecatedTargetDensityDPI; |
124 return targetDPI > 0 ? 160.0f / targetDPI : 1.0f; | 124 return targetDPI > 0 ? 160.0f / targetDPI : 1.0f; |
125 } | 125 } |
126 | 126 |
127 static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float initialScale) | 127 static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float initialScale) |
128 { | 128 { |
129 return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initia lScale; | 129 return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initia lScale; |
130 } | 130 } |
131 | 131 |
132 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri ption& description, IntSize viewSize, int layoutFallbackWidth, float deviceScale Factor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWid eViewport, bool loadWithOverviewMode) | 132 void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri ption& description, IntSize viewSize, int layoutFallbackWidth, float deviceScale Factor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWid eViewport, bool loadWithOverviewMode, bool nonUserScalableQuirkEnabled) |
133 { | 133 { |
134 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie wMode) | 134 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie wMode && !nonUserScalableQuirkEnabled) |
135 return; | 135 return; |
136 | 136 |
137 const float oldInitialScale = m_pageDefinedConstraints.initialScale; | 137 const float oldInitialScale = m_pageDefinedConstraints.initialScale; |
138 if (!loadWithOverviewMode) { | 138 if (!loadWithOverviewMode) { |
139 bool resetInitialScale = false; | 139 bool resetInitialScale = false; |
140 if (description.zoom == -1) { | 140 if (description.zoom == -1) { |
141 if (description.maxWidth.isAuto()) | 141 if (description.maxWidth.isAuto()) |
142 resetInitialScale = true; | 142 resetInitialScale = true; |
143 if (useWideViewport || !description.maxWidth.isFixed()) | 143 if (useWideViewport || !description.maxWidth.isFixed()) |
144 resetInitialScale = true; | 144 resetInitialScale = true; |
(...skipping 22 matching lines...) Expand all Loading... | |
167 const float nonWideScale = description.zoom < 1 && !description.maxW idth.isViewportPercentage() ? -1 : oldInitialScale; | 167 const float nonWideScale = description.zoom < 1 && !description.maxW idth.isViewportPercentage() ? -1 : oldInitialScale; |
168 adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, nonWideScale) / targetDensityDPIFactor; | 168 adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, nonWideScale) / targetDensityDPIFactor; |
169 if (description.zoom < 1) { | 169 if (description.zoom < 1) { |
170 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor; | 170 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor; |
171 m_pageDefinedConstraints.minimumScale = std::min<float>(m_pageDe finedConstraints.minimumScale, m_pageDefinedConstraints.initialScale); | 171 m_pageDefinedConstraints.minimumScale = std::min<float>(m_pageDe finedConstraints.minimumScale, m_pageDefinedConstraints.initialScale); |
172 m_pageDefinedConstraints.maximumScale = std::max<float>(m_pageDe finedConstraints.maximumScale, m_pageDefinedConstraints.initialScale); | 172 m_pageDefinedConstraints.maximumScale = std::max<float>(m_pageDe finedConstraints.maximumScale, m_pageDefinedConstraints.initialScale); |
173 } | 173 } |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 if (nonUserScalableQuirkEnabled && !description.userZoom) { | |
178 m_pageDefinedConstraints.initialScale = targetDensityDPIFactor; | |
179 if (description.maxWidth.isAuto() || description.maxWidth.type() == Exte ndToZoom || description.maxWidth == Length(100, ViewportPercentageWidth)) | |
180 adjustedLayoutSizeWidth = viewSize.width() / targetDensityDPIFactor; | |
181 } | |
182 | |
183 if (!description.userZoom) { | |
aelias_OOO_until_Jul13
2013/11/05 19:39:09
On second thought, let's also add "&& m_pageDefine
mnaganov (inactive)
2013/11/06 09:53:07
Done.
| |
184 m_pageDefinedConstraints.minimumScale = m_pageDefinedConstraints.initial Scale; | |
185 m_pageDefinedConstraints.maximumScale = m_pageDefinedConstraints.initial Scale; | |
186 } | |
187 | |
177 if (adjustedLayoutSizeWidth != m_pageDefinedConstraints.layoutSize.width()) { | 188 if (adjustedLayoutSizeWidth != m_pageDefinedConstraints.layoutSize.width()) { |
178 ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); | 189 ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); |
179 float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefine dConstraints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); | 190 float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefine dConstraints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); |
180 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); | 191 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
181 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); | 192 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
182 } | 193 } |
183 } | 194 } |
184 | 195 |
185 } // namespace WebCore | 196 } // namespace WebCore |
OLD | NEW |