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

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

Issue 2696713002: Merge list of orthogonal writing mode roots into depth-ordered layout list. (Closed)
Patch Set: Created 3 years, 10 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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 ASSERT(inSubtreeLayout || m_layoutSubtreeRootList.isEmpty()); 1044 ASSERT(inSubtreeLayout || m_layoutSubtreeRootList.isEmpty());
1045 1045
1046 int contentsHeightBeforeLayout = layoutViewItem().documentRect().height(); 1046 int contentsHeightBeforeLayout = layoutViewItem().documentRect().height();
1047 TRACE_EVENT_BEGIN1(PERFORM_LAYOUT_TRACE_CATEGORIES, 1047 TRACE_EVENT_BEGIN1(PERFORM_LAYOUT_TRACE_CATEGORIES,
1048 "FrameView::performLayout", "contentsHeightBeforeLayout", 1048 "FrameView::performLayout", "contentsHeightBeforeLayout",
1049 contentsHeightBeforeLayout); 1049 contentsHeightBeforeLayout);
1050 prepareLayoutAnalyzer(); 1050 prepareLayoutAnalyzer();
1051 1051
1052 ScriptForbiddenScope forbidScript; 1052 ScriptForbiddenScope forbidScript;
1053 1053
1054 if (inSubtreeLayout && hasOrthogonalWritingModeRoots()) {
1055 // If we're going to lay out from each subtree root, rather than once from
1056 // LayoutView, we need to merge the depth-ordered orthogonal writing mode
1057 // root list into the depth-ordered list of subtrees scheduled for
1058 // layout. Otherwise, during layout of one such subtree, we'd risk skipping
1059 // over a subtree of objects needing layout.
1060 DCHECK(!m_layoutSubtreeRootList.isEmpty());
1061 scheduleOrthogonalWritingModeRootsForLayout();
1062 }
1063
1054 ASSERT(!isInPerformLayout()); 1064 ASSERT(!isInPerformLayout());
1055 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); 1065 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout);
1056 1066
1057 // performLayout is the actual guts of layout(). 1067 // performLayout is the actual guts of layout().
1058 // FIXME: The 300 other lines in layout() probably belong in other helper 1068 // FIXME: The 300 other lines in layout() probably belong in other helper
1059 // functions so that a single human could understand what layout() is actually 1069 // functions so that a single human could understand what layout() is actually
1060 // doing. 1070 // doing.
1061 1071
1062 forceLayoutParentViewIfNeeded(); 1072 forceLayoutParentViewIfNeeded();
1063 1073
1064 if (hasOrthogonalWritingModeRoots())
1065 layoutOrthogonalWritingModeRoots();
1066
1067 if (inSubtreeLayout) { 1074 if (inSubtreeLayout) {
1068 if (m_analyzer) 1075 if (m_analyzer)
1069 m_analyzer->increment(LayoutAnalyzer::PerformLayoutRootLayoutObjects, 1076 m_analyzer->increment(LayoutAnalyzer::PerformLayoutRootLayoutObjects,
1070 m_layoutSubtreeRootList.size()); 1077 m_layoutSubtreeRootList.size());
1071 for (auto& root : m_layoutSubtreeRootList.ordered()) { 1078 for (auto& root : m_layoutSubtreeRootList.ordered()) {
1072 if (!root->needsLayout()) 1079 if (!root->needsLayout())
1073 continue; 1080 continue;
1074 layoutFromRootObject(*root); 1081 layoutFromRootObject(*root);
1075 1082
1076 // We need to ensure that we mark up all layoutObjects up to the 1083 // We need to ensure that we mark up all layoutObjects up to the
1077 // LayoutView for paint invalidation. This simplifies our code as we just 1084 // LayoutView for paint invalidation. This simplifies our code as we just
1078 // always do a full tree walk. 1085 // always do a full tree walk.
1079 if (LayoutItem container = LayoutItem(root->container())) 1086 if (LayoutItem container = LayoutItem(root->container()))
1080 container.setMayNeedPaintInvalidation(); 1087 container.setMayNeedPaintInvalidation();
1081 } 1088 }
1082 m_layoutSubtreeRootList.clear(); 1089 m_layoutSubtreeRootList.clear();
1083 } else { 1090 } else {
1091 if (hasOrthogonalWritingModeRoots())
1092 layoutOrthogonalWritingModeRoots();
1084 layoutFromRootObject(*layoutView()); 1093 layoutFromRootObject(*layoutView());
1085 } 1094 }
1086 1095
1087 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1096 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1088 1097
1089 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); 1098 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout);
1090 1099
1091 TRACE_EVENT_END1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayout", 1100 TRACE_EVENT_END1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayout",
1092 "counters", analyzerCounters()); 1101 "counters", analyzerCounters());
1093 FirstMeaningfulPaintDetector::from(*m_frame->document()) 1102 FirstMeaningfulPaintDetector::from(*m_frame->document())
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 // since the containing block of orthogonal writing mode roots 2136 // since the containing block of orthogonal writing mode roots
2128 // having floats is very rare, prefer to re-create 2137 // having floats is very rare, prefer to re-create
2129 // FloatingObjects. 2138 // FloatingObjects.
2130 if (LayoutBlock* cb = root.containingBlock()) { 2139 if (LayoutBlock* cb = root.containingBlock()) {
2131 if ((cb->normalChildNeedsLayout() || cb->selfNeedsLayout()) && 2140 if ((cb->normalChildNeedsLayout() || cb->selfNeedsLayout()) &&
2132 cb->isLayoutBlockFlow()) 2141 cb->isLayoutBlockFlow())
2133 toLayoutBlockFlow(cb)->removeFloatingObjects(); 2142 toLayoutBlockFlow(cb)->removeFloatingObjects();
2134 } 2143 }
2135 } 2144 }
2136 2145
2146 static bool prepareOrthogonalWritingModeRootForLayout(LayoutObject& root) {
2147 DCHECK(root.isBox() && toLayoutBox(root).isOrthogonalWritingModeRoot());
2148 if (!root.needsLayout() || root.isOutOfFlowPositioned() ||
2149 root.isColumnSpanAll() ||
2150 !root.styleRef().logicalHeight().isIntrinsicOrAuto())
2151 return false;
2152
2153 removeFloatingObjectsForSubtreeRoot(root);
2154 return true;
2155 }
2156
2137 void FrameView::layoutOrthogonalWritingModeRoots() { 2157 void FrameView::layoutOrthogonalWritingModeRoots() {
2138 for (auto& root : m_orthogonalWritingModeRootList.ordered()) { 2158 for (auto& root : m_orthogonalWritingModeRootList.ordered()) {
2139 ASSERT(root->isBox() && toLayoutBox(*root).isOrthogonalWritingModeRoot()); 2159 if (prepareOrthogonalWritingModeRootForLayout(*root))
2140 if (!root->needsLayout() || root->isOutOfFlowPositioned() || 2160 layoutFromRootObject(*root);
2141 root->isColumnSpanAll() ||
2142 !root->styleRef().logicalHeight().isIntrinsicOrAuto()) {
2143 continue;
2144 }
2145
2146 removeFloatingObjectsForSubtreeRoot(*root);
2147 layoutFromRootObject(*root);
2148 } 2161 }
2149 } 2162 }
2150 2163
2164 void FrameView::scheduleOrthogonalWritingModeRootsForLayout() {
2165 for (auto& root : m_orthogonalWritingModeRootList.ordered()) {
2166 if (prepareOrthogonalWritingModeRootForLayout(*root))
2167 m_layoutSubtreeRootList.add(*root);
2168 }
2169 }
2170
2151 bool FrameView::checkLayoutInvalidationIsAllowed() const { 2171 bool FrameView::checkLayoutInvalidationIsAllowed() const {
2152 if (m_allowsLayoutInvalidationAfterLayoutClean) 2172 if (m_allowsLayoutInvalidationAfterLayoutClean)
2153 return true; 2173 return true;
2154 2174
2155 // If we are updating all lifecycle phases beyond LayoutClean, we don't expect 2175 // If we are updating all lifecycle phases beyond LayoutClean, we don't expect
2156 // dirty layout after LayoutClean. 2176 // dirty layout after LayoutClean.
2157 CHECK_FOR_DIRTY_LAYOUT(lifecycle().state() < DocumentLifecycle::LayoutClean); 2177 CHECK_FOR_DIRTY_LAYOUT(lifecycle().state() < DocumentLifecycle::LayoutClean);
2158 2178
2159 return true; 2179 return true;
2160 } 2180 }
(...skipping 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after
5031 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5051 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5032 m_animationTimeline = std::move(timeline); 5052 m_animationTimeline = std::move(timeline);
5033 } 5053 }
5034 5054
5035 void FrameView::setAnimationHost( 5055 void FrameView::setAnimationHost(
5036 std::unique_ptr<CompositorAnimationHost> host) { 5056 std::unique_ptr<CompositorAnimationHost> host) {
5037 m_animationHost = std::move(host); 5057 m_animationHost = std::move(host);
5038 } 5058 }
5039 5059
5040 } // namespace blink 5060 } // 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