| Index: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
|
| index 833198a060895d633a0b580c5e0ebc1385c18d77..894815a516947e49ca1e12348db495aece58f461 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
|
| @@ -18,6 +18,15 @@
|
|
|
| namespace blink {
|
|
|
| +void PaintController::setTracksRasterInvalidations(bool value)
|
| +{
|
| + if (value)
|
| + m_paintChunksRasterInvalidationTrackingMap = wrapUnique(new RasterInvalidationTrackingMap<const PaintChunk>);
|
| + else
|
| + m_paintChunksRasterInvalidationTrackingMap = nullptr;
|
| +}
|
| +
|
| +
|
| const PaintArtifact& PaintController::paintArtifact() const
|
| {
|
| DCHECK(m_newDisplayItemList.isEmpty());
|
| @@ -538,8 +547,9 @@ void PaintController::generateChunkRasterInvalidationRects(PaintChunk& newChunk)
|
| if (newChunk.beginIndex >= m_currentCachedSubsequenceBeginIndexInNewList)
|
| return;
|
|
|
| + static FloatRect infiniteFloatRect(LayoutRect::infiniteIntRect());
|
| if (!newChunk.id) {
|
| - newChunk.rasterInvalidationRects.append(FloatRect(LayoutRect::infiniteIntRect()));
|
| + addRasterInvalidationInfo(nullptr, newChunk, infiniteFloatRect);
|
| return;
|
| }
|
|
|
| @@ -575,7 +585,25 @@ void PaintController::generateChunkRasterInvalidationRects(PaintChunk& newChunk)
|
| }
|
|
|
| // We reach here because the chunk is new.
|
| - newChunk.rasterInvalidationRects.append(FloatRect(LayoutRect::infiniteIntRect()));
|
| + addRasterInvalidationInfo(nullptr, newChunk, infiniteFloatRect);
|
| +}
|
| +
|
| +void PaintController::addRasterInvalidationInfo(const DisplayItemClient* client, PaintChunk& chunk, const FloatRect& rect)
|
| +{
|
| + chunk.rasterInvalidationRects.append(rect);
|
| + if (!m_paintChunksRasterInvalidationTrackingMap)
|
| + return;
|
| +
|
| + RasterInvalidationInfo info;
|
| + info.rect = enclosingIntRect(rect);
|
| + info.client = client;
|
| + if (client) {
|
| + info.clientDebugName = client->debugName();
|
| + info.reason = client->getPaintInvalidationReason();
|
| + }
|
| +
|
| + RasterInvalidationTracking& tracking = m_paintChunksRasterInvalidationTrackingMap->add(&chunk);
|
| + tracking.trackedRasterInvalidations.append(info);
|
| }
|
|
|
| void PaintController::generateChunkRasterInvalidationRectsComparingOldChunk(PaintChunk& newChunk, const PaintChunk& oldChunk)
|
| @@ -598,7 +626,8 @@ void PaintController::generateChunkRasterInvalidationRectsComparingOldChunk(Pain
|
| clientToInvalidate = &m_newDisplayItemList[movedToIndex].client();
|
| // And invalidate in the new chunk into which the item was moved.
|
| PaintChunk& movedToChunk = m_newPaintChunks.findChunkByDisplayItemIndex(movedToIndex);
|
| - movedToChunk.rasterInvalidationRects.append(clientToInvalidate->visualRect());
|
| +
|
| + addRasterInvalidationInfo(clientToInvalidate, movedToChunk, FloatRect(clientToInvalidate->visualRect()));
|
| } else if (movedToIndex < highestMovedToIndex) {
|
| // The item has been moved behind other cached items, so need to invalidate the area
|
| // that is probably exposed by the item moved earlier.
|
| @@ -611,15 +640,17 @@ void PaintController::generateChunkRasterInvalidationRectsComparingOldChunk(Pain
|
| clientToInvalidate = &oldItem.client();
|
| }
|
| if (clientToInvalidate && invalidatedClientsInOldChunk.add(clientToInvalidate).isNewEntry) {
|
| - newChunk.rasterInvalidationRects.append(m_currentPaintArtifact.getDisplayItemList().visualRect(oldIndex));
|
| + addRasterInvalidationInfo(clientToInvalidate, newChunk, FloatRect(m_currentPaintArtifact.getDisplayItemList().visualRect(oldIndex)));
|
| +
|
| }
|
| }
|
|
|
| HashSet<const DisplayItemClient*> invalidatedClientsInNewChunk;
|
| for (size_t newIndex = newChunk.beginIndex; newIndex < newChunk.endIndex; ++newIndex) {
|
| const DisplayItem& newItem = m_newDisplayItemList[newIndex];
|
| - if (newItem.drawsContent() && !clientCacheIsValid(newItem.client()) && invalidatedClientsInNewChunk.add(&newItem.client()).isNewEntry)
|
| - newChunk.rasterInvalidationRects.append(newItem.client().visualRect());
|
| + if (newItem.drawsContent() && !clientCacheIsValid(newItem.client()) && invalidatedClientsInNewChunk.add(&newItem.client()).isNewEntry) {
|
| + addRasterInvalidationInfo(&newItem.client(), newChunk, FloatRect(newItem.client().visualRect()));
|
| + }
|
| }
|
| }
|
|
|
|
|