Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 if (!viewportSize.width() || !viewportSize.height()) | 649 if (!viewportSize.width() || !viewportSize.height()) |
| 650 return; | 650 return; |
| 651 | 651 |
| 652 ViewportAttributes computed = arguments.resolve(viewportSize, viewportSize, m_webView->page()->settings()->layoutFallbackWidth()); | 652 ViewportAttributes computed = arguments.resolve(viewportSize, viewportSize, m_webView->page()->settings()->layoutFallbackWidth()); |
| 653 restrictScaleFactorToInitialScaleIfNotUserScalable(computed); | 653 restrictScaleFactorToInitialScaleIfNotUserScalable(computed); |
| 654 | 654 |
| 655 if (m_webView->ignoreViewportTagMaximumScale()) { | 655 if (m_webView->ignoreViewportTagMaximumScale()) { |
| 656 computed.maximumScale = max(computed.maximumScale, m_webView->maxPageSca leFactor); | 656 computed.maximumScale = max(computed.maximumScale, m_webView->maxPageSca leFactor); |
| 657 computed.userScalable = true; | 657 computed.userScalable = true; |
| 658 } | 658 } |
| 659 if (arguments.zoom == ViewportArguments::ValueAuto && !m_webView->settingsIm pl()->initializeAtMinimumPageScale()) | 659 float initialScale = computed.initialScale; |
| 660 computed.initialScale = 1.0f; | 660 if (arguments.zoom == ViewportArguments::ValueAuto && !m_webView->settingsIm pl()->initializeAtMinimumPageScale()) { |
| 661 | 661 if (arguments.width == ViewportArguments::ValueAuto |
| 662 || (m_webView->settingsImpl()->useWideViewport() | |
| 663 && arguments.width != ViewportArguments::ValueAuto && arguments. width != ViewportArguments::ValueDeviceWidth)) | |
| 664 computed.initialScale = 1.0f; | |
| 665 } | |
| 662 if (m_webView->settingsImpl()->supportDeprecatedTargetDensityDPI()) { | 666 if (m_webView->settingsImpl()->supportDeprecatedTargetDensityDPI()) { |
| 667 bool applyTargetDensityDpiToLayoutSize = true; | |
|
abarth-chromium
2013/04/15 23:33:57
Dpi -> DPI
mnaganov (inactive)
2013/04/16 14:41:26
Done.
| |
| 668 if (!m_webView->settingsImpl()->useWideViewport()) { | |
| 669 if (arguments.zoom == ViewportArguments::ValueAuto) | |
| 670 computed.layoutSize.setWidth(viewportSize.width()); | |
| 671 else | |
| 672 computed.layoutSize.setWidth(viewportSize.width() / initialScale ); | |
| 673 } else { | |
| 674 if (arguments.width == ViewportArguments::ValueAuto && arguments.zoo m != 1.0f) { | |
| 675 computed.layoutSize.setWidth(m_webView->page()->settings()->layo utFallbackWidth()); | |
| 676 applyTargetDensityDpiToLayoutSize = false; | |
| 677 } | |
| 678 if (arguments.width != ViewportArguments::ValueAuto && arguments.wid th != ViewportArguments::ValueDeviceWidth) | |
| 679 applyTargetDensityDpiToLayoutSize = false; | |
| 680 } | |
|
abarth-chromium
2013/04/15 23:33:57
Why does this need to be so complicated? Can we s
mnaganov (inactive)
2013/04/16 14:41:26
I compared the resulting scales and widths of old
| |
| 663 float targetDensityDPIFactor = calculateTargetDensityDPIFactor(arguments , deviceScaleFactor); | 681 float targetDensityDPIFactor = calculateTargetDensityDPIFactor(arguments , deviceScaleFactor); |
| 664 computed.initialScale *= targetDensityDPIFactor; | 682 computed.initialScale *= targetDensityDPIFactor; |
| 665 computed.minimumScale *= targetDensityDPIFactor; | 683 computed.minimumScale *= targetDensityDPIFactor; |
| 666 computed.maximumScale *= targetDensityDPIFactor; | 684 computed.maximumScale *= targetDensityDPIFactor; |
| 667 computed.layoutSize.scale(1.0f / targetDensityDPIFactor); | 685 if (applyTargetDensityDpiToLayoutSize) |
| 686 computed.layoutSize.scale(1.0f / targetDensityDPIFactor); | |
| 668 } | 687 } |
| 669 | 688 |
| 670 m_webView->setInitialPageScaleFactor(computed.initialScale); | 689 m_webView->setInitialPageScaleFactor(computed.initialScale); |
| 671 m_webView->setFixedLayoutSize(flooredIntSize(computed.layoutSize)); | 690 m_webView->setFixedLayoutSize(flooredIntSize(computed.layoutSize)); |
| 672 m_webView->setDeviceScaleFactor(deviceScaleFactor); | 691 m_webView->setDeviceScaleFactor(deviceScaleFactor); |
| 673 m_webView->setPageScaleFactorLimits(computed.minimumScale, computed.maximumS cale); | 692 m_webView->setPageScaleFactorLimits(computed.minimumScale, computed.maximumS cale); |
| 674 #endif | 693 #endif |
| 675 } | 694 } |
| 676 | 695 |
| 677 void ChromeClientImpl::print(Frame* frame) | 696 void ChromeClientImpl::print(Frame* frame) |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1183 { | 1202 { |
| 1184 } | 1203 } |
| 1185 | 1204 |
| 1186 void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& sche me, const String& baseURL, const String& url, const String& title) | 1205 void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& sche me, const String& baseURL, const String& url, const String& title) |
| 1187 { | 1206 { |
| 1188 m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); | 1207 m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); |
| 1189 } | 1208 } |
| 1190 #endif | 1209 #endif |
| 1191 | 1210 |
| 1192 } // namespace WebKit | 1211 } // namespace WebKit |
| OLD | NEW |