| 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 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 updateMainFrameLayoutSize(); | 1680 updateMainFrameLayoutSize(); |
| 1681 | 1681 |
| 1682 // If the virtual viewport pinch mode is enabled, the main frame will be res
ized | 1682 // If the virtual viewport pinch mode is enabled, the main frame will be res
ized |
| 1683 // after layout so it can be sized to the contentsSize. | 1683 // after layout so it can be sized to the contentsSize. |
| 1684 if (!pinchVirtualViewportEnabled() && localFrameRootTemporary()->frameView()
) | 1684 if (!pinchVirtualViewportEnabled() && localFrameRootTemporary()->frameView()
) |
| 1685 localFrameRootTemporary()->frameView()->resize(m_size); | 1685 localFrameRootTemporary()->frameView()->resize(m_size); |
| 1686 | 1686 |
| 1687 if (pinchVirtualViewportEnabled()) | 1687 if (pinchVirtualViewportEnabled()) |
| 1688 page()->frameHost().pinchViewport().setSize(m_size); | 1688 page()->frameHost().pinchViewport().setSize(m_size); |
| 1689 | 1689 |
| 1690 // In case we didn't have a size when the top controls were updated. |
| 1691 didUpdateTopControls(); |
| 1692 |
| 1690 // When device emulation is enabled, device size values may change - they ar
e | 1693 // When device emulation is enabled, device size values may change - they ar
e |
| 1691 // usually set equal to the view size. These values are not considered viewp
ort-dependent | 1694 // usually set equal to the view size. These values are not considered viewp
ort-dependent |
| 1692 // (see MediaQueryExp::isViewportDependent), since they are only viewport-de
pendent in emulation mode, | 1695 // (see MediaQueryExp::isViewportDependent), since they are only viewport-de
pendent in emulation mode, |
| 1693 // and thus will not be invalidated in |FrameView::performPreLayoutTasks|. | 1696 // and thus will not be invalidated in |FrameView::performPreLayoutTasks|. |
| 1694 // Therefore we should force explicit media queries invalidation here. | 1697 // Therefore we should force explicit media queries invalidation here. |
| 1695 if (page()->inspectorController().deviceEmulationEnabled()) { | 1698 if (page()->inspectorController().deviceEmulationEnabled()) { |
| 1696 if (Document* document = localFrameRootTemporary()->frame()->document()) | 1699 if (Document* document = localFrameRootTemporary()->frame()->document()) |
| 1697 document->mediaQueryAffectingValueChanged(); | 1700 document->mediaQueryAffectingValueChanged(); |
| 1698 } | 1701 } |
| 1699 } | 1702 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1722 return; | 1725 return; |
| 1723 | 1726 |
| 1724 float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topContr
olsContentOffset; | 1727 float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topContr
olsContentOffset; |
| 1725 if (!pinchVirtualViewportEnabled()) { | 1728 if (!pinchVirtualViewportEnabled()) { |
| 1726 // The viewport bounds were adjusted on the compositor by this much due
to top controls. Tell | 1729 // The viewport bounds were adjusted on the compositor by this much due
to top controls. Tell |
| 1727 // the FrameView about it so it can make correct scroll offset clamping
decisions during compositor | 1730 // the FrameView about it so it can make correct scroll offset clamping
decisions during compositor |
| 1728 // commits. | 1731 // commits. |
| 1729 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment); | 1732 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment); |
| 1730 } else { | 1733 } else { |
| 1731 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); | 1734 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); |
| 1735 |
| 1736 if (pinchViewport.visibleRect().isEmpty()) |
| 1737 return; |
| 1738 |
| 1732 pinchViewport.setTopControlsAdjustment(topControlsViewportAdjustment); | 1739 pinchViewport.setTopControlsAdjustment(topControlsViewportAdjustment); |
| 1733 | 1740 |
| 1734 // Shrink the FrameView by the amount that will maintain the aspect-rati
o with the PinchViewport. | 1741 // Shrink the FrameView by the amount that will maintain the aspect-rati
o with the PinchViewport. |
| 1735 float aspectRatio = pinchViewport.visibleRect().width() / pinchViewport.
visibleRect().height(); | 1742 float aspectRatio = pinchViewport.visibleRect().width() / pinchViewport.
visibleRect().height(); |
| 1736 float newHeight = view->unscaledVisibleContentSize(ExcludeScrollbars).wi
dth() / aspectRatio; | 1743 float newHeight = view->unscaledVisibleContentSize(ExcludeScrollbars).wi
dth() / aspectRatio; |
| 1737 float adjustment = newHeight - view->unscaledVisibleContentSize(ExcludeS
crollbars).height(); | 1744 float adjustment = newHeight - view->unscaledVisibleContentSize(ExcludeS
crollbars).height(); |
| 1738 view->setTopControlsViewportAdjustment(adjustment); | 1745 view->setTopControlsViewportAdjustment(adjustment); |
| 1739 } | 1746 } |
| 1740 } | 1747 } |
| 1741 | 1748 |
| (...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4468 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4475 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4469 | 4476 |
| 4470 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4477 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4471 return false; | 4478 return false; |
| 4472 | 4479 |
| 4473 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4480 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4474 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4481 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4475 } | 4482 } |
| 4476 | 4483 |
| 4477 } // namespace blink | 4484 } // namespace blink |
| OLD | NEW |