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 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 | 1545 |
1546 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta
tionChanges() | 1546 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta
tionChanges() |
1547 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width; | 1547 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width; |
1548 | 1548 |
1549 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler()); | 1549 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler()); |
1550 if (shouldAnchorAndRescaleViewport) { | 1550 if (shouldAnchorAndRescaleViewport) { |
1551 viewportAnchor.setAnchor(view->visibleContentRect(), | 1551 viewportAnchor.setAnchor(view->visibleContentRect(), |
1552 FloatSize(viewportAnchorXCoord, viewportAnchorY
Coord)); | 1552 FloatSize(viewportAnchorXCoord, viewportAnchorY
Coord)); |
1553 } | 1553 } |
1554 | 1554 |
1555 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v
iewportDescription()); | 1555 { |
1556 updateMainFrameLayoutSize(); | 1556 // Avoids unnecessary invalidations while various bits of state in the F
TA are updated. |
| 1557 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); |
1557 | 1558 |
1558 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); | 1559 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document(
)->viewportDescription()); |
1559 if (agentPrivate) | 1560 updateMainFrameLayoutSize(); |
1560 agentPrivate->webViewResized(newSize); | 1561 |
1561 WebFrameImpl* webFrame = mainFrameImpl(); | 1562 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); |
1562 if (webFrame->frameView()) { | 1563 if (agentPrivate) |
1563 webFrame->frameView()->resize(m_size); | 1564 agentPrivate->webViewResized(newSize); |
1564 if (page()->settings().pinchVirtualViewportEnabled()) | 1565 WebFrameImpl* webFrame = mainFrameImpl(); |
1565 page()->frameHost().pinchViewport().setViewportSize(m_size); | 1566 if (webFrame->frameView()) { |
| 1567 webFrame->frameView()->resize(m_size); |
| 1568 if (page()->settings().pinchVirtualViewportEnabled()) |
| 1569 page()->frameHost().pinchViewport().setViewportSize(m_size); |
| 1570 } |
1566 } | 1571 } |
1567 | 1572 |
1568 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { | 1573 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { |
1569 // Relayout immediately to recalculate the minimum scale limit. | 1574 // Relayout immediately to recalculate the minimum scale limit. |
1570 if (view->needsLayout()) | 1575 if (view->needsLayout()) |
1571 view->layout(); | 1576 view->layout(); |
1572 | 1577 |
1573 if (shouldAnchorAndRescaleViewport) { | 1578 if (shouldAnchorAndRescaleViewport) { |
1574 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi
ze.width; | 1579 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi
ze.width; |
1575 float contentsWidthRatio = static_cast<float>(contentsSize().width()
) / oldContentsWidth; | 1580 float contentsWidthRatio = static_cast<float>(contentsSize().width()
) / oldContentsWidth; |
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3995 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4000 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
3996 | 4001 |
3997 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4002 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
3998 return false; | 4003 return false; |
3999 | 4004 |
4000 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4005 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4001 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4006 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4002 } | 4007 } |
4003 | 4008 |
4004 } // namespace blink | 4009 } // namespace blink |
OLD | NEW |