Index: third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp |
index c61fd4d4840e1eb20215fe848aed6dd1eea044b4..5247ddb266c3adfd8fafac494416ff16876587a8 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp |
@@ -77,6 +77,20 @@ PaintArtifact& PaintArtifact::operator=(PaintArtifact&& source) |
return *this; |
} |
+static bool compareChunkAndIndex(const PaintChunk& chunk, unsigned index) |
pdr.
2016/07/26 16:54:21
Should all of these unsigned be size_t (here, and
Xianzhu
2016/07/26 17:01:43
Do you know what was the reason that we chose unsi
|
+{ |
+ return chunk.endIndex <= index; |
+} |
+ |
+Vector<PaintChunk>::const_iterator PaintArtifact::findChunkByDisplayItemIndex(unsigned index) const |
+{ |
+ auto chunkIt = std::lower_bound(m_paintChunks.begin(), m_paintChunks.end(), index, compareChunkAndIndex); |
+ DCHECK(chunkIt != m_paintChunks.end()); |
+ DCHECK(index >= chunkIt->beginIndex); |
+ DCHECK(index < chunkIt->endIndex); |
+ return chunkIt; |
+} |
+ |
void PaintArtifact::reset() |
{ |
m_displayItemList.clear(); |