| Index: third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
|
| index 2a3e56c0ae77b53a42416110c7ce595efce64f6c..7e34f1e76e3eca1ba87d4ac288a954e2432b5f6c 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
|
| @@ -8,7 +8,7 @@
|
|
|
| namespace blink {
|
|
|
| -PaintChunker::PaintChunker() {}
|
| +PaintChunker::PaintChunker() : m_skippedItemsSinceLastChunk(0) {}
|
|
|
| PaintChunker::~PaintChunker() {}
|
|
|
| @@ -25,6 +25,10 @@ void PaintChunker::updateCurrentPaintChunkProperties(
|
|
|
| bool PaintChunker::incrementDisplayItemIndex(const DisplayItem& item) {
|
| DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
|
| + if (!PaintChunker::canBeginOrEndChunk(item)) {
|
| + m_skippedItemsSinceLastChunk++;
|
| + return false;
|
| + }
|
|
|
| #if DCHECK_IS_ON()
|
| // Property nodes should never be null because they should either be set to
|
| @@ -50,14 +54,17 @@ bool PaintChunker::incrementDisplayItemIndex(const DisplayItem& item) {
|
| // from using the same id as the chunk before the foreign layer chunk.
|
| m_currentChunkId = WTF::nullopt;
|
| } else {
|
| + DCHECK(DisplayItem::isDrawingType(item.getType()));
|
| behavior = DefaultBehavior;
|
| if (!item.skippedCache() && m_currentChunkId)
|
| newChunkId.emplace(*m_currentChunkId);
|
| }
|
|
|
| if (m_chunks.isEmpty()) {
|
| - PaintChunk newChunk(0, 1, newChunkId ? &*newChunkId : nullptr,
|
| - m_currentProperties);
|
| + PaintChunk newChunk(
|
| + m_skippedItemsSinceLastChunk, m_skippedItemsSinceLastChunk + 1,
|
| + newChunkId ? &*newChunkId : nullptr, m_currentProperties);
|
| + m_skippedItemsSinceLastChunk = 0;
|
| m_chunks.push_back(newChunk);
|
| m_chunkBehavior.push_back(behavior);
|
| return true;
|
| @@ -68,12 +75,18 @@ bool PaintChunker::incrementDisplayItemIndex(const DisplayItem& item) {
|
| behavior != RequiresSeparateChunk &&
|
| m_chunkBehavior.back() != RequiresSeparateChunk;
|
| if (canContinueChunk) {
|
| + if (m_skippedItemsSinceLastChunk) {
|
| + lastChunk.endIndex += m_skippedItemsSinceLastChunk;
|
| + m_skippedItemsSinceLastChunk = 0;
|
| + }
|
| lastChunk.endIndex++;
|
| return false;
|
| }
|
|
|
| - PaintChunk newChunk(lastChunk.endIndex, lastChunk.endIndex + 1,
|
| + PaintChunk newChunk(lastChunk.endIndex + m_skippedItemsSinceLastChunk,
|
| + lastChunk.endIndex + m_skippedItemsSinceLastChunk + 1,
|
| newChunkId ? &*newChunkId : nullptr, m_currentProperties);
|
| + m_skippedItemsSinceLastChunk = 0;
|
| m_chunks.push_back(newChunk);
|
| m_chunkBehavior.push_back(behavior);
|
| return true;
|
| @@ -83,6 +96,11 @@ bool PaintChunker::decrementDisplayItemIndex() {
|
| DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
|
| DCHECK(!m_chunks.isEmpty());
|
|
|
| + if (m_skippedItemsSinceLastChunk) {
|
| + m_skippedItemsSinceLastChunk--;
|
| + return false;
|
| + }
|
| +
|
| auto& lastChunk = m_chunks.back();
|
| if ((lastChunk.endIndex - lastChunk.beginIndex) > 1) {
|
| lastChunk.endIndex--;
|
| @@ -99,6 +117,7 @@ void PaintChunker::clear() {
|
| m_chunkBehavior.clear();
|
| m_currentChunkId = WTF::nullopt;
|
| m_currentProperties = PaintChunkProperties();
|
| + m_skippedItemsSinceLastChunk = 0;
|
| }
|
|
|
| Vector<PaintChunk> PaintChunker::releasePaintChunks() {
|
| @@ -107,6 +126,7 @@ Vector<PaintChunk> PaintChunker::releasePaintChunks() {
|
| m_chunkBehavior.clear();
|
| m_currentChunkId = WTF::nullopt;
|
| m_currentProperties = PaintChunkProperties();
|
| + m_skippedItemsSinceLastChunk = 0;
|
| return chunks;
|
| }
|
|
|
|
|