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

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

Issue 195713002: Fix crash on ASSERT when in subtree layout and LayoutState is not initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 | « 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 flags |= RenderLayer::NeedsFullRepaintInBacking; 100 flags |= RenderLayer::NeedsFullRepaintInBacking;
101 } 101 }
102 if (isRelayoutingSubtree && layer->isPaginated()) 102 if (isRelayoutingSubtree && layer->isPaginated())
103 flags |= RenderLayer::UpdatePagination; 103 flags |= RenderLayer::UpdatePagination;
104 return flags; 104 return flags;
105 } 105 }
106 106
107 class FrameViewLayoutStateMaintainer { 107 class FrameViewLayoutStateMaintainer {
108 WTF_MAKE_NONCOPYABLE(FrameViewLayoutStateMaintainer); 108 WTF_MAKE_NONCOPYABLE(FrameViewLayoutStateMaintainer);
109 public: 109 public:
110 FrameViewLayoutStateMaintainer(RenderObject& root) 110 FrameViewLayoutStateMaintainer(RenderObject& root, bool inSubtreeLayout)
111 : m_view(*root.view()) 111 : m_view(*root.view())
112 , m_disabled(m_view.frameView()->isSubtreeLayout() && m_view.shouldDisab leLayoutStateForSubtree(root)) 112 , m_inSubtreeLayout(inSubtreeLayout)
113 , m_disabled(inSubtreeLayout && m_view.shouldDisableLayoutStateForSubtre e(root))
113 { 114 {
114 if (m_view.frameView()->isSubtreeLayout()) 115 if (m_inSubtreeLayout)
115 m_view.pushLayoutState(root); 116 m_view.pushLayoutState(root);
116 if (m_disabled) 117 if (m_disabled)
117 m_view.disableLayoutState(); 118 m_view.disableLayoutState();
118 } 119 }
119 120
120 ~FrameViewLayoutStateMaintainer() 121 ~FrameViewLayoutStateMaintainer()
121 { 122 {
122 if (m_disabled) 123 if (m_disabled)
123 m_view.enableLayoutState(); 124 m_view.enableLayoutState();
124 if (m_view.frameView()->isSubtreeLayout()) 125 if (m_inSubtreeLayout)
125 m_view.popLayoutState(); 126 m_view.popLayoutState();
126 } 127 }
127 private: 128 private:
128 RenderView& m_view; 129 RenderView& m_view;
130 bool m_inSubtreeLayout;
129 bool m_disabled; 131 bool m_disabled;
130 }; 132 };
131 133
132 FrameView::FrameView(LocalFrame* frame) 134 FrameView::FrameView(LocalFrame* frame)
133 : m_frame(frame) 135 : m_frame(frame)
134 , m_canHaveScrollbars(true) 136 , m_canHaveScrollbars(true)
135 , m_slowRepaintObjectCount(0) 137 , m_slowRepaintObjectCount(0)
136 , m_hasPendingLayout(false) 138 , m_hasPendingLayout(false)
137 , m_layoutSubtreeRoot(0) 139 , m_layoutSubtreeRoot(0)
138 , m_inSynchronousPostLayout(false) 140 , m_inSynchronousPostLayout(false)
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 792
791 ASSERT(!isInPerformLayout()); 793 ASSERT(!isInPerformLayout());
792 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); 794 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout);
793 795
794 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true); 796 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true);
795 797
796 // performLayout is the actual guts of layout(). 798 // performLayout is the actual guts of layout().
797 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions 799 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions
798 // so that a single human could understand what layout() is actually doing. 800 // so that a single human could understand what layout() is actually doing.
799 801
800 FrameViewLayoutStateMaintainer statePusher(*rootForThisLayout); 802 FrameViewLayoutStateMaintainer statePusher(*rootForThisLayout, inSubtreeLayo ut);
801 forceLayoutParentViewIfNeeded(); 803 forceLayoutParentViewIfNeeded();
802 804
803 { 805 {
804 // Text Autosizing requires two-pass layout which is incompatible with p artial layout. 806 // Text Autosizing requires two-pass layout which is incompatible with p artial layout.
805 // If enabled, only do partial layout for the second layout. 807 // If enabled, only do partial layout for the second layout.
806 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. 808 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
807 PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->se ttings() && m_frame->settings()->textAutosizingEnabled()); 809 PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->se ttings() && m_frame->settings()->textAutosizingEnabled());
808 rootForThisLayout->layout(); 810 rootForThisLayout->layout();
809 gatherDebugLayoutRects(rootForThisLayout); 811 gatherDebugLayoutRects(rootForThisLayout);
810 812
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3195 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3194 { 3196 {
3195 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3197 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3196 if (AXObjectCache* cache = axObjectCache()) { 3198 if (AXObjectCache* cache = axObjectCache()) {
3197 cache->remove(scrollbar); 3199 cache->remove(scrollbar);
3198 cache->handleScrollbarUpdate(this); 3200 cache->handleScrollbarUpdate(this);
3199 } 3201 }
3200 } 3202 }
3201 3203
3202 } // namespace WebCore 3204 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698