Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2635143003: Merge list of orthogonal writing mode roots into depth-ordered layout list. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 ASSERT(inSubtreeLayout || m_layoutSubtreeRootList.isEmpty()); 1028 ASSERT(inSubtreeLayout || m_layoutSubtreeRootList.isEmpty());
1029 1029
1030 int contentsHeightBeforeLayout = layoutViewItem().documentRect().height(); 1030 int contentsHeightBeforeLayout = layoutViewItem().documentRect().height();
1031 TRACE_EVENT_BEGIN1(PERFORM_LAYOUT_TRACE_CATEGORIES, 1031 TRACE_EVENT_BEGIN1(PERFORM_LAYOUT_TRACE_CATEGORIES,
1032 "FrameView::performLayout", "contentsHeightBeforeLayout", 1032 "FrameView::performLayout", "contentsHeightBeforeLayout",
1033 contentsHeightBeforeLayout); 1033 contentsHeightBeforeLayout);
1034 prepareLayoutAnalyzer(); 1034 prepareLayoutAnalyzer();
1035 1035
1036 ScriptForbiddenScope forbidScript; 1036 ScriptForbiddenScope forbidScript;
1037 1037
1038 if (inSubtreeLayout && hasOrthogonalWritingModeRoots()) {
1039 // If we're going to lay out from each subtree root, rather than once from
1040 // LayoutView, we need to merge the depth-ordered orthogonal writing mode
1041 // root list into the depth-ordered list of subtrees scheduled for
1042 // layout. Otherwise, during layout of one such subtree, we'd risk skipping
1043 // over a subtree of objects needing layout.
1044 DCHECK(!m_layoutSubtreeRootList.isEmpty());
1045 scheduleOrthogonalWritingModeRootsForLayout();
1046 }
1047
1038 ASSERT(!isInPerformLayout()); 1048 ASSERT(!isInPerformLayout());
1039 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); 1049 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout);
1040 1050
1041 // performLayout is the actual guts of layout(). 1051 // performLayout is the actual guts of layout().
1042 // FIXME: The 300 other lines in layout() probably belong in other helper 1052 // FIXME: The 300 other lines in layout() probably belong in other helper
1043 // functions so that a single human could understand what layout() is actually 1053 // functions so that a single human could understand what layout() is actually
1044 // doing. 1054 // doing.
1045 1055
1046 forceLayoutParentViewIfNeeded(); 1056 forceLayoutParentViewIfNeeded();
1047 1057
1048 if (hasOrthogonalWritingModeRoots())
1049 layoutOrthogonalWritingModeRoots();
1050
1051 if (inSubtreeLayout) { 1058 if (inSubtreeLayout) {
1052 if (m_analyzer) 1059 if (m_analyzer)
1053 m_analyzer->increment(LayoutAnalyzer::PerformLayoutRootLayoutObjects, 1060 m_analyzer->increment(LayoutAnalyzer::PerformLayoutRootLayoutObjects,
1054 m_layoutSubtreeRootList.size()); 1061 m_layoutSubtreeRootList.size());
1055 for (auto& root : m_layoutSubtreeRootList.ordered()) { 1062 for (auto& root : m_layoutSubtreeRootList.ordered()) {
1056 if (!root->needsLayout()) 1063 if (!root->needsLayout())
1057 continue; 1064 continue;
1058 layoutFromRootObject(*root); 1065 layoutFromRootObject(*root);
1059 1066
1060 // We need to ensure that we mark up all layoutObjects up to the 1067 // We need to ensure that we mark up all layoutObjects up to the
1061 // LayoutView for paint invalidation. This simplifies our code as we just 1068 // LayoutView for paint invalidation. This simplifies our code as we just
1062 // always do a full tree walk. 1069 // always do a full tree walk.
1063 if (LayoutItem container = LayoutItem(root->container())) 1070 if (LayoutItem container = LayoutItem(root->container()))
1064 container.setMayNeedPaintInvalidation(); 1071 container.setMayNeedPaintInvalidation();
1065 } 1072 }
1066 m_layoutSubtreeRootList.clear(); 1073 m_layoutSubtreeRootList.clear();
1067 } else { 1074 } else {
1075 if (hasOrthogonalWritingModeRoots())
1076 layoutOrthogonalWritingModeRoots();
1068 layoutFromRootObject(*layoutView()); 1077 layoutFromRootObject(*layoutView());
1069 } 1078 }
1070 1079
1071 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1080 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1072 1081
1073 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); 1082 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout);
1074 1083
1075 TRACE_EVENT_END1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayout", 1084 TRACE_EVENT_END1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayout",
1076 "counters", analyzerCounters()); 1085 "counters", analyzerCounters());
1077 FirstMeaningfulPaintDetector::from(*m_frame->document()) 1086 FirstMeaningfulPaintDetector::from(*m_frame->document())
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 // since the containing block of orthogonal writing mode roots 2126 // since the containing block of orthogonal writing mode roots
2118 // having floats is very rare, prefer to re-create 2127 // having floats is very rare, prefer to re-create
2119 // FloatingObjects. 2128 // FloatingObjects.
2120 if (LayoutBlock* cb = root.containingBlock()) { 2129 if (LayoutBlock* cb = root.containingBlock()) {
2121 if ((cb->normalChildNeedsLayout() || cb->selfNeedsLayout()) && 2130 if ((cb->normalChildNeedsLayout() || cb->selfNeedsLayout()) &&
2122 cb->isLayoutBlockFlow()) 2131 cb->isLayoutBlockFlow())
2123 toLayoutBlockFlow(cb)->removeFloatingObjects(); 2132 toLayoutBlockFlow(cb)->removeFloatingObjects();
2124 } 2133 }
2125 } 2134 }
2126 2135
2136 static bool prepareOrthogonalWritingModeRootForLayout(LayoutObject& root) {
2137 DCHECK(root.isBox() && toLayoutBox(root).isOrthogonalWritingModeRoot());
2138 if (!root.needsLayout() || root.isOutOfFlowPositioned() ||
2139 root.isColumnSpanAll() ||
2140 !root.styleRef().logicalHeight().isIntrinsicOrAuto())
2141 return false;
2142
2143 removeFloatingObjectsForSubtreeRoot(root);
2144 return true;
2145 }
2146
2127 void FrameView::layoutOrthogonalWritingModeRoots() { 2147 void FrameView::layoutOrthogonalWritingModeRoots() {
2128 for (auto& root : m_orthogonalWritingModeRootList.ordered()) { 2148 for (auto& root : m_orthogonalWritingModeRootList.ordered()) {
2129 ASSERT(root->isBox() && toLayoutBox(*root).isOrthogonalWritingModeRoot()); 2149 if (prepareOrthogonalWritingModeRootForLayout(*root))
2130 if (!root->needsLayout() || root->isOutOfFlowPositioned() || 2150 layoutFromRootObject(*root);
2131 root->isColumnSpanAll() ||
2132 !root->styleRef().logicalHeight().isIntrinsicOrAuto()) {
2133 continue;
2134 }
2135
2136 removeFloatingObjectsForSubtreeRoot(*root);
2137 layoutFromRootObject(*root);
2138 } 2151 }
2139 } 2152 }
2140 2153
2154 void FrameView::scheduleOrthogonalWritingModeRootsForLayout() {
2155 for (auto& root : m_orthogonalWritingModeRootList.ordered()) {
2156 if (prepareOrthogonalWritingModeRootForLayout(*root))
2157 m_layoutSubtreeRootList.add(*root);
2158 }
2159 }
2160
2141 bool FrameView::checkLayoutInvalidationIsAllowed() const { 2161 bool FrameView::checkLayoutInvalidationIsAllowed() const {
2142 if (m_allowsLayoutInvalidationAfterLayoutClean) 2162 if (m_allowsLayoutInvalidationAfterLayoutClean)
2143 return true; 2163 return true;
2144 2164
2145 // If we are updating all lifecycle phases beyond LayoutClean, we don't expect 2165 // If we are updating all lifecycle phases beyond LayoutClean, we don't expect
2146 // dirty layout after LayoutClean. 2166 // dirty layout after LayoutClean.
2147 CHECK_FOR_DIRTY_LAYOUT(lifecycle().state() < DocumentLifecycle::LayoutClean); 2167 CHECK_FOR_DIRTY_LAYOUT(lifecycle().state() < DocumentLifecycle::LayoutClean);
2148 2168
2149 return true; 2169 return true;
2150 } 2170 }
(...skipping 2848 matching lines...) Expand 10 before | Expand all | Expand 10 after
4999 // This is the top-level frame, so no mapping necessary. 5019 // This is the top-level frame, so no mapping necessary.
5000 if (m_frame->isMainFrame()) 5020 if (m_frame->isMainFrame())
5001 return; 5021 return;
5002 5022
5003 LayoutRect viewportIntersectionRect(remoteViewportIntersection()); 5023 LayoutRect viewportIntersectionRect(remoteViewportIntersection());
5004 transformState.move( 5024 transformState.move(
5005 LayoutSize(-viewportIntersectionRect.x(), -viewportIntersectionRect.y())); 5025 LayoutSize(-viewportIntersectionRect.x(), -viewportIntersectionRect.y()));
5006 } 5026 }
5007 5027
5008 } // namespace blink 5028 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698