| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 m_lastViewportSize = IntSize(); | 217 m_lastViewportSize = IntSize(); |
| 218 m_lastZoomFactor = 1.0f; | 218 m_lastZoomFactor = 1.0f; |
| 219 m_isTrackingPaintInvalidations = s_initialTrackAllPaintInvalidations; | 219 m_isTrackingPaintInvalidations = s_initialTrackAllPaintInvalidations; |
| 220 m_isPainting = false; | 220 m_isPainting = false; |
| 221 m_visuallyNonEmptyCharacterCount = 0; | 221 m_visuallyNonEmptyCharacterCount = 0; |
| 222 m_visuallyNonEmptyPixelCount = 0; | 222 m_visuallyNonEmptyPixelCount = 0; |
| 223 m_isVisuallyNonEmpty = false; | 223 m_isVisuallyNonEmpty = false; |
| 224 clearScrollAnchor(); | 224 clearScrollAnchor(); |
| 225 m_viewportConstrainedObjects.clear(); | 225 m_viewportConstrainedObjects.clear(); |
| 226 m_layoutSubtreeRootList.clear(); | 226 m_layoutSubtreeRootList.clear(); |
| 227 m_orthogonalWritingModeRootList.clear(); |
| 227 } | 228 } |
| 228 | 229 |
| 229 // Call function for each non-throttled frame view in pre tree order. | 230 // Call function for each non-throttled frame view in pre tree order. |
| 230 // Note it needs a null check of the frame's layoutView to access it in case of
detached frames. | 231 // Note it needs a null check of the frame's layoutView to access it in case of
detached frames. |
| 231 template <typename Function> | 232 template <typename Function> |
| 232 void FrameView::forAllNonThrottledFrameViews(Function function) | 233 void FrameView::forAllNonThrottledFrameViews(Function function) |
| 233 { | 234 { |
| 234 if (shouldThrottleRendering()) | 235 if (shouldThrottleRendering()) |
| 235 return; | 236 return; |
| 236 | 237 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 | 838 |
| 838 ASSERT(!isInPerformLayout()); | 839 ASSERT(!isInPerformLayout()); |
| 839 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); | 840 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); |
| 840 | 841 |
| 841 // performLayout is the actual guts of layout(). | 842 // performLayout is the actual guts of layout(). |
| 842 // FIXME: The 300 other lines in layout() probably belong in other helper fu
nctions | 843 // FIXME: The 300 other lines in layout() probably belong in other helper fu
nctions |
| 843 // so that a single human could understand what layout() is actually doing. | 844 // so that a single human could understand what layout() is actually doing. |
| 844 | 845 |
| 845 forceLayoutParentViewIfNeeded(); | 846 forceLayoutParentViewIfNeeded(); |
| 846 | 847 |
| 848 if (hasOrthogonalWritingModeRoots()) |
| 849 layoutOrthogonalWritingModeRoots(); |
| 850 |
| 847 if (inSubtreeLayout) { | 851 if (inSubtreeLayout) { |
| 848 if (m_analyzer) | 852 if (m_analyzer) |
| 849 m_analyzer->increment(LayoutAnalyzer::PerformLayoutRootLayoutObjects
, m_layoutSubtreeRootList.size()); | 853 m_analyzer->increment(LayoutAnalyzer::PerformLayoutRootLayoutObjects
, m_layoutSubtreeRootList.size()); |
| 850 while (LayoutObject* root = m_layoutSubtreeRootList.takeDeepestRoot()) { | 854 m_layoutSubtreeRootList.assertOnModify(true); |
| 855 for (auto& root : m_layoutSubtreeRootList.ordered()) { |
| 851 if (!root->needsLayout()) | 856 if (!root->needsLayout()) |
| 852 continue; | 857 continue; |
| 853 layoutFromRootObject(*root); | 858 layoutFromRootObject(*root); |
| 854 | 859 |
| 855 // We need to ensure that we mark up all layoutObjects up to the Lay
outView | 860 // We need to ensure that we mark up all layoutObjects up to the Lay
outView |
| 856 // for paint invalidation. This simplifies our code as we just alway
s | 861 // for paint invalidation. This simplifies our code as we just alway
s |
| 857 // do a full tree walk. | 862 // do a full tree walk. |
| 858 if (LayoutObject* container = root->container()) | 863 if (LayoutObject* container = root->container()) |
| 859 container->setMayNeedPaintInvalidation(); | 864 container->setMayNeedPaintInvalidation(); |
| 860 } | 865 } |
| 866 m_layoutSubtreeRootList.assertOnModify(false); |
| 867 m_layoutSubtreeRootList.clear(); |
| 861 } else { | 868 } else { |
| 862 layoutFromRootObject(*layoutView()); | 869 layoutFromRootObject(*layoutView()); |
| 863 } | 870 } |
| 864 | 871 |
| 865 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); | 872 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); |
| 866 | 873 |
| 867 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); | 874 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); |
| 868 | 875 |
| 869 TRACE_EVENT_END1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayout"
, | 876 TRACE_EVENT_END1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayout"
, |
| 870 "counters", analyzerCounters()); | 877 "counters", analyzerCounters()); |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 if (m_autoSizeInfo) | 1728 if (m_autoSizeInfo) |
| 1722 m_autoSizeInfo->autoSizeIfNeeded(); | 1729 m_autoSizeInfo->autoSizeIfNeeded(); |
| 1723 | 1730 |
| 1724 // If there is a pending layout, the scroll anchor will be cleared when it f
inishes. | 1731 // If there is a pending layout, the scroll anchor will be cleared when it f
inishes. |
| 1725 if (!needsLayout()) | 1732 if (!needsLayout()) |
| 1726 clearScrollAnchor(); | 1733 clearScrollAnchor(); |
| 1727 } | 1734 } |
| 1728 | 1735 |
| 1729 void FrameView::clearLayoutSubtreeRoot(const LayoutObject& root) | 1736 void FrameView::clearLayoutSubtreeRoot(const LayoutObject& root) |
| 1730 { | 1737 { |
| 1731 m_layoutSubtreeRootList.removeRoot(const_cast<LayoutObject&>(root)); | 1738 m_layoutSubtreeRootList.remove(const_cast<LayoutObject&>(root)); |
| 1732 } | 1739 } |
| 1733 | 1740 |
| 1734 void FrameView::clearLayoutSubtreeRootsAndMarkContainingBlocks() | 1741 void FrameView::clearLayoutSubtreeRootsAndMarkContainingBlocks() |
| 1735 { | 1742 { |
| 1736 m_layoutSubtreeRootList.clearAndMarkContainingBlocksForLayout(); | 1743 m_layoutSubtreeRootList.clearAndMarkContainingBlocksForLayout(); |
| 1737 } | 1744 } |
| 1738 | 1745 |
| 1746 void FrameView::addOrthogonalWritingModeRoot(LayoutBox& root) |
| 1747 { |
| 1748 m_orthogonalWritingModeRootList.add(root); |
| 1749 } |
| 1750 |
| 1751 void FrameView::removeOrthogonalWritingModeRoot(LayoutBox& root) |
| 1752 { |
| 1753 m_orthogonalWritingModeRootList.remove(root); |
| 1754 } |
| 1755 |
| 1756 bool FrameView::hasOrthogonalWritingModeRoots() const |
| 1757 { |
| 1758 return !m_orthogonalWritingModeRootList.isEmpty(); |
| 1759 } |
| 1760 |
| 1761 void FrameView::layoutOrthogonalWritingModeRoots() |
| 1762 { |
| 1763 m_orthogonalWritingModeRootList.assertOnModify(true); |
| 1764 for (auto& root : m_orthogonalWritingModeRootList.ordered()) { |
| 1765 ASSERT(root->isBox() && toLayoutBox(*root).isOrthogonalWritingModeRoot()
); |
| 1766 if (!root->needsLayout() |
| 1767 || root->isOutOfFlowPositioned() |
| 1768 || root->isColumnSpanAll() |
| 1769 || !root->styleRef().logicalHeight().isIntrinsicOrAuto()) { |
| 1770 continue; |
| 1771 } |
| 1772 LayoutState layoutState(*root); |
| 1773 root->layout(); |
| 1774 } |
| 1775 m_orthogonalWritingModeRootList.assertOnModify(false); |
| 1776 } |
| 1777 |
| 1739 void FrameView::scheduleRelayout() | 1778 void FrameView::scheduleRelayout() |
| 1740 { | 1779 { |
| 1741 ASSERT(m_frame->view() == this); | 1780 ASSERT(m_frame->view() == this); |
| 1742 | 1781 |
| 1743 if (!m_layoutSchedulingEnabled) | 1782 if (!m_layoutSchedulingEnabled) |
| 1744 return; | 1783 return; |
| 1745 if (!needsLayout()) | 1784 if (!needsLayout()) |
| 1746 return; | 1785 return; |
| 1747 if (!m_frame->document()->shouldScheduleLayout()) | 1786 if (!m_frame->document()->shouldScheduleLayout()) |
| 1748 return; | 1787 return; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1770 LayoutView* layoutView = this->layoutView(); | 1809 LayoutView* layoutView = this->layoutView(); |
| 1771 if (layoutView && layoutView->needsLayout()) { | 1810 if (layoutView && layoutView->needsLayout()) { |
| 1772 if (relayoutRoot) | 1811 if (relayoutRoot) |
| 1773 relayoutRoot->markContainerChainForLayout(false); | 1812 relayoutRoot->markContainerChainForLayout(false); |
| 1774 return; | 1813 return; |
| 1775 } | 1814 } |
| 1776 | 1815 |
| 1777 if (relayoutRoot == layoutView) | 1816 if (relayoutRoot == layoutView) |
| 1778 m_layoutSubtreeRootList.clearAndMarkContainingBlocksForLayout(); | 1817 m_layoutSubtreeRootList.clearAndMarkContainingBlocksForLayout(); |
| 1779 else | 1818 else |
| 1780 m_layoutSubtreeRootList.addRoot(*relayoutRoot); | 1819 m_layoutSubtreeRootList.add(*relayoutRoot); |
| 1781 | 1820 |
| 1782 if (m_layoutSchedulingEnabled) { | 1821 if (m_layoutSchedulingEnabled) { |
| 1783 m_hasPendingLayout = true; | 1822 m_hasPendingLayout = true; |
| 1784 | 1823 |
| 1785 page()->animator().scheduleVisualUpdate(m_frame.get()); | 1824 page()->animator().scheduleVisualUpdate(m_frame.get()); |
| 1786 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); | 1825 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); |
| 1787 } | 1826 } |
| 1788 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", TRACE_EVENT_SCOPE_THREAD, "data", InspectorInvalidateLayoutEvent::d
ata(m_frame.get())); | 1827 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", TRACE_EVENT_SCOPE_THREAD, "data", InspectorInvalidateLayoutEvent::d
ata(m_frame.get())); |
| 1789 } | 1828 } |
| 1790 | 1829 |
| (...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4050 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4089 return m_hiddenForThrottling && m_crossOriginForThrottling; |
| 4051 } | 4090 } |
| 4052 | 4091 |
| 4053 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4092 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
| 4054 { | 4093 { |
| 4055 ASSERT(layoutView()); | 4094 ASSERT(layoutView()); |
| 4056 return *layoutView(); | 4095 return *layoutView(); |
| 4057 } | 4096 } |
| 4058 | 4097 |
| 4059 } // namespace blink | 4098 } // namespace blink |
| OLD | NEW |