Chromium Code Reviews| 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 2982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2993 | 2993 |
| 2994 void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScal e) | 2994 void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScal e) |
| 2995 { | 2995 { |
| 2996 if (minPageScale == m_pageDefinedMinimumPageScaleFactor && maxPageScale == m _pageDefinedMaximumPageScaleFactor) | 2996 if (minPageScale == m_pageDefinedMinimumPageScaleFactor && maxPageScale == m _pageDefinedMaximumPageScaleFactor) |
| 2997 return; | 2997 return; |
| 2998 | 2998 |
| 2999 m_pageDefinedMinimumPageScaleFactor = minPageScale; | 2999 m_pageDefinedMinimumPageScaleFactor = minPageScale; |
| 3000 m_pageDefinedMaximumPageScaleFactor = maxPageScale; | 3000 m_pageDefinedMaximumPageScaleFactor = maxPageScale; |
| 3001 | 3001 |
| 3002 if (settings()->viewportEnabled()) { | 3002 if (settings()->viewportEnabled()) { |
| 3003 // If we're in viewport tag mode, we need to layout to obtain the latest | 3003 // If we're in viewport tag mode, we need to layout to obtain the latest |
|
aelias_OOO_until_Jul13
2013/04/30 21:05:18
OK, in that case, can you also remove the conditio
| |
| 3004 // contents size and compute the final limits. | 3004 // contents size and compute the final limits. |
| 3005 FrameView* view = mainFrameImpl()->frameView(); | 3005 FrameView* view = mainFrameImpl()->frameView(); |
| 3006 if (view) | 3006 if (view) |
| 3007 view->setNeedsLayout(); | 3007 view->setNeedsLayout(); |
| 3008 } else { | 3008 } else { |
| 3009 // Otherwise just compute the limits immediately. | 3009 // Otherwise just compute the limits immediately. |
| 3010 computePageScaleFactorLimits(); | 3010 computePageScaleFactorLimits(); |
| 3011 } | 3011 } |
| 3012 } | 3012 } |
| 3013 | 3013 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3656 | 3656 |
| 3657 if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame ()->view()) { | 3657 if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame ()->view()) { |
| 3658 WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size() ; | 3658 WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size() ; |
| 3659 if (frameSize != m_size) { | 3659 if (frameSize != m_size) { |
| 3660 m_size = frameSize; | 3660 m_size = frameSize; |
| 3661 m_client->didAutoResize(m_size); | 3661 m_client->didAutoResize(m_size); |
| 3662 sendResizeEventAndRepaint(); | 3662 sendResizeEventAndRepaint(); |
| 3663 } | 3663 } |
| 3664 } | 3664 } |
| 3665 | 3665 |
| 3666 if (settings()->viewportEnabled()) { | 3666 if (settings()->viewportEnabled() && !isPageScaleFactorSet()) { |
| 3667 if (!isPageScaleFactorSet()) { | 3667 // If the viewport tag failed to be processed earlier, we need |
| 3668 // If the viewport tag failed to be processed earlier, we need | 3668 // to recompute it now. |
| 3669 // to recompute it now. | 3669 ViewportArguments viewportArguments = mainFrameImpl()->frame()->document ()->viewportArguments(); |
| 3670 ViewportArguments viewportArguments = mainFrameImpl()->frame()->docu ment()->viewportArguments(); | 3670 m_page->chrome()->client()->dispatchViewportPropertiesDidChange(viewport Arguments); |
| 3671 m_page->chrome()->client()->dispatchViewportPropertiesDidChange(view portArguments); | 3671 } |
| 3672 } | |
| 3673 | 3672 |
| 3674 // Contents size is an input to the page scale limits, so a good time to | 3673 // Contents size is an input to the page scale limits, so a good time to |
| 3675 // recalculate is after layout has occurred. | 3674 // recalculate is after layout has occurred. |
| 3676 computePageScaleFactorLimits(); | 3675 computePageScaleFactorLimits(); |
| 3677 | 3676 |
| 3678 // Relayout immediately to avoid violating the rule that needsLayout() | 3677 // Relayout immediately to avoid violating the rule that needsLayout() |
| 3679 // isn't set at the end of a layout. | 3678 // isn't set at the end of a layout. |
| 3680 FrameView* view = mainFrameImpl()->frameView(); | 3679 FrameView* view = mainFrameImpl()->frameView(); |
| 3681 if (view && view->needsLayout()) | 3680 if (view && view->needsLayout()) |
| 3682 view->layout(); | 3681 view->layout(); |
| 3683 } | |
| 3684 | 3682 |
| 3685 m_client->didUpdateLayout(); | 3683 m_client->didUpdateLayout(); |
| 3686 | 3684 |
| 3687 } | 3685 } |
| 3688 | 3686 |
| 3689 void WebViewImpl::didChangeContentsSize() | 3687 void WebViewImpl::didChangeContentsSize() |
| 3690 { | 3688 { |
| 3691 } | 3689 } |
| 3692 | 3690 |
| 3693 void WebViewImpl::deviceOrPageScaleFactorChanged() | 3691 void WebViewImpl::deviceOrPageScaleFactorChanged() |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4210 } | 4208 } |
| 4211 | 4209 |
| 4212 bool WebViewImpl::shouldDisableDesktopWorkarounds() | 4210 bool WebViewImpl::shouldDisableDesktopWorkarounds() |
| 4213 { | 4211 { |
| 4214 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); | 4212 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); |
| 4215 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom | 4213 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom |
| 4216 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); | 4214 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); |
| 4217 } | 4215 } |
| 4218 | 4216 |
| 4219 } // namespace WebKit | 4217 } // namespace WebKit |
| OLD | NEW |