| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 { | 133 { |
| 134 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie
wMode) | 134 if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOvervie
wMode) |
| 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 == Length(100, ViewportP
ercentageWidth)) |
| 144 resetInitialScale = true; | 144 resetInitialScale = true; |
| 145 } | 145 } |
| 146 if (resetInitialScale) | 146 if (resetInitialScale) |
| 147 m_pageDefinedConstraints.initialScale = 1.0f; | 147 m_pageDefinedConstraints.initialScale = 1.0f; |
| 148 } | 148 } |
| 149 | 149 |
| 150 float adjustedLayoutSizeWidth = m_pageDefinedConstraints.layoutSize.width(); | 150 float adjustedLayoutSizeWidth = m_pageDefinedConstraints.layoutSize.width(); |
| 151 float targetDensityDPIFactor = 1.0f; | 151 float targetDensityDPIFactor = 1.0f; |
| 152 | 152 |
| 153 if (supportTargetDensityDPI) { | 153 if (supportTargetDensityDPI) { |
| 154 targetDensityDPIFactor = computeDeprecatedTargetDensityDPIFactor(descrip
tion, deviceScaleFactor); | 154 targetDensityDPIFactor = computeDeprecatedTargetDensityDPIFactor(descrip
tion, deviceScaleFactor); |
| 155 if (m_pageDefinedConstraints.initialScale != -1) | 155 if (m_pageDefinedConstraints.initialScale != -1) |
| 156 m_pageDefinedConstraints.initialScale *= targetDensityDPIFactor; | 156 m_pageDefinedConstraints.initialScale *= targetDensityDPIFactor; |
| 157 m_pageDefinedConstraints.minimumScale *= targetDensityDPIFactor; | 157 m_pageDefinedConstraints.minimumScale *= targetDensityDPIFactor; |
| 158 m_pageDefinedConstraints.maximumScale *= targetDensityDPIFactor; | 158 m_pageDefinedConstraints.maximumScale *= targetDensityDPIFactor; |
| 159 if (wideViewportQuirkEnabled && (!useWideViewport || !description.maxWid
th.isFixed())) | 159 if (wideViewportQuirkEnabled && (!useWideViewport || description.maxWidt
h == Length(100, ViewportPercentageWidth))) |
| 160 adjustedLayoutSizeWidth /= targetDensityDPIFactor; | 160 adjustedLayoutSizeWidth /= targetDensityDPIFactor; |
| 161 } | 161 } |
| 162 | 162 |
| 163 if (wideViewportQuirkEnabled) { | 163 if (wideViewportQuirkEnabled) { |
| 164 if (useWideViewport && (description.maxWidth.isAuto() || description.max
Width.type() == ExtendToZoom) && description.zoom != 1.0f) { | 164 if (useWideViewport && (description.maxWidth.isAuto() || description.max
Width.type() == ExtendToZoom) && description.zoom != 1.0f) { |
| 165 adjustedLayoutSizeWidth = layoutFallbackWidth; | 165 adjustedLayoutSizeWidth = layoutFallbackWidth; |
| 166 } else if (!useWideViewport) { | 166 } else if (!useWideViewport) { |
| 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 (adjustedLayoutSizeWidth != m_pageDefinedConstraints.layoutSize.width())
{ | 177 if (adjustedLayoutSizeWidth != m_pageDefinedConstraints.layoutSize.width())
{ |
| 178 ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); | 178 ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0); |
| 179 float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefine
dConstraints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); | 179 float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefine
dConstraints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width(); |
| 180 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); | 180 m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth); |
| 181 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); | 181 m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace WebCore | 185 } // namespace WebCore |
| OLD | NEW |