OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 3193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3204 { | 3204 { |
3205 ASSERT(page()); | 3205 ASSERT(page()); |
3206 | 3206 |
3207 scaleFactor = clampPageScaleFactorToLimits(scaleFactor); | 3207 scaleFactor = clampPageScaleFactorToLimits(scaleFactor); |
3208 if (scaleFactor == pageScaleFactor()) | 3208 if (scaleFactor == pageScaleFactor()) |
3209 return; | 3209 return; |
3210 | 3210 |
3211 page()->frameHost().visualViewport().setScale(scaleFactor); | 3211 page()->frameHost().visualViewport().setScale(scaleFactor); |
3212 } | 3212 } |
3213 | 3213 |
3214 float WebViewImpl::deviceScaleFactor() const | |
3215 { | |
3216 if (!page()) | |
3217 return 1; | |
3218 | |
3219 return page()->deviceScaleFactor(); | |
3220 } | |
3221 | |
3222 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) | 3214 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) |
3223 { | 3215 { |
3224 if (!page()) | 3216 if (!page()) |
3225 return; | 3217 return; |
3226 | 3218 |
3227 page()->setDeviceScaleFactor(scaleFactor); | 3219 page()->setDeviceScaleFactor(scaleFactor); |
3228 | 3220 |
3229 if (m_layerTreeView) | 3221 if (m_layerTreeView) |
3230 updateLayerTreeDeviceScaleFactor(); | 3222 updateLayerTreeDeviceScaleFactor(); |
3231 } | 3223 } |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4625 | 4617 |
4626 void WebViewImpl::detachPaintArtifactCompositor() | 4618 void WebViewImpl::detachPaintArtifactCompositor() |
4627 { | 4619 { |
4628 if (!m_layerTreeView) | 4620 if (!m_layerTreeView) |
4629 return; | 4621 return; |
4630 | 4622 |
4631 m_layerTreeView->setDeferCommits(true); | 4623 m_layerTreeView->setDeferCommits(true); |
4632 m_layerTreeView->clearRootLayer(); | 4624 m_layerTreeView->clearRootLayer(); |
4633 } | 4625 } |
4634 | 4626 |
| 4627 float WebViewImpl::deviceScaleFactor() const |
| 4628 { |
| 4629 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
| 4630 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
| 4631 if (!page()) |
| 4632 return 1; |
| 4633 |
| 4634 return page()->deviceScaleFactor(); |
| 4635 } |
| 4636 |
4635 } // namespace blink | 4637 } // namespace blink |
OLD | NEW |