Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1930183002: Refactor scroll updates during flexbox layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@rtl-scroll-origin
Patch Set: rebase + nits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index aa2ca6c0e8c2d607c669084117b148dab9a1247f..b85c79e5cd60e11be00441a77b25eff059ad9827 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -103,10 +103,6 @@ static TrackedContainerMap* gPositionedContainerMap = nullptr;
// for every layout (see the comment above about why).
static TrackedDescendantsMap* gPercentHeightDescendantsMap = nullptr;
-typedef WTF::HashSet<LayoutBlock*> DelayedUpdateScrollInfoSet;
-static int gDelayUpdateScrollInfo = 0;
-static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = nullptr;
-
LayoutBlock::LayoutBlock(ContainerNode* node)
: LayoutBox(node)
, m_hasMarginBeforeQuirk(false)
@@ -192,9 +188,6 @@ void LayoutBlock::willBeDestroyed()
m_lineBoxes.deleteLineBoxes();
- if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0))
- gDelayedUpdateScrollInfoSet->remove(this);
-
if (TextAutosizer* textAutosizer = document().textAutosizer())
textAutosizer->destroy(this);
@@ -622,61 +615,14 @@ void LayoutBlock::collapseAnonymousBlockChild(LayoutBlock* parent, LayoutBlock*
child->destroy();
}
-void LayoutBlock::startDelayUpdateScrollInfo()
-{
- if (gDelayUpdateScrollInfo == 0) {
- ASSERT(!gDelayedUpdateScrollInfoSet);
- gDelayedUpdateScrollInfoSet = new DelayedUpdateScrollInfoSet;
- }
- ASSERT(gDelayedUpdateScrollInfoSet);
- ++gDelayUpdateScrollInfo;
-}
-
-bool LayoutBlock::finishDelayUpdateScrollInfo(SubtreeLayoutScope* layoutScope, ScrollPositionMap* scrollMap)
-{
- bool childrenMarkedForRelayout = false;
-
- --gDelayUpdateScrollInfo;
- ASSERT(gDelayUpdateScrollInfo >= 0);
- if (gDelayUpdateScrollInfo == 0) {
- ASSERT(gDelayedUpdateScrollInfoSet);
-
- OwnPtr<DelayedUpdateScrollInfoSet> infoSet(adoptPtr(gDelayedUpdateScrollInfoSet));
- gDelayedUpdateScrollInfoSet = nullptr;
-
- for (auto* block : *infoSet) {
- if (block->hasOverflowClip()) {
- PaintLayerScrollableArea* scrollableArea = block->layer()->getScrollableArea();
- if (scrollMap)
- scrollMap->add(scrollableArea, scrollableArea->scrollPositionDouble());
- childrenMarkedForRelayout |= scrollableArea->updateAfterLayout(layoutScope);
- }
- }
- }
- return childrenMarkedForRelayout;
-}
-
void LayoutBlock::updateAfterLayout()
{
invalidateStickyConstraints();
// Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
// we overflow or not.
- if (hasOverflowClip()) {
- if (style()->isFlippedBlocksWritingMode()) {
- // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937
- // Workaround for now. We cannot delay the scroll info for overflow
- // for items with opposite writing directions, as the contents needs
- // to overflow in that direction
- layer()->getScrollableArea()->updateAfterLayout();
- return;
- }
-
- if (gDelayUpdateScrollInfo)
- gDelayedUpdateScrollInfoSet->add(this);
- else
- layer()->getScrollableArea()->updateAfterLayout();
- }
+ if (hasOverflowClip())
+ layer()->getScrollableArea()->updateAfterLayout();
}
void LayoutBlock::layout()

Powered by Google App Engine