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

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: Fix push function to match old behavior... 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
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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 775
803 ASSERT(!isInPerformLayout()); 776 ASSERT(!isInPerformLayout());
804 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); 777 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout);
805 778
806 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true); 779 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true);
807 780
808 // performLayout is the actual guts of layout(). 781 // performLayout is the actual guts of layout().
809 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions 782 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions
810 // so that a single human could understand what layout() is actually doing. 783 // so that a single human could understand what layout() is actually doing.
811 784
812 FrameViewLayoutStateMaintainer statePusher(*rootForThisLayout, inSubtreeLayo ut); 785 LayoutState layoutState(*rootForThisLayout);
786
813 forceLayoutParentViewIfNeeded(); 787 forceLayoutParentViewIfNeeded();
814 788
815 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. 789 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
816 rootForThisLayout->layout(); 790 rootForThisLayout->layout();
817 gatherDebugLayoutRects(rootForThisLayout); 791 gatherDebugLayoutRects(rootForThisLayout);
818 792
819 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllIma geResourcePriorities(); 793 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllIma geResourcePriorities();
820 794
821 TextAutosizer* textAutosizer = frame().document()->textAutosizer(); 795 TextAutosizer* textAutosizer = frame().document()->textAutosizer();
822 bool autosized; 796 bool autosized;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 // We should only invalidate paints for the outer most layout. This works as 1026 // We should only invalidate paints for the outer most layout. This works as
1053 // we continue to track paint invalidation rects until this function is call ed. 1027 // we continue to track paint invalidation rects until this function is call ed.
1054 ASSERT(!m_nestedLayoutCount); 1028 ASSERT(!m_nestedLayoutCount);
1055 1029
1056 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", TRACE_STR_COPY(ro ot->debugName().ascii().data())); 1030 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", TRACE_STR_COPY(ro ot->debugName().ascii().data()));
1057 1031
1058 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal. 1032 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal.
1059 // Until those states are fully fledged, I'll just disable the ASSERTS. 1033 // Until those states are fully fledged, I'll just disable the ASSERTS.
1060 DisableCompositingQueryAsserts compositingQueryAssertsDisabler; 1034 DisableCompositingQueryAsserts compositingQueryAssertsDisabler;
1061 1035
1062 RootLayoutStateScope rootLayoutStateScope(*root); 1036 LayoutState rootLayoutState(*root);
1063 1037
1064 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation()); 1038 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation());
1065 1039
1066 // Invalidate the paint of the frameviews scrollbars if needed 1040 // Invalidate the paint of the frameviews scrollbars if needed
1067 if (hasVerticalBarDamage()) 1041 if (hasVerticalBarDamage())
1068 invalidateRect(verticalBarDamage()); 1042 invalidateRect(verticalBarDamage());
1069 if (hasHorizontalBarDamage()) 1043 if (hasHorizontalBarDamage())
1070 invalidateRect(horizontalBarDamage()); 1044 invalidateRect(horizontalBarDamage());
1071 resetScrollbarDamage(); 1045 resetScrollbarDamage();
1072 } 1046 }
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after
3295 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3269 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3296 { 3270 {
3297 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3271 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3298 if (AXObjectCache* cache = axObjectCache()) { 3272 if (AXObjectCache* cache = axObjectCache()) {
3299 cache->remove(scrollbar); 3273 cache->remove(scrollbar);
3300 cache->handleScrollbarUpdate(this); 3274 cache->handleScrollbarUpdate(this);
3301 } 3275 }
3302 } 3276 }
3303 3277
3304 } // namespace WebCore 3278 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/LayoutState.h » ('j') | Source/core/rendering/LayoutState.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698