Changeset 223569 in webkit
- Timestamp:
- Oct 17, 2017 1:09:15 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223567 r223569 1 2017-10-17 Zalan Bujtas <zalan@apple.com> 2 3 [FrameView::layout cleanup] Subtree should read subtreeLayout. 4 https://bugs.webkit.org/show_bug.cgi?id=178401 5 6 Reviewed by Simon Fraser. 7 8 Rename some variables to improve readability. 9 10 No change in functionality. 11 12 * page/FrameView.cpp: 13 (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer): 14 (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer): 15 (WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree): 16 (WebCore::FrameView::reset): 17 (WebCore::FrameView::willDestroyRenderTree): 18 (WebCore::FrameView::didDestroyRenderTree): 19 (WebCore::FrameView::calculateScrollbarModesForLayout): 20 (WebCore::FrameView::layout): 21 (WebCore::FrameView::convertSubtreeLayoutToFullLayout): 22 (WebCore::FrameView::scheduleRelayout): 23 (WebCore::FrameView::scheduleRelayoutOfSubtree): 24 (WebCore::FrameView::needsLayout const): 25 (WebCore::FrameView::autoSizeIfEnabled): 26 * page/FrameView.h: 27 1 28 2017-10-16 Dean Jackson <dino@apple.com> 2 29 -
trunk/Source/WebCore/dom/Document.cpp
r223514 r223569 2069 2069 } 2070 2070 2071 if (currRenderer == frameView-> layoutRoot())2071 if (currRenderer == frameView->subtreeLayoutRoot()) 2072 2072 break; 2073 2073 } -
trunk/Source/WebCore/page/FrameView.cpp
r223551 r223569 167 167 public: 168 168 SubtreeLayoutStateMaintainer(RenderElement* subtreeLayoutRoot) 169 : m_ layoutRoot(subtreeLayoutRoot)169 : m_subtreeLayoutRoot(subtreeLayoutRoot) 170 170 { 171 if (m_ layoutRoot) {172 RenderView& view = m_ layoutRoot->view();173 view.pushLayoutState(*m_ layoutRoot);171 if (m_subtreeLayoutRoot) { 172 RenderView& view = m_subtreeLayoutRoot->view(); 173 view.pushLayoutState(*m_subtreeLayoutRoot); 174 174 if (shouldDisableLayoutStateForSubtree()) { 175 175 view.disableLayoutState(); … … 181 181 ~SubtreeLayoutStateMaintainer() 182 182 { 183 if (m_ layoutRoot) {184 RenderView& view = m_ layoutRoot->view();185 view.popLayoutState(*m_ layoutRoot);183 if (m_subtreeLayoutRoot) { 184 RenderView& view = m_subtreeLayoutRoot->view(); 185 view.popLayoutState(*m_subtreeLayoutRoot); 186 186 if (m_didDisableLayoutState) 187 187 view.enableLayoutState(); … … 191 191 bool shouldDisableLayoutStateForSubtree() 192 192 { 193 for (auto* renderer = m_ layoutRoot; renderer; renderer = renderer->container()) {193 for (auto* renderer = m_subtreeLayoutRoot; renderer; renderer = renderer->container()) { 194 194 if (renderer->hasTransform() || renderer->hasReflection()) 195 195 return true; … … 199 199 200 200 private: 201 RenderElement* m_ layoutRoot { nullptr };201 RenderElement* m_subtreeLayoutRoot { nullptr }; 202 202 bool m_didDisableLayoutState { false }; 203 203 }; … … 337 337 m_contentIsOpaque = false; 338 338 m_layoutTimer.stop(); 339 m_ layoutRoot = nullptr;339 m_subtreeLayoutRoot = nullptr; 340 340 m_delayedLayout = false; 341 341 m_needsFullRepaint = true; … … 656 656 { 657 657 detachCustomScrollbars(); 658 m_ layoutRoot = nullptr;658 m_subtreeLayoutRoot = nullptr; 659 659 } 660 660 661 661 void FrameView::didDestroyRenderTree() 662 662 { 663 ASSERT(!m_ layoutRoot);663 ASSERT(!m_subtreeLayoutRoot); 664 664 ASSERT(m_widgetsInRenderTree.isEmpty()); 665 665 … … 829 829 } 830 830 831 if (m_ layoutRoot)831 if (m_subtreeLayoutRoot) 832 832 return; 833 833 … … 1323 1323 #endif 1324 1324 1325 void FrameView::layout(bool allowSubtree )1325 void FrameView::layout(bool allowSubtreeLayout) 1326 1326 { 1327 1327 ASSERT_WITH_SECURITY_IMPLICATION(!frame().document()->inRenderTreeUpdate()); 1328 1328 1329 LOG(Layout, "FrameView %p (%dx%d) layout, main frameview %d, allowSubtree =%d", this, size().width(), size().height(), frame().isMainFrame(), allowSubtree);1329 LOG(Layout, "FrameView %p (%dx%d) layout, main frameview %d, allowSubtreeLayout=%d", this, size().width(), size().height(), frame().isMainFrame(), allowSubtreeLayout); 1330 1330 if (isInRenderTreeLayout()) { 1331 1331 LOG(Layout, " in layout, bailing"); … … 1355 1355 m_frameFlatteningViewSizeForMediaQuery = ScrollView::layoutSize(); 1356 1356 } 1357 startLayoutAtMainFrameViewIfNeeded(allowSubtree );1358 RenderElement* root = m_layoutRoot ? m_layoutRoot : frame().document()->renderView();1359 if (! root || !root->needsLayout())1357 startLayoutAtMainFrameViewIfNeeded(allowSubtreeLayout); 1358 auto* layoutRoot = m_subtreeLayoutRoot ? m_subtreeLayoutRoot : frame().document()->renderView(); 1359 if (!layoutRoot || !layoutRoot->needsLayout()) 1360 1360 return; 1361 1361 } … … 1365 1365 #if PLATFORM(IOS) 1366 1366 if (updateFixedPositionLayoutRect()) 1367 allowSubtree = false;1367 allowSubtreeLayout = false; 1368 1368 #endif 1369 1369 … … 1380 1380 AnimationUpdateBlock animationUpdateBlock(&frame().animation()); 1381 1381 1382 if (!allowSubtree && m_layoutRoot)1382 if (!allowSubtreeLayout && m_subtreeLayoutRoot) 1383 1383 convertSubtreeLayoutToFullLayout(); 1384 1384 … … 1388 1388 Document& document = *frame().document(); 1389 1389 ASSERT(document.pageCacheState() == Document::NotInPageCache); 1390 RenderElement* root = nullptr;1390 RenderElement* layoutRoot = nullptr; 1391 1391 RenderLayer* layer = nullptr; 1392 bool subtree= false;1392 bool isSubtreeLayout = false; 1393 1393 1394 1394 { … … 1430 1430 autoSizeIfEnabled(); 1431 1431 1432 root = m_layoutRoot ? m_layoutRoot : document.renderView();1433 if (! root)1432 layoutRoot = m_subtreeLayoutRoot ? m_subtreeLayoutRoot : document.renderView(); 1433 if (!layoutRoot) 1434 1434 return; 1435 subtree = m_layoutRoot;1436 1437 if (! m_layoutRoot) {1435 isSubtreeLayout = m_subtreeLayoutRoot; 1436 1437 if (!isSubtreeLayout) { 1438 1438 auto* body = document.bodyOrFrameset(); 1439 1439 if (body && body->renderer()) { … … 1452 1452 } 1453 1453 1454 m_needsFullRepaint = ! subtree && (m_firstLayout || downcast<RenderView>(*root).printing());1455 1456 if (! subtree) {1454 m_needsFullRepaint = !isSubtreeLayout && (m_firstLayout || downcast<RenderView>(*layoutRoot).printing()); 1455 1456 if (!isSubtreeLayout) { 1457 1457 ScrollbarMode hMode; 1458 1458 ScrollbarMode vMode; … … 1466 1466 m_firstLayoutCallbackPending = true; 1467 1467 m_lastViewportSize = sizeForResizeEvent(); 1468 m_lastZoomFactor = root->style().zoom();1468 m_lastZoomFactor = layoutRoot->style().zoom(); 1469 1469 1470 1470 // Set the initial vMode to AlwaysOn if we're auto. … … 1503 1503 } 1504 1504 1505 layer = root->enclosingLayer(); 1506 SubtreeLayoutStateMaintainer subtreeLayoutStateMaintainer(m_layoutRoot); 1507 1508 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(&root->view()); 1505 ASSERT(allowSubtreeLayout || !isSubtreeLayout); 1506 layer = layoutRoot->enclosingLayer(); 1507 SubtreeLayoutStateMaintainer subtreeLayoutStateMaintainer(m_subtreeLayoutRoot); 1508 1509 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(&layoutRoot->view()); 1509 1510 1510 1511 ASSERT(m_layoutPhase == InPreLayout); … … 1515 1516 ASSERT(m_layoutPhase == InRenderTreeLayout); 1516 1517 #ifndef NDEBUG 1517 RenderTreeNeedsLayoutChecker checker(* root);1518 RenderTreeNeedsLayoutChecker checker(*layoutRoot); 1518 1519 #endif 1519 root->layout();1520 layoutRoot->layout(); 1520 1521 1521 1522 #if ENABLE(TEXT_AUTOSIZING) 1522 applyTextSizingIfNeeded(* root);1523 applyTextSizingIfNeeded(*layoutRoot); 1523 1524 #endif 1524 1525 1525 1526 ASSERT(m_layoutPhase == InRenderTreeLayout); 1526 m_ layoutRoot = nullptr;1527 m_subtreeLayoutRoot = nullptr; 1527 1528 // Close block here to end the scope of changeSchedulingEnabled and SubtreeLayoutStateMaintainer. 1528 1529 } … … 1532 1533 bool neededFullRepaint = m_needsFullRepaint; 1533 1534 1534 if (! subtree && !downcast<RenderView>(*root).printing()) {1535 if (!isSubtreeLayout && !downcast<RenderView>(*layoutRoot).printing()) { 1535 1536 adjustViewSize(); 1536 1537 // FIXME: Firing media query callbacks synchronously on nested frames could produced a detached FrameView here by … … 1546 1547 // Now update the positions of all layers. 1547 1548 if (m_needsFullRepaint) 1548 root->view().repaintRootContents();1549 1550 root->view().releaseProtectedRenderWidgets();1551 1552 ASSERT(! root->needsLayout());1553 1554 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPositionFlags(layer, subtree, m_needsFullRepaint));1549 layoutRoot->view().repaintRootContents(); 1550 1551 layoutRoot->view().releaseProtectedRenderWidgets(); 1552 1553 ASSERT(!layoutRoot->needsLayout()); 1554 1555 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPositionFlags(layer, isSubtreeLayout, m_needsFullRepaint)); 1555 1556 1556 1557 updateCompositingLayersAfterLayout(); … … 1561 1562 1562 1563 #if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) 1563 if (AXObjectCache* cache = root->document().existingAXObjectCache())1564 cache->postNotification( root, AXObjectCache::AXLayoutComplete);1564 if (AXObjectCache* cache = layoutRoot->document().existingAXObjectCache()) 1565 cache->postNotification(layoutRoot, AXObjectCache::AXLayoutComplete); 1565 1566 #endif 1566 1567 … … 1605 1606 } 1606 1607 1607 InspectorInstrumentation::didLayout(cookie, * root);1608 InspectorInstrumentation::didLayout(cookie, *layoutRoot); 1608 1609 DebugPageOverlays::didLayout(frame()); 1609 1610 … … 3040 3041 void FrameView::convertSubtreeLayoutToFullLayout() 3041 3042 { 3042 ASSERT(m_ layoutRoot);3043 m_ layoutRoot->markContainingBlocksForLayout(ScheduleRelayout::No);3044 m_ layoutRoot = nullptr;3043 ASSERT(m_subtreeLayoutRoot); 3044 m_subtreeLayoutRoot->markContainingBlocksForLayout(ScheduleRelayout::No); 3045 m_subtreeLayoutRoot = nullptr; 3045 3046 } 3046 3047 … … 3060 3061 ASSERT(frame().view() == this); 3061 3062 3062 if (m_ layoutRoot)3063 if (m_subtreeLayoutRoot) 3063 3064 convertSubtreeLayoutToFullLayout(); 3064 3065 if (!m_layoutSchedulingEnabled) … … 3109 3110 ASSERT(frame().view() == this); 3110 3111 3111 // When m_ layoutRoot is already set, ignore the renderView's needsLayout bit3112 // since we need to resolve the conflict between the m_ layoutRoot and newRelayoutRoot layouts.3113 if (renderView.needsLayout() && !m_ layoutRoot) {3114 m_ layoutRoot = &newRelayoutRoot;3112 // When m_subtreeLayoutRoot is already set, ignore the renderView's needsLayout bit 3113 // since we need to resolve the conflict between the m_subtreeLayoutRoot and newRelayoutRoot layouts. 3114 if (renderView.needsLayout() && !m_subtreeLayoutRoot) { 3115 m_subtreeLayoutRoot = &newRelayoutRoot; 3115 3116 convertSubtreeLayoutToFullLayout(); 3116 3117 return; … … 3120 3121 Seconds delay = renderView.document().minimumLayoutDelay(); 3121 3122 ASSERT(!newRelayoutRoot.container() || is<RenderView>(newRelayoutRoot.container()) || !newRelayoutRoot.container()->needsLayout()); 3122 m_ layoutRoot = &newRelayoutRoot;3123 m_subtreeLayoutRoot = &newRelayoutRoot; 3123 3124 InspectorInstrumentation::didInvalidateLayout(frame()); 3124 3125 m_delayedLayout = delay.value(); … … 3127 3128 } 3128 3129 3129 if (m_ layoutRoot == &newRelayoutRoot)3130 return; 3131 3132 if (!m_ layoutRoot) {3130 if (m_subtreeLayoutRoot == &newRelayoutRoot) 3131 return; 3132 3133 if (!m_subtreeLayoutRoot) { 3133 3134 // We already have a pending (full) layout. Just mark the subtree for layout. 3134 3135 newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No); … … 3137 3138 } 3138 3139 3139 if (isObjectAncestorContainerOf(m_ layoutRoot, &newRelayoutRoot)) {3140 if (isObjectAncestorContainerOf(m_subtreeLayoutRoot, &newRelayoutRoot)) { 3140 3141 // Keep the current root. 3141 newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No, m_ layoutRoot);3142 ASSERT(!m_ layoutRoot->container() || is<RenderView>(m_layoutRoot->container()) || !m_layoutRoot->container()->needsLayout());3143 return; 3144 } 3145 3146 if (isObjectAncestorContainerOf(&newRelayoutRoot, m_ layoutRoot)) {3142 newRelayoutRoot.markContainingBlocksForLayout(ScheduleRelayout::No, m_subtreeLayoutRoot); 3143 ASSERT(!m_subtreeLayoutRoot->container() || is<RenderView>(m_subtreeLayoutRoot->container()) || !m_subtreeLayoutRoot->container()->needsLayout()); 3144 return; 3145 } 3146 3147 if (isObjectAncestorContainerOf(&newRelayoutRoot, m_subtreeLayoutRoot)) { 3147 3148 // Re-root at newRelayoutRoot. 3148 m_ layoutRoot->markContainingBlocksForLayout(ScheduleRelayout::No, &newRelayoutRoot);3149 m_ layoutRoot = &newRelayoutRoot;3150 ASSERT(!m_ layoutRoot->container() || is<RenderView>(m_layoutRoot->container()) || !m_layoutRoot->container()->needsLayout());3149 m_subtreeLayoutRoot->markContainingBlocksForLayout(ScheduleRelayout::No, &newRelayoutRoot); 3150 m_subtreeLayoutRoot = &newRelayoutRoot; 3151 ASSERT(!m_subtreeLayoutRoot->container() || is<RenderView>(m_subtreeLayoutRoot->container()) || !m_subtreeLayoutRoot->container()->needsLayout()); 3151 3152 InspectorInstrumentation::didInvalidateLayout(frame()); 3152 3153 return; … … 3171 3172 return layoutPending() 3172 3173 || (renderView && renderView->needsLayout()) 3173 || m_ layoutRoot3174 || m_subtreeLayoutRoot 3174 3175 || (m_deferSetNeedsLayoutCount && m_setNeedsLayoutWasDeferred); 3175 3176 } … … 3689 3690 LOG(Layout, "FrameView %p autoSizeIfEnabled", this); 3690 3691 SetForScope<bool> changeInAutoSize(m_inAutoSize, true); 3691 if (m_ layoutRoot)3692 if (m_subtreeLayoutRoot) 3692 3693 convertSubtreeLayoutToFullLayout(); 3693 3694 // Start from the minimum size and allow it to grow. -
trunk/Source/WebCore/page/FrameView.h
r223432 r223569 117 117 bool inPaintableState() { return m_layoutPhase != InRenderTreeLayout && m_layoutPhase != InViewSizeAdjust && m_layoutPhase != InPostLayout; } 118 118 119 RenderElement* layoutRoot() const { return m_layoutRoot; }120 void clear LayoutRoot() { m_layoutRoot = nullptr; }119 RenderElement* subtreeLayoutRoot() const { return m_subtreeLayoutRoot; } 120 void clearSubtreeLayoutRoot() { m_subtreeLayoutRoot = nullptr; } 121 121 int layoutCount() const { return m_layoutCount; } 122 122 … … 800 800 Timer m_layoutTimer; 801 801 bool m_delayedLayout; 802 RenderElement* m_ layoutRoot { nullptr };802 RenderElement* m_subtreeLayoutRoot { nullptr }; 803 803 804 804 LayoutPhase m_layoutPhase; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r223389 r223569 2297 2297 2298 2298 // If layout is limited to a subtree, the subtree root's logical width does not change. 2299 if (element() && !view().frameView().layoutPending() && view().frameView(). layoutRoot() == this)2299 if (element() && !view().frameView().layoutPending() && view().frameView().subtreeLayoutRoot() == this) 2300 2300 return; 2301 2301 -
trunk/Source/WebCore/rendering/RenderElement.cpp
r223514 r223569 1097 1097 } 1098 1098 1099 inline void RenderElement::clear LayoutRootIfNeeded() const1099 inline void RenderElement::clearSubtreeLayoutRootIfNeeded() const 1100 1100 { 1101 1101 if (renderTreeBeingDestroyed()) 1102 1102 return; 1103 1103 1104 if (view().frameView(). layoutRoot() != this)1104 if (view().frameView().subtreeLayoutRoot() != this) 1105 1105 return; 1106 1106 … … 1112 1112 // the layout root is still set to |this|. Make sure to clear it 1113 1113 // since we are getting destroyed. 1114 view().frameView().clear LayoutRoot();1114 view().frameView().clearSubtreeLayoutRoot(); 1115 1115 } 1116 1116 … … 1129 1129 RenderObject::willBeDestroyed(); 1130 1130 1131 clear LayoutRootIfNeeded();1131 clearSubtreeLayoutRootIfNeeded(); 1132 1132 1133 1133 if (hasInitializedStyle()) { -
trunk/Source/WebCore/rendering/RenderElement.h
r223194 r223569 324 324 bool getTrailingCorner(FloatPoint& output, bool& insideFixed) const; 325 325 326 void clear LayoutRootIfNeeded() const;326 void clearSubtreeLayoutRootIfNeeded() const; 327 327 328 328 bool shouldWillChangeCreateStackingContext() const;
Note: See TracChangeset
for help on using the changeset viewer.