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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp

Issue 2894093002: Don't access DisplayItemClient::VisualRect() for cached display items. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/paint/DrawingDisplayItem.h" 5 #include "platform/graphics/paint/DrawingDisplayItem.h"
6 6
7 #include "platform/graphics/GraphicsContext.h" 7 #include "platform/graphics/GraphicsContext.h"
8 #include "platform/graphics/paint/PaintCanvas.h" 8 #include "platform/graphics/paint/PaintCanvas.h"
9 #include "public/platform/WebDisplayItemList.h" 9 #include "public/platform/WebDisplayItemList.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "third_party/skia/include/core/SkCanvas.h" 11 #include "third_party/skia/include/core/SkCanvas.h"
12 #include "third_party/skia/include/core/SkData.h" 12 #include "third_party/skia/include/core/SkData.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 void DrawingDisplayItem::Replay(GraphicsContext& context) const { 16 void DrawingDisplayItem::Replay(GraphicsContext& context) const {
17 if (record_) 17 if (record_)
18 context.DrawRecord(record_); 18 context.DrawRecord(record_);
19 } 19 }
20 20
21 void DrawingDisplayItem::AppendToWebDisplayItemList( 21 void DrawingDisplayItem::AppendToWebDisplayItemList(
22 const IntRect& visual_rect, 22 const LayoutSize& visual_rect_offset,
23 WebDisplayItemList* list) const { 23 WebDisplayItemList* list) const {
24 if (record_) { 24 if (record_) {
25 list->AppendDrawingItem(visual_rect, record_, 25 LayoutRect visual_rect = VisualRect();
26 visual_rect.Move(-visual_rect_offset);
27 list->AppendDrawingItem(EnclosingIntRect(visual_rect), record_,
26 EnclosingIntRect(record_bounds_)); 28 EnclosingIntRect(record_bounds_));
27 } 29 }
28 } 30 }
29 31
30 bool DrawingDisplayItem::DrawsContent() const { 32 bool DrawingDisplayItem::DrawsContent() const {
31 return record_.get(); 33 return record_.get();
32 } 34 }
33 35
34 int DrawingDisplayItem::NumberOfSlowPaths() const { 36 int DrawingDisplayItem::NumberOfSlowPaths() const {
35 return record_ ? record_->numSlowPaths() : 0; 37 return record_ ? record_->numSlowPaths() : 0;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 115
114 if (RecordsEqual(record, other_record, bounds)) 116 if (RecordsEqual(record, other_record, bounds))
115 return true; 117 return true;
116 118
117 // Sometimes the client may produce different records for the same visual 119 // Sometimes the client may produce different records for the same visual
118 // result, which should be treated as equal. 120 // result, which should be treated as equal.
119 return BitmapsEqual(std::move(record), std::move(other_record), bounds); 121 return BitmapsEqual(std::move(record), std::move(other_record), bounds);
120 } 122 }
121 123
122 } // namespace blink 124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698