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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 float targetDPI = -1.0f; | 105 float targetDPI = -1.0f; |
106 if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueLowDPI) | 106 if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueLowDPI) |
107 targetDPI = 120.0f; | 107 targetDPI = 120.0f; |
108 else if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueMed
iumDPI) | 108 else if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueMed
iumDPI) |
109 targetDPI = 160.0f; | 109 targetDPI = 160.0f; |
110 else if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueHig
hDPI) | 110 else if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueHig
hDPI) |
111 targetDPI = 240.0f; | 111 targetDPI = 240.0f; |
112 else if (arguments.deprecatedTargetDensityDPI != ViewportArguments::ValueAut
o) | 112 else if (arguments.deprecatedTargetDensityDPI != ViewportArguments::ValueAut
o) |
113 targetDPI = arguments.deprecatedTargetDensityDPI; | 113 targetDPI = arguments.deprecatedTargetDensityDPI; |
114 return targetDPI > 0 ? (deviceScaleFactor * 120.0f) / targetDPI : 1.0f; | 114 return targetDPI > 0 ? 160.0f / targetDPI : 1.0f; |
115 } | 115 } |
116 | 116 |
117 static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float
initialScale) | 117 static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float
initialScale) |
118 { | 118 { |
119 return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initia
lScale; | 119 return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initia
lScale; |
120 } | 120 } |
121 | 121 |
122 void PageScaleConstraintsSet::adjustPageDefinedConstraintsForAndroidWebView(cons
t ViewportArguments& arguments, IntSize viewSize, int layoutFallbackWidth, float
deviceScaleFactor, bool useWideViewport, bool loadWithOverviewMode) | 122 void PageScaleConstraintsSet::adjustPageDefinedConstraintsForAndroidWebView(cons
t ViewportArguments& arguments, IntSize viewSize, int layoutFallbackWidth, float
deviceScaleFactor, bool useWideViewport, bool loadWithOverviewMode) |
123 { | 123 { |
124 float initialScale = m_pageDefinedConstraints.initialScale; | 124 float initialScale = m_pageDefinedConstraints.initialScale; |
(...skipping 18 matching lines...) Expand all Loading... |
143 adjustedLayoutSizeWidth /= targetDensityDPIFactor; | 143 adjustedLayoutSizeWidth /= targetDensityDPIFactor; |
144 } | 144 } |
145 | 145 |
146 ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); | 146 ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); |
147 float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefinedCon
straints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); | 147 float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefinedCon
straints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); |
148 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); | 148 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
149 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); | 149 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
150 } | 150 } |
151 | 151 |
152 } // namespace WebCore | 152 } // namespace WebCore |
OLD | NEW |