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

Unified Diff: Source/core/paint/ViewDisplayList.h

Issue 653303003: Generalize paint chunks to clips, and implement clips in LayerPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/ViewDisplayList.h
diff --git a/Source/core/paint/ViewDisplayList.h b/Source/core/paint/ViewDisplayList.h
index 9f6fb5720ba618cb29e97da7705f7cb8f79b0ec0..de6461fa9a3fd34483e52f4cd3c9ccc7158c614e 100644
--- a/Source/core/paint/ViewDisplayList.h
+++ b/Source/core/paint/ViewDisplayList.h
@@ -6,6 +6,7 @@
#define ViewDisplayList_h
#include "core/rendering/PaintPhase.h"
+#include "platform/geometry/RoundedRect.h"
#include "platform/graphics/DisplayList.h"
#include "wtf/HashSet.h"
#include "wtf/OwnPtr.h"
@@ -15,11 +16,45 @@ namespace blink {
class GraphicsContext;
class RenderObject;
+class RenderLayer;
struct AtomicPaintChunk;
-typedef Vector<OwnPtr<AtomicPaintChunk> > PaintCommandList;
-struct AtomicPaintChunk {
+struct DisplayItem {
+ virtual void replay(GraphicsContext*) = 0;
+
+ virtual ~DisplayItem() { }
+};
+
+struct ClipDisplayItem : DisplayItem {
+ RenderLayer* layer;
+ enum ClipType {
+ LayerOverflowControls,
+ LayerBackground,
+ LayerParent,
+ LayerFilter,
+ LayerForeground,
+ LayerFragmentFloat,
+ LayerFragmentForeground,
+ LayerFragmentChildOutline,
+ LayerFragmentOutline,
+ LayerFragmentMask,
+ LayerFragmentClippingMask,
+ LayerFragmentParent
+ };
+ ClipType clipType;
+ IntRect clipRect;
+ Vector<RoundedRect> roundedRectClips;
+
+ virtual void replay(GraphicsContext*);
+};
+
+struct EndClipDisplayItem : DisplayItem {
+ RenderLayer* layer;
+ virtual void replay(GraphicsContext*);
+};
+
+struct AtomicPaintChunk : DisplayItem {
AtomicPaintChunk(PassRefPtr<DisplayList> inDisplayList, RenderObject* inRenderer, PaintPhase inPhase)
: displayList(inDisplayList), renderer(inRenderer), phase(inPhase) { };
@@ -28,8 +63,12 @@ struct AtomicPaintChunk {
// This auxillary data can be moved off the chunk if needed.
RenderObject* renderer;
PaintPhase phase;
+
+ virtual void replay(GraphicsContext*);
};
+typedef Vector<OwnPtr<DisplayItem> > PaintList;
+
class PaintCommandRecorder {
public:
explicit PaintCommandRecorder(GraphicsContext*, RenderObject*, PaintPhase, const FloatRect&);
@@ -41,22 +80,37 @@ private:
PaintPhase m_phase;
};
+class PaintClipRecorder {
+public:
+ explicit PaintClipRecorder(RenderLayer*, ClipDisplayItem::ClipType);
+ void setClipRect(IntRect);
+ void addRoundedRectClip(const RoundedRect&);
+ void startClip();
+ void endClip();
+
+private:
+ OwnPtr<ClipDisplayItem> clipDisplayItem;
+#ifdef ASSERT_ENABLED
+ bool m_started, m_ended;
+#endif
+};
+
class ViewDisplayList {
public:
ViewDisplayList() { };
- const PaintCommandList& paintCommandList();
- void add(WTF::PassOwnPtr<AtomicPaintChunk>);
+ const PaintList& paintList();
+ void add(WTF::PassOwnPtr<DisplayItem>);
void invalidate(const RenderObject*);
private:
- bool isRepaint(PaintCommandList::iterator, const AtomicPaintChunk&);
+ bool isRepaint(PaintList::iterator, const DisplayItem&);
// Update m_paintList with any invalidations or new paints.
- void updatePaintCommandList();
+ void updatePaintList();
- PaintCommandList m_paintList;
+ PaintList m_paintList;
HashSet<const RenderObject*> m_invalidated;
- PaintCommandList m_newPaints;
+ PaintList m_newPaints;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698