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 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document(
)->viewportDescription()); | 1612 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document(
)->viewportDescription()); |
1613 updateMainFrameLayoutSize(); | 1613 updateMainFrameLayoutSize(); |
1614 | 1614 |
1615 // If the virtual viewport pinch mode is enabled, the main frame will be
resized | 1615 // If the virtual viewport pinch mode is enabled, the main frame will be
resized |
1616 // after layout so it can be sized to the contentsSize. | 1616 // after layout so it can be sized to the contentsSize. |
1617 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) | 1617 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) |
1618 mainFrameImpl()->frameView()->resize(m_size); | 1618 mainFrameImpl()->frameView()->resize(m_size); |
1619 | 1619 |
1620 if (pinchVirtualViewportEnabled()) | 1620 if (pinchVirtualViewportEnabled()) |
1621 page()->frameHost().pinchViewport().setSize(m_size); | 1621 page()->frameHost().pinchViewport().setSize(m_size); |
| 1622 |
| 1623 // When device emulation is enabled, device size values may change - the
y are |
| 1624 // usually set equal to the view size. These values are not considered v
iewport-dependent |
| 1625 // (see MediaQueryExp::isViewportDependent), since they are only viewpor
t-dependent in emulation mode, |
| 1626 // and thus will not be invalidated in |FrameView::performPreLayoutTasks
|. |
| 1627 // Therefore we should force explicit media queries invalidation here. |
| 1628 if (page()->inspectorController().deviceEmulationEnabled()) { |
| 1629 if (Document* document = mainFrameImpl()->frame()->document()) |
| 1630 document->mediaQueryAffectingValueChanged(); |
| 1631 } |
1622 } | 1632 } |
1623 | 1633 |
1624 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { | 1634 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { |
1625 // Relayout immediately to recalculate the minimum scale limit. | 1635 // Relayout immediately to recalculate the minimum scale limit. |
1626 if (view->needsLayout()) | 1636 if (view->needsLayout()) |
1627 view->layout(); | 1637 view->layout(); |
1628 | 1638 |
1629 if (shouldAnchorAndRescaleViewport) { | 1639 if (shouldAnchorAndRescaleViewport) { |
1630 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi
ze.width; | 1640 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi
ze.width; |
1631 float contentsWidthRatio = static_cast<float>(contentsSize().width()
) / oldContentsWidth; | 1641 float contentsWidthRatio = static_cast<float>(contentsSize().width()
) / oldContentsWidth; |
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4143 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4153 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4144 | 4154 |
4145 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4155 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4146 return false; | 4156 return false; |
4147 | 4157 |
4148 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4158 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4149 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4159 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4150 } | 4160 } |
4151 | 4161 |
4152 } // namespace blink | 4162 } // namespace blink |
OLD | NEW |