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 clearFragmentAnchor(); | 224 clearFragmentAnchor(); |
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 for (auto& root : m_layoutSubtreeRootList.ordered()) { |
851 if (!root->needsLayout()) | 855 if (!root->needsLayout()) |
852 continue; | 856 continue; |
853 layoutFromRootObject(*root); | 857 layoutFromRootObject(*root); |
854 | 858 |
855 // We need to ensure that we mark up all layoutObjects up to the Lay
outView | 859 // 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 | 860 // for paint invalidation. This simplifies our code as we just alway
s |
857 // do a full tree walk. | 861 // do a full tree walk. |
858 if (LayoutObject* container = root->container()) | 862 if (LayoutObject* container = root->container()) |
859 container->setMayNeedPaintInvalidation(); | 863 container->setMayNeedPaintInvalidation(); |
860 } | 864 } |
| 865 m_layoutSubtreeRootList.clear(); |
861 } else { | 866 } else { |
862 layoutFromRootObject(*layoutView()); | 867 layoutFromRootObject(*layoutView()); |
863 } | 868 } |
864 | 869 |
865 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); | 870 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); |
866 | 871 |
867 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); | 872 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); |
868 | 873 |
869 TRACE_EVENT_END1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayout"
, | 874 TRACE_EVENT_END1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayout"
, |
870 "counters", analyzerCounters()); | 875 "counters", analyzerCounters()); |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 if (m_autoSizeInfo) | 1726 if (m_autoSizeInfo) |
1722 m_autoSizeInfo->autoSizeIfNeeded(); | 1727 m_autoSizeInfo->autoSizeIfNeeded(); |
1723 | 1728 |
1724 // If there is a pending layout, the fragment anchor will be cleared when it
finishes. | 1729 // If there is a pending layout, the fragment anchor will be cleared when it
finishes. |
1725 if (!needsLayout()) | 1730 if (!needsLayout()) |
1726 clearFragmentAnchor(); | 1731 clearFragmentAnchor(); |
1727 } | 1732 } |
1728 | 1733 |
1729 void FrameView::clearLayoutSubtreeRoot(const LayoutObject& root) | 1734 void FrameView::clearLayoutSubtreeRoot(const LayoutObject& root) |
1730 { | 1735 { |
1731 m_layoutSubtreeRootList.removeRoot(const_cast<LayoutObject&>(root)); | 1736 m_layoutSubtreeRootList.remove(const_cast<LayoutObject&>(root)); |
1732 } | 1737 } |
1733 | 1738 |
1734 void FrameView::clearLayoutSubtreeRootsAndMarkContainingBlocks() | 1739 void FrameView::clearLayoutSubtreeRootsAndMarkContainingBlocks() |
1735 { | 1740 { |
1736 m_layoutSubtreeRootList.clearAndMarkContainingBlocksForLayout(); | 1741 m_layoutSubtreeRootList.clearAndMarkContainingBlocksForLayout(); |
1737 } | 1742 } |
1738 | 1743 |
| 1744 void FrameView::addOrthogonalWritingModeRoot(LayoutBox& root) |
| 1745 { |
| 1746 m_orthogonalWritingModeRootList.add(root); |
| 1747 } |
| 1748 |
| 1749 void FrameView::removeOrthogonalWritingModeRoot(LayoutBox& root) |
| 1750 { |
| 1751 m_orthogonalWritingModeRootList.remove(root); |
| 1752 } |
| 1753 |
| 1754 bool FrameView::hasOrthogonalWritingModeRoots() const |
| 1755 { |
| 1756 return !m_orthogonalWritingModeRootList.isEmpty(); |
| 1757 } |
| 1758 |
| 1759 void FrameView::layoutOrthogonalWritingModeRoots() |
| 1760 { |
| 1761 for (auto& root : m_orthogonalWritingModeRootList.ordered()) { |
| 1762 ASSERT(root->isBox() && toLayoutBox(*root).isOrthogonalWritingModeRoot()
); |
| 1763 if (!root->needsLayout() |
| 1764 || root->isOutOfFlowPositioned() |
| 1765 || root->isColumnSpanAll() |
| 1766 || !root->styleRef().logicalHeight().isIntrinsicOrAuto()) { |
| 1767 continue; |
| 1768 } |
| 1769 LayoutState layoutState(*root); |
| 1770 root->layout(); |
| 1771 } |
| 1772 } |
| 1773 |
1739 void FrameView::scheduleRelayout() | 1774 void FrameView::scheduleRelayout() |
1740 { | 1775 { |
1741 ASSERT(m_frame->view() == this); | 1776 ASSERT(m_frame->view() == this); |
1742 | 1777 |
1743 if (!m_layoutSchedulingEnabled) | 1778 if (!m_layoutSchedulingEnabled) |
1744 return; | 1779 return; |
1745 if (!needsLayout()) | 1780 if (!needsLayout()) |
1746 return; | 1781 return; |
1747 if (!m_frame->document()->shouldScheduleLayout()) | 1782 if (!m_frame->document()->shouldScheduleLayout()) |
1748 return; | 1783 return; |
(...skipping 21 matching lines...) Expand all Loading... |
1770 LayoutView* layoutView = this->layoutView(); | 1805 LayoutView* layoutView = this->layoutView(); |
1771 if (layoutView && layoutView->needsLayout()) { | 1806 if (layoutView && layoutView->needsLayout()) { |
1772 if (relayoutRoot) | 1807 if (relayoutRoot) |
1773 relayoutRoot->markContainerChainForLayout(false); | 1808 relayoutRoot->markContainerChainForLayout(false); |
1774 return; | 1809 return; |
1775 } | 1810 } |
1776 | 1811 |
1777 if (relayoutRoot == layoutView) | 1812 if (relayoutRoot == layoutView) |
1778 m_layoutSubtreeRootList.clearAndMarkContainingBlocksForLayout(); | 1813 m_layoutSubtreeRootList.clearAndMarkContainingBlocksForLayout(); |
1779 else | 1814 else |
1780 m_layoutSubtreeRootList.addRoot(*relayoutRoot); | 1815 m_layoutSubtreeRootList.add(*relayoutRoot); |
1781 | 1816 |
1782 if (m_layoutSchedulingEnabled) { | 1817 if (m_layoutSchedulingEnabled) { |
1783 m_hasPendingLayout = true; | 1818 m_hasPendingLayout = true; |
1784 | 1819 |
1785 page()->animator().scheduleVisualUpdate(m_frame.get()); | 1820 page()->animator().scheduleVisualUpdate(m_frame.get()); |
1786 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); | 1821 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); |
1787 } | 1822 } |
1788 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", TRACE_EVENT_SCOPE_THREAD, "data", InspectorInvalidateLayoutEvent::d
ata(m_frame.get())); | 1823 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", TRACE_EVENT_SCOPE_THREAD, "data", InspectorInvalidateLayoutEvent::d
ata(m_frame.get())); |
1789 } | 1824 } |
1790 | 1825 |
(...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4054 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4089 return m_hiddenForThrottling && m_crossOriginForThrottling; |
4055 } | 4090 } |
4056 | 4091 |
4057 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4092 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4058 { | 4093 { |
4059 ASSERT(layoutView()); | 4094 ASSERT(layoutView()); |
4060 return *layoutView(); | 4095 return *layoutView(); |
4061 } | 4096 } |
4062 | 4097 |
4063 } // namespace blink | 4098 } // namespace blink |
OLD | NEW |