Chromium Code Reviews| 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 c5ee0d2dcc69c2d3d5ab7f4d6cfc8b4a27faec58..66df222d3637b4bc464593c250fdde892fd6a992 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
| @@ -285,6 +285,16 @@ void PaintController::ProcessNewItem(DisplayItem& display_item) { |
| if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) |
| CheckUnderInvalidation(); |
| + |
| + if (!frame_first_paints_.back().first_painted && display_item.IsDrawing() && |
|
Xianzhu
2017/05/09 21:07:56
PaintController might paint something before Begin
Zhen Wang
2017/05/09 22:59:40
Done.
|
| + // Here we ignore all document-background paintings because we don't |
| + // know if the background is default. ViewPainter should have called |
| + // setFirstPainted() if this display item is for non-default |
| + // background. |
| + display_item.GetType() != DisplayItem::kDocumentBackground && |
| + display_item.DrawsContent()) { |
| + SetFirstPainted(); |
| + } |
| } |
| DisplayItem& PaintController::MoveItemFromCurrentListToNewList(size_t index) { |
| @@ -577,21 +587,6 @@ void PaintController::CommitNewDisplayItems( |
| } |
| } |
| - if (!first_painted_) { |
| - for (const auto& item : new_display_item_list_) { |
| - if (item.IsDrawing() && |
| - // Here we ignore all document-background paintings because we don't |
| - // know if the background is default. ViewPainter should have called |
| - // setFirstPainted() if this display item is for non-default |
| - // background. |
| - item.GetType() != DisplayItem::kDocumentBackground && |
| - item.DrawsContent()) { |
| - first_painted_ = true; |
| - break; |
| - } |
| - } |
| - } |
| - |
| for (auto* client : skipped_cache_clients) |
| client->SetDisplayItemsUncached(); |
| @@ -944,4 +939,27 @@ void PaintController::ShowDebugDataInternal(bool show_paint_records) const { |
| .data()); |
| } |
| +void PaintController::SetFirstPainted() { |
| + frame_first_paints_.back().first_painted = true; |
| +} |
| + |
| +void PaintController::SetTextPainted() { |
| + frame_first_paints_.back().text_painted = true; |
| +} |
| + |
| +void PaintController::SetImagePainted() { |
| + frame_first_paints_.back().image_painted = true; |
| +} |
| + |
| +void PaintController::BeginFrame(const void* frame) { |
| + frame_first_paints_.push_back(FrameFirstPaint(frame)); |
| +} |
| + |
| +FrameFirstPaint PaintController::EndFrame(const void* frame) { |
| + FrameFirstPaint result = frame_first_paints_.back(); |
| + DCHECK(result.frame == frame); |
| + frame_first_paints_.pop_back(); |
| + return result; |
| +} |
| + |
| } // namespace blink |