Changeset 223649 in webkit
- Timestamp:
- Oct 18, 2017 7:22:45 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223644 r223649 1 2017-10-18 Zalan Bujtas <zalan@apple.com> 2 3 [FrameView::layout cleanup] Group related pre-layout code to improve readability 4 https://bugs.webkit.org/show_bug.cgi?id=178496 5 <rdar://problem/35065718> 6 7 Reviewed by Simon Fraser. 8 9 Early returns/asserts/member variable resets etc. 10 11 Covered by existing tests. 12 13 * page/FrameView.cpp: 14 (WebCore::FrameView::layout): 15 1 16 2017-10-17 Jiewen Tan <jiewen_tan@apple.com> 2 17 -
trunk/Source/WebCore/page/FrameView.cpp
r223633 r223649 1350 1350 LOG(Layout, "FrameView %p (%dx%d) layout, main frameview %d, allowSubtreeLayout=%d", this, size().width(), size().height(), frame().isMainFrame(), allowSubtreeLayout); 1351 1351 if (isInRenderTreeLayout()) { 1352 LOG(Layout, " in layout, bailing");1352 LOG(Layout, " in render tree layout, bailing"); 1353 1353 return; 1354 1354 } 1355 1355 1356 1356 if (layoutDisallowed()) { 1357 LOG(Layout, " layout is disallowed, bailing"); 1358 return; 1359 } 1360 1357 LOG(Layout, " is disallowed, bailing"); 1358 return; 1359 } 1360 ASSERT(!isPainting()); 1361 if (isPainting()) { 1362 LOG(Layout, " in painting, bailing"); 1363 return; 1364 } 1365 1366 ASSERT(frame().view() == this); 1367 ASSERT(frame().document()); 1368 ASSERT(frame().document()->pageCacheState() == Document::NotInPageCache); 1361 1369 // Protect the view from being deleted during layout (in recalcStyle). 1362 1370 Ref<FrameView> protectedThis(*this); 1371 TraceScope tracingScope(LayoutStart, LayoutEnd); 1372 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(frame()); 1373 AnimationUpdateBlock animationUpdateBlock(&frame().animation()); 1363 1374 1364 1375 // Many of the tasks performed during layout can cause this function to be re-entered, 1365 1376 // so save the layout phase now and restore it on exit. 1366 1377 SetForScope<LayoutPhase> layoutPhaseRestorer(m_layoutPhase, InPreLayout); 1367 1368 1378 // Every scroll that happens during layout is programmatic. 1369 1379 SetForScope<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true); 1370 1371 TraceScope tracingScope(LayoutStart, LayoutEnd);1372 1373 if (handleLayoutWithFrameFlatteningIfNeeded(allowSubtreeLayout))1374 return;1375 1380 1381 m_layoutTimer.stop(); 1382 m_delayedLayout = false; 1383 m_setNeedsLayoutWasDeferred = false; 1384 if (!allowSubtreeLayout && m_subtreeLayoutRoot) 1385 convertSubtreeLayoutToFullLayout(); 1376 1386 #if PLATFORM(IOS) 1377 1387 if (updateFixedPositionLayoutRect()) … … 1379 1389 #endif 1380 1390 1381 m_layoutTimer.stop(); 1382 m_delayedLayout = false; 1383 m_setNeedsLayoutWasDeferred = false; 1384 1385 // we shouldn't enter layout() while painting 1386 ASSERT(!isPainting()); 1387 if (isPainting()) 1388 return; 1389 1390 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(frame()); 1391 AnimationUpdateBlock animationUpdateBlock(&frame().animation()); 1392 1393 if (!allowSubtreeLayout && m_subtreeLayoutRoot) 1394 convertSubtreeLayoutToFullLayout(); 1395 1396 ASSERT(frame().view() == this); 1397 ASSERT(frame().document()); 1391 if (handleLayoutWithFrameFlatteningIfNeeded(allowSubtreeLayout)) 1392 return; 1398 1393 1399 1394 Document& document = *frame().document(); 1400 ASSERT(document.pageCacheState() == Document::NotInPageCache);1401 1395 RenderElement* layoutRoot = nullptr; 1402 RenderLayer* layer = nullptr;1403 1396 bool isSubtreeLayout = false; 1404 1405 1397 { 1406 1398 SetForScope<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); … … 1494 1486 1495 1487 ASSERT(allowSubtreeLayout || !isSubtreeLayout); 1496 layer = layoutRoot->enclosingLayer(); 1488 ASSERT(m_layoutPhase == InPreLayout); 1489 1490 forceLayoutParentViewIfNeeded(); 1491 1497 1492 SubtreeLayoutStateMaintainer subtreeLayoutStateMaintainer(m_subtreeLayoutRoot); 1498 1499 1493 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(&layoutRoot->view()); 1500 1501 ASSERT(m_layoutPhase == InPreLayout);1502 m_layoutPhase = InRenderTreeLayout;1503 1504 forceLayoutParentViewIfNeeded();1505 1506 ASSERT(m_layoutPhase == InRenderTreeLayout);1507 1494 #ifndef NDEBUG 1508 1495 RenderTreeNeedsLayoutChecker checker(*layoutRoot); 1509 1496 #endif 1497 m_layoutPhase = InRenderTreeLayout; 1510 1498 layoutRoot->layout(); 1499 ASSERT(m_layoutPhase == InRenderTreeLayout); 1511 1500 1512 1501 #if ENABLE(TEXT_AUTOSIZING) 1513 1502 applyTextSizingIfNeeded(*layoutRoot); 1514 1503 #endif 1515 1516 ASSERT(m_layoutPhase == InRenderTreeLayout);1517 1504 m_subtreeLayoutRoot = nullptr; 1518 1505 // Close block here to end the scope of changeSchedulingEnabled and SubtreeLayoutStateMaintainer. … … 1536 1523 1537 1524 ASSERT(!layoutRoot->needsLayout()); 1538 1539 lay er->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPositionFlags(layer, isSubtreeLayout, m_needsFullRepaint));1525 auto* layoutRootEnclosingLayer = layoutRoot->enclosingLayer(); 1526 layoutRootEnclosingLayer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPositionFlags(layoutRootEnclosingLayer, isSubtreeLayout, m_needsFullRepaint)); 1540 1527 1541 1528 updateCompositingLayersAfterLayout();
Note: See TracChangeset
for help on using the changeset viewer.