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 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 updateMainFrameLayoutSize(); | 1686 updateMainFrameLayoutSize(); |
1687 | 1687 |
1688 // If the virtual viewport pinch mode is enabled, the main frame will be res
ized | 1688 // If the virtual viewport pinch mode is enabled, the main frame will be res
ized |
1689 // after layout so it can be sized to the contentsSize. | 1689 // after layout so it can be sized to the contentsSize. |
1690 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) | 1690 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) |
1691 mainFrameImpl()->frameView()->resize(m_size); | 1691 mainFrameImpl()->frameView()->resize(m_size); |
1692 | 1692 |
1693 if (pinchVirtualViewportEnabled()) | 1693 if (pinchVirtualViewportEnabled()) |
1694 page()->frameHost().pinchViewport().setSize(m_size); | 1694 page()->frameHost().pinchViewport().setSize(m_size); |
1695 | 1695 |
| 1696 if (mainFrameImpl()->frameView()) { |
| 1697 if (!mainFrameImpl()->frameView()->needsLayout()) |
| 1698 postLayoutResize(mainFrameImpl()); |
| 1699 } |
| 1700 |
1696 // When device emulation is enabled, device size values may change - they ar
e | 1701 // When device emulation is enabled, device size values may change - they ar
e |
1697 // usually set equal to the view size. These values are not considered viewp
ort-dependent | 1702 // usually set equal to the view size. These values are not considered viewp
ort-dependent |
1698 // (see MediaQueryExp::isViewportDependent), since they are only viewport-de
pendent in emulation mode, | 1703 // (see MediaQueryExp::isViewportDependent), since they are only viewport-de
pendent in emulation mode, |
1699 // and thus will not be invalidated in |FrameView::performPreLayoutTasks|. | 1704 // and thus will not be invalidated in |FrameView::performPreLayoutTasks|. |
1700 // Therefore we should force explicit media queries invalidation here. | 1705 // Therefore we should force explicit media queries invalidation here. |
1701 if (page()->inspectorController().deviceEmulationEnabled()) { | 1706 if (page()->inspectorController().deviceEmulationEnabled()) { |
1702 if (Document* document = mainFrameImpl()->frame()->document()) { | 1707 if (Document* document = mainFrameImpl()->frame()->document()) { |
1703 document->styleResolverChanged(); | 1708 document->styleResolverChanged(); |
1704 document->mediaQueryAffectingValueChanged(); | 1709 document->mediaQueryAffectingValueChanged(); |
1705 } | 1710 } |
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4006 | 4011 |
4007 void WebViewImpl::resumeTreeViewCommits() | 4012 void WebViewImpl::resumeTreeViewCommits() |
4008 { | 4013 { |
4009 if (m_layerTreeViewCommitsDeferred) { | 4014 if (m_layerTreeViewCommitsDeferred) { |
4010 if (m_layerTreeView) | 4015 if (m_layerTreeView) |
4011 m_layerTreeView->setDeferCommits(false); | 4016 m_layerTreeView->setDeferCommits(false); |
4012 m_layerTreeViewCommitsDeferred = false; | 4017 m_layerTreeViewCommitsDeferred = false; |
4013 } | 4018 } |
4014 } | 4019 } |
4015 | 4020 |
| 4021 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) |
| 4022 { |
| 4023 FrameView* view = webframe->frame()->view(); |
| 4024 if (pinchVirtualViewportEnabled()) { |
| 4025 if (webframe == mainFrame()) { |
| 4026 view->resize(mainFrameSize()); |
| 4027 } else { |
| 4028 view->resize(webframe->frameView()->layoutSize()); |
| 4029 } |
| 4030 } |
| 4031 } |
| 4032 |
4016 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) | 4033 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) |
4017 { | 4034 { |
4018 if (!m_client || !webframe->frame()->isLocalRoot()) | 4035 if (!m_client || !webframe->frame()->isLocalRoot()) |
4019 return; | 4036 return; |
4020 | 4037 |
4021 // If we finished a layout while in deferred commit mode, | 4038 // If we finished a layout while in deferred commit mode, |
4022 // that means it's time to start producing frames again so un-defer. | 4039 // that means it's time to start producing frames again so un-defer. |
4023 resumeTreeViewCommits(); | 4040 resumeTreeViewCommits(); |
4024 | 4041 |
4025 if (m_shouldAutoResize && webframe->frame() && webframe->frame()->view()) { | 4042 if (m_shouldAutoResize && webframe->frame() && webframe->frame()->view()) { |
4026 WebSize frameSize = webframe->frame()->view()->frameRect().size(); | 4043 WebSize frameSize = webframe->frame()->view()->frameRect().size(); |
4027 if (frameSize != m_size) { | 4044 if (frameSize != m_size) { |
4028 m_size = frameSize; | 4045 m_size = frameSize; |
4029 | 4046 |
4030 page()->frameHost().pinchViewport().setSize(m_size); | 4047 page()->frameHost().pinchViewport().setSize(m_size); |
4031 m_pageScaleConstraintsSet.didChangeViewSize(m_size); | 4048 m_pageScaleConstraintsSet.didChangeViewSize(m_size); |
4032 | 4049 |
4033 m_client->didAutoResize(m_size); | 4050 m_client->didAutoResize(m_size); |
4034 sendResizeEventAndRepaint(); | 4051 sendResizeEventAndRepaint(); |
4035 } | 4052 } |
4036 } | 4053 } |
4037 | 4054 |
4038 if (m_pageScaleConstraintsSet.constraintsDirty()) | 4055 if (m_pageScaleConstraintsSet.constraintsDirty()) |
4039 refreshPageScaleFactorAfterLayout(); | 4056 refreshPageScaleFactorAfterLayout(); |
4040 | 4057 |
4041 FrameView* view = webframe->frame()->view(); | 4058 FrameView* view = webframe->frame()->view(); |
4042 | 4059 |
4043 if (pinchVirtualViewportEnabled()) { | 4060 postLayoutResize(webframe); |
4044 if (webframe == mainFrame()) { | |
4045 view->resize(mainFrameSize()); | |
4046 } else { | |
4047 view->resize(webframe->frameView()->layoutSize()); | |
4048 } | |
4049 } | |
4050 | 4061 |
4051 // Relayout immediately to avoid violating the rule that needsLayout() | 4062 // Relayout immediately to avoid violating the rule that needsLayout() |
4052 // isn't set at the end of a layout. | 4063 // isn't set at the end of a layout. |
4053 if (view->needsLayout()) | 4064 if (view->needsLayout()) |
4054 view->layout(); | 4065 view->layout(); |
4055 | 4066 |
4056 // In case we didn't have a size when the top controls were updated. | 4067 // In case we didn't have a size when the top controls were updated. |
4057 didUpdateTopControls(); | 4068 didUpdateTopControls(); |
4058 | 4069 |
4059 m_client->didUpdateLayout(); | 4070 m_client->didUpdateLayout(); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4615 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4626 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4616 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4627 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4617 } | 4628 } |
4618 | 4629 |
4619 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4630 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4620 { | 4631 { |
4621 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4632 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4622 } | 4633 } |
4623 | 4634 |
4624 } // namespace blink | 4635 } // namespace blink |
OLD | NEW |