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

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: nits Created 4 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 side-by-side diff with in-line comments
Download patch
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 1558ff589901d6e1c1eec36f77ec0296f1dadc3d..5d467351fbbe677e581143a030b555be27cce364 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -83,10 +83,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)
@@ -134,9 +130,6 @@ void LayoutBlock::willBeDestroyed()
if (!documentBeingDestroyed() && parent())
parent()->dirtyLinesFromChangedChild(this);
- if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0))
- gDelayedUpdateScrollInfoSet->remove(this);
-
if (TextAutosizer* textAutosizer = document().textAutosizer())
textAutosizer->destroy(this);
@@ -343,61 +336,14 @@ void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child)
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
This is Rietveld 408576698