Chromium Code Reviews| 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 // Since the return value is multiplied by deviceScaleFactor and deviceScale Factor is displayDPI / 160.0 the below expands to: |
|
aelias_OOO_until_Jul13
2013/08/08 18:34:37
I suggest deleting this comment, I find it more di
mkosiba (inactive)
2013/08/09 09:35:25
Done.
| |
| 115 // (160.0f / targetDPI) * (displayDPI / 160.0f) which is the same as display DPI / targetDPI, which is what we want to determine. | |
| 116 return targetDPI > 0 ? 160.0f / targetDPI : 1.0f; | |
| 115 } | 117 } |
| 116 | 118 |
| 117 static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float initialScale) | 119 static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float initialScale) |
| 118 { | 120 { |
| 119 return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initia lScale; | 121 return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initia lScale; |
| 120 } | 122 } |
| 121 | 123 |
| 122 void PageScaleConstraintsSet::adjustPageDefinedConstraintsForAndroidWebView(cons t ViewportArguments& arguments, IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool useWideViewport, bool loadWithOverviewMode) | 124 void PageScaleConstraintsSet::adjustPageDefinedConstraintsForAndroidWebView(cons t ViewportArguments& arguments, IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool useWideViewport, bool loadWithOverviewMode) |
| 123 { | 125 { |
| 124 float initialScale = m_pageDefinedConstraints.initialScale; | 126 float initialScale = m_pageDefinedConstraints.initialScale; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 143 adjustedLayoutSizeWidth /= targetDensityDPIFactor; | 145 adjustedLayoutSizeWidth /= targetDensityDPIFactor; |
| 144 } | 146 } |
| 145 | 147 |
| 146 ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); | 148 ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); |
| 147 float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefinedCon straints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); | 149 float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefinedCon straints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); |
| 148 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); | 150 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
| 149 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); | 151 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
| 150 } | 152 } |
| 151 | 153 |
| 152 } // namespace WebCore | 154 } // namespace WebCore |
| OLD | NEW |