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

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

Issue 335963002: Change LayoutState to be stack-allocated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/rendering/LayoutState.h » ('j') | Source/core/rendering/LayoutState.h » ('J')
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay er* layer, bool isRelayoutingSubtree, bool didFullPaintInvalidation) 97 static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay er* layer, bool isRelayoutingSubtree, bool didFullPaintInvalidation)
98 { 98 {
99 RenderLayer::UpdateLayerPositionsFlags flags = didFullPaintInvalidation ? Re nderLayer::NeedsFullRepaintInBacking : RenderLayer::CheckForRepaint; 99 RenderLayer::UpdateLayerPositionsFlags flags = didFullPaintInvalidation ? Re nderLayer::NeedsFullRepaintInBacking : RenderLayer::CheckForRepaint;
100 100
101 if (isRelayoutingSubtree && (layer->isPaginated() || layer->enclosingPaginat ionLayer())) 101 if (isRelayoutingSubtree && (layer->isPaginated() || layer->enclosingPaginat ionLayer()))
102 flags |= RenderLayer::UpdatePagination; 102 flags |= RenderLayer::UpdatePagination;
103 103
104 return flags; 104 return flags;
105 } 105 }
106 106
107 class FrameViewLayoutStateMaintainer {
108 WTF_MAKE_NONCOPYABLE(FrameViewLayoutStateMaintainer);
109 public:
110 FrameViewLayoutStateMaintainer(RenderObject& root, bool inSubtreeLayout)
111 : m_view(*root.view())
112 , m_inSubtreeLayout(inSubtreeLayout)
113 , m_disabled(inSubtreeLayout && m_view.shouldDisableLayoutStateForSubtre e(root))
114 {
115 if (m_inSubtreeLayout)
116 m_view.pushLayoutState(root);
117 if (m_disabled)
118 m_view.disableLayoutState();
119 }
120
121 ~FrameViewLayoutStateMaintainer()
122 {
123 if (m_disabled)
124 m_view.enableLayoutState();
125 if (m_inSubtreeLayout)
126 m_view.popLayoutState();
127 }
128 private:
129 RenderView& m_view;
130 bool m_inSubtreeLayout;
131 bool m_disabled;
132 };
133
134 FrameView::FrameView(LocalFrame* frame) 107 FrameView::FrameView(LocalFrame* frame)
135 : m_frame(frame) 108 : m_frame(frame)
136 , m_canHaveScrollbars(true) 109 , m_canHaveScrollbars(true)
137 , m_slowRepaintObjectCount(0) 110 , m_slowRepaintObjectCount(0)
138 , m_hasPendingLayout(false) 111 , m_hasPendingLayout(false)
139 , m_layoutSubtreeRoot(0) 112 , m_layoutSubtreeRoot(0)
140 , m_inSynchronousPostLayout(false) 113 , m_inSynchronousPostLayout(false)
141 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 114 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
142 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) 115 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired)
143 , m_isTransparent(false) 116 , m_isTransparent(false)
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 758
786 ASSERT(!isInPerformLayout()); 759 ASSERT(!isInPerformLayout());
787 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); 760 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout);
788 761
789 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true); 762 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true);
790 763
791 // performLayout is the actual guts of layout(). 764 // performLayout is the actual guts of layout().
792 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions 765 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions
793 // so that a single human could understand what layout() is actually doing. 766 // so that a single human could understand what layout() is actually doing.
794 767
795 FrameViewLayoutStateMaintainer statePusher(*rootForThisLayout, inSubtreeLayo ut); 768 LayoutState layoutState(*rootForThisLayout);
769
796 forceLayoutParentViewIfNeeded(); 770 forceLayoutParentViewIfNeeded();
797 771
798 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. 772 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
799 rootForThisLayout->layout(); 773 rootForThisLayout->layout();
800 gatherDebugLayoutRects(rootForThisLayout); 774 gatherDebugLayoutRects(rootForThisLayout);
801 775
802 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllIma geResourcePriorities(); 776 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllIma geResourcePriorities();
803 777
804 TextAutosizer* textAutosizer = frame().document()->textAutosizer(); 778 TextAutosizer* textAutosizer = frame().document()->textAutosizer();
805 bool autosized; 779 bool autosized;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 // We should only invalidate paints for the outer most layout. This works as 1009 // We should only invalidate paints for the outer most layout. This works as
1036 // we continue to track paint invalidation rects until this function is call ed. 1010 // we continue to track paint invalidation rects until this function is call ed.
1037 ASSERT(!m_nestedLayoutCount); 1011 ASSERT(!m_nestedLayoutCount);
1038 1012
1039 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", TRACE_STR_COPY(ro ot->debugName().ascii().data())); 1013 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", TRACE_STR_COPY(ro ot->debugName().ascii().data()));
1040 1014
1041 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal. 1015 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal.
1042 // Until those states are fully fledged, I'll just disable the ASSERTS. 1016 // Until those states are fully fledged, I'll just disable the ASSERTS.
1043 DisableCompositingQueryAsserts compositingQueryAssertsDisabler; 1017 DisableCompositingQueryAsserts compositingQueryAssertsDisabler;
1044 1018
1045 RootLayoutStateScope rootLayoutStateScope(*root); 1019 LayoutState rootLayoutStateScope(*root);
esprehn 2014/06/14 03:08:26 rootLayoutState
1046 1020
1047 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation()); 1021 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation());
1048 1022
1049 // Invalidate the paint of the frameviews scrollbars if needed 1023 // Invalidate the paint of the frameviews scrollbars if needed
1050 if (hasVerticalBarDamage()) 1024 if (hasVerticalBarDamage())
1051 invalidateRect(verticalBarDamage()); 1025 invalidateRect(verticalBarDamage());
1052 if (hasHorizontalBarDamage()) 1026 if (hasHorizontalBarDamage())
1053 invalidateRect(horizontalBarDamage()); 1027 invalidateRect(horizontalBarDamage());
1054 resetScrollbarDamage(); 1028 resetScrollbarDamage();
1055 } 1029 }
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3252 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3279 { 3253 {
3280 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3254 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3281 if (AXObjectCache* cache = axObjectCache()) { 3255 if (AXObjectCache* cache = axObjectCache()) {
3282 cache->remove(scrollbar); 3256 cache->remove(scrollbar);
3283 cache->handleScrollbarUpdate(this); 3257 cache->handleScrollbarUpdate(this);
3284 } 3258 }
3285 } 3259 }
3286 3260
3287 } // namespace WebCore 3261 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/LayoutState.h » ('j') | Source/core/rendering/LayoutState.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698