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