Index: third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h |
index ccfb00905fbeaaf192487c5359c394929dd4afdd..c5d897477880c790e8301cb342c2dd3e70a33658 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h |
+++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h |
@@ -8,32 +8,48 @@ |
#include "base/compiler_specific.h" |
#include "platform/PlatformExport.h" |
#include "platform/RuntimeEnabledFeatures.h" |
-#include "platform/geometry/FloatPoint.h" |
+#include "platform/geometry/FloatRect.h" |
#include "platform/graphics/paint/DisplayItem.h" |
#include "platform/graphics/paint/PaintRecord.h" |
#include "third_party/skia/include/core/SkRefCnt.h" |
namespace blink { |
+// DrawingDisplayItem contains recorded painting operations which can be |
+// replayed to produce a rastered output. |
+// |
+// This class has two notions of the bounds around the content that was recorded |
+// and will be produced by the item. The first is the |record_bounds| which |
+// describes the bounds of all content in the |record| in the space of the |
+// record. The second is the |visual_rect| which should describe the same thing, |
+// but takes into account transforms and clips that would apply to the |
+// PaintRecord, and is in the space of the DisplayItemList. This allows the |
+// visual_rect to be compared between DrawingDisplayItems, and to give bounds |
+// around what the user can actually see from the PaintRecord. |
class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { |
public: |
DISABLE_CFI_PERF |
DrawingDisplayItem(const DisplayItemClient& client, |
Type type, |
sk_sp<const PaintRecord> record, |
+ const FloatRect& record_bounds, |
bool known_to_be_opaque = false) |
: DisplayItem(client, type, sizeof(*this)), |
record_(record && record->size() ? std::move(record) : nullptr), |
+ record_bounds_(record_bounds), |
known_to_be_opaque_(known_to_be_opaque) { |
DCHECK(IsDrawingType(type)); |
} |
void Replay(GraphicsContext&) const override; |
- void AppendToWebDisplayItemList(const IntRect&, |
+ void AppendToWebDisplayItemList(const IntRect& visual_rect, |
WebDisplayItemList*) const override; |
bool DrawsContent() const override; |
const sk_sp<const PaintRecord>& GetPaintRecord() const { return record_; } |
+ // This rect is described in the coordinate space relative to the PaintRecord |
+ // whose bounds it describes. |
+ FloatRect GetPaintRecordBounds() const { return record_bounds_; } |
bool KnownToBeOpaque() const { |
DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
@@ -49,6 +65,7 @@ class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { |
bool Equals(const DisplayItem& other) const final; |
sk_sp<const PaintRecord> record_; |
+ FloatRect record_bounds_; |
// True if there are no transparent areas. Only used for SlimmingPaintV2. |
const bool known_to_be_opaque_; |