Chromium Code Reviews| 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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1582 } | 1582 } |
| 1583 | 1583 |
| 1584 void WebViewImpl::resizePinchViewport(const WebSize& newSize) | 1584 void WebViewImpl::resizePinchViewport(const WebSize& newSize) |
| 1585 { | 1585 { |
| 1586 if (!pinchVirtualViewportEnabled()) | 1586 if (!pinchVirtualViewportEnabled()) |
| 1587 return; | 1587 return; |
| 1588 | 1588 |
| 1589 page()->frameHost().pinchViewport().setSize(newSize); | 1589 page()->frameHost().pinchViewport().setSize(newSize); |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 WebLocalFrameImpl* WebViewImpl::localFrameRootTemporary() | |
| 1593 { | |
| 1594 // FIXME: This is a temporary method that finds the first localFrame in a tr aversal. | |
| 1595 // This is equivalent to mainFrame() if the mainFrame is in-process. We need to create | |
| 1596 // separate WebWidgets to be created by RenderWidgets, which are associated with *all* | |
| 1597 // local frame roots, not just the first one in the tree. Until then, this l imits us | |
| 1598 // to having only one functioning connected LocalFrame subtree per process. | |
| 1599 for (WebCore::Frame* frame = page()->mainFrame(); frame; frame = frame->tree ().traverseNext()) { | |
| 1600 if (frame->isLocalRoot()) | |
| 1601 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); | |
| 1602 } | |
| 1603 return 0; | |
| 1604 } | |
| 1605 | |
| 1592 void WebViewImpl::resize(const WebSize& newSize) | 1606 void WebViewImpl::resize(const WebSize& newSize) |
| 1593 { | 1607 { |
| 1594 if (m_shouldAutoResize || m_size == newSize) | 1608 if (m_shouldAutoResize || m_size == newSize) |
| 1595 return; | 1609 return; |
| 1596 | 1610 |
| 1597 FrameView* view = mainFrameImpl()->frameView(); | 1611 FrameView* view = localFrameRootTemporary()->frameView(); |
| 1598 if (!view) | 1612 if (!view) |
| 1599 return; | 1613 return; |
| 1600 | 1614 |
| 1601 WebSize oldSize = m_size; | 1615 WebSize oldSize = m_size; |
| 1602 float oldPageScaleFactor = pageScaleFactor(); | 1616 float oldPageScaleFactor = pageScaleFactor(); |
| 1603 int oldContentsWidth = contentsSize().width(); | 1617 int oldContentsWidth = contentsSize().width(); |
| 1604 | 1618 |
| 1605 m_size = newSize; | 1619 m_size = newSize; |
| 1606 | 1620 |
| 1607 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges() | 1621 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges() |
| 1608 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width & & !m_fullscreenController->isFullscreen(); | 1622 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width & & !m_fullscreenController->isFullscreen(); |
| 1609 | 1623 |
| 1610 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler()); | 1624 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler()); |
| 1611 if (shouldAnchorAndRescaleViewport) { | 1625 if (shouldAnchorAndRescaleViewport) { |
| 1612 viewportAnchor.setAnchor(view->visibleContentRect(), | 1626 viewportAnchor.setAnchor(view->visibleContentRect(), |
| 1613 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord)); | 1627 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord)); |
| 1614 } | 1628 } |
| 1615 | 1629 |
| 1616 { | 1630 { |
| 1617 // Avoids unnecessary invalidations while various bits of state in FastT extAutosizer are updated. | 1631 // FIXME: FastTextAutosizer does not yet support out-of-process frames. |
|
eseidel
2014/07/11 16:33:03
Might want to keep +pdr in the loop.
pdr.
2014/07/11 17:14:52
Nice catch eseidel!
@kenrb, please file a bug for
kenrb
2014/07/11 20:03:33
Filed (https://code.google.com/p/chromium/issues/d
| |
| 1618 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); | 1632 if (!mainFrameImpl()->frame()->isLocalFrame()) { |
|
skobes
2014/07/11 19:05:28
This check doesn't make sense in the context of th
| |
| 1633 // Avoids unnecessary invalidations while various bits of state in F astTextAutosizer are updated. | |
| 1634 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); | |
|
skobes
2014/07/11 19:05:28
Putting this inside the brace scope of the 'if' ma
kenrb
2014/07/11 20:03:33
Good catch, this is an error. The ! should not be
skobes
2014/07/11 20:30:36
The ! is one issue. The other issue is that Defer
dcheng
2014/07/11 21:22:52
I thought fast text-autosizing only ran on mobile?
| |
| 1635 } | |
| 1619 | 1636 |
| 1620 m_pageScaleConstraintsSet.didChangeViewSize(m_size); | 1637 m_pageScaleConstraintsSet.didChangeViewSize(m_size); |
| 1621 | 1638 |
| 1622 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription()); | 1639 updatePageDefinedViewportConstraints(localFrameRootTemporary()->frame()- >document()->viewportDescription()); |
| 1623 updateMainFrameLayoutSize(); | 1640 updateMainFrameLayoutSize(); |
| 1624 | 1641 |
| 1625 // If the virtual viewport pinch mode is enabled, the main frame will be resized | 1642 // If the virtual viewport pinch mode is enabled, the main frame will be resized |
| 1626 // after layout so it can be sized to the contentsSize. | 1643 // after layout so it can be sized to the contentsSize. |
| 1627 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) | 1644 if (!pinchVirtualViewportEnabled() && localFrameRootTemporary()->frameVi ew()) |
| 1628 mainFrameImpl()->frameView()->resize(m_size); | 1645 localFrameRootTemporary()->frameView()->resize(m_size); |
| 1629 | 1646 |
| 1630 if (pinchVirtualViewportEnabled()) | 1647 if (pinchVirtualViewportEnabled()) |
| 1631 page()->frameHost().pinchViewport().setSize(m_size); | 1648 page()->frameHost().pinchViewport().setSize(m_size); |
| 1632 | 1649 |
| 1633 // When device emulation is enabled, device size values may change - the y are | 1650 // When device emulation is enabled, device size values may change - the y are |
| 1634 // usually set equal to the view size. These values are not considered v iewport-dependent | 1651 // usually set equal to the view size. These values are not considered v iewport-dependent |
| 1635 // (see MediaQueryExp::isViewportDependent), since they are only viewpor t-dependent in emulation mode, | 1652 // (see MediaQueryExp::isViewportDependent), since they are only viewpor t-dependent in emulation mode, |
| 1636 // and thus will not be invalidated in |FrameView::performPreLayoutTasks |. | 1653 // and thus will not be invalidated in |FrameView::performPreLayoutTasks |. |
| 1637 // Therefore we should force explicit media queries invalidation here. | 1654 // Therefore we should force explicit media queries invalidation here. |
| 1638 if (page()->inspectorController().deviceEmulationEnabled()) { | 1655 if (page()->inspectorController().deviceEmulationEnabled()) { |
| 1639 if (Document* document = mainFrameImpl()->frame()->document()) | 1656 if (Document* document = localFrameRootTemporary()->frame()->documen t()) |
| 1640 document->mediaQueryAffectingValueChanged(); | 1657 document->mediaQueryAffectingValueChanged(); |
| 1641 } | 1658 } |
| 1642 } | 1659 } |
| 1643 | 1660 |
| 1644 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { | 1661 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { |
| 1645 // Relayout immediately to recalculate the minimum scale limit. | 1662 // Relayout immediately to recalculate the minimum scale limit. |
| 1646 if (view->needsLayout()) | 1663 if (view->needsLayout()) |
| 1647 view->layout(); | 1664 view->layout(); |
| 1648 | 1665 |
| 1649 if (shouldAnchorAndRescaleViewport) { | 1666 if (shouldAnchorAndRescaleViewport) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1728 | 1745 |
| 1729 if (m_continuousPaintingEnabled) { | 1746 if (m_continuousPaintingEnabled) { |
| 1730 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); | 1747 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); |
| 1731 m_client->scheduleAnimation(); | 1748 m_client->scheduleAnimation(); |
| 1732 } | 1749 } |
| 1733 } | 1750 } |
| 1734 | 1751 |
| 1735 void WebViewImpl::layout() | 1752 void WebViewImpl::layout() |
| 1736 { | 1753 { |
| 1737 TRACE_EVENT0("blink", "WebViewImpl::layout"); | 1754 TRACE_EVENT0("blink", "WebViewImpl::layout"); |
| 1738 PageWidgetDelegate::layout(m_page.get()); | 1755 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame()) ; |
| 1739 updateLayerTreeBackgroundColor(); | 1756 updateLayerTreeBackgroundColor(); |
| 1740 | 1757 |
| 1741 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1758 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 1742 m_linkHighlights[i]->updateGeometry(); | 1759 m_linkHighlights[i]->updateGeometry(); |
| 1743 | 1760 |
| 1744 if (m_devToolsAgent) | 1761 if (m_devToolsAgent) |
| 1745 m_devToolsAgent->didLayout(); | 1762 m_devToolsAgent->didLayout(); |
| 1746 } | 1763 } |
| 1747 | 1764 |
| 1748 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1765 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
| (...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4185 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4202 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
| 4186 | 4203 |
| 4187 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4204 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4188 return false; | 4205 return false; |
| 4189 | 4206 |
| 4190 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4207 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4191 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4208 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 4192 } | 4209 } |
| 4193 | 4210 |
| 4194 } // namespace blink | 4211 } // namespace blink |
| OLD | NEW |