Index: Source/core/paint/ViewDisplayList.cpp |
diff --git a/Source/core/paint/ViewDisplayList.cpp b/Source/core/paint/ViewDisplayList.cpp |
index 3e2b919695b7c24d60bbc622f9651b2383b4590c..6238aef5f56de154ac5791e5b3b4b580035492f0 100644 |
--- a/Source/core/paint/ViewDisplayList.cpp |
+++ b/Source/core/paint/ViewDisplayList.cpp |
@@ -5,6 +5,7 @@ |
#include "config.h" |
#include "core/paint/ViewDisplayList.h" |
+#include "core/rendering/RenderLayer.h" |
#include "core/rendering/RenderObject.h" |
#include "core/rendering/RenderView.h" |
#include "platform/NotImplemented.h" |
@@ -13,6 +14,24 @@ |
namespace blink { |
+void AtomicPaintChunk::replay(GraphicsContext* context) |
+{ |
+ context->drawDisplayList(displayList.get()); |
+} |
+ |
+void ClipDisplayItem::replay(GraphicsContext* context) |
+{ |
+ context->save(); |
+ context->clip(clipRect); |
+ for (RoundedRect roundedRect : roundedRectClips) |
+ context->clipRoundedRect(roundedRect); |
+} |
+ |
+void EndClipDisplayItem::replay(GraphicsContext* context) |
+{ |
+ context->restore(); |
+} |
+ |
PaintCommandRecorder::PaintCommandRecorder(GraphicsContext* context, RenderObject* renderer, PaintPhase phase, const FloatRect& clip) |
: m_context(context) |
, m_renderer(renderer) |
@@ -32,18 +51,47 @@ PaintCommandRecorder::~PaintCommandRecorder() |
m_renderer->view()->viewDisplayList().add(paintChunk.release()); |
} |
-const PaintCommandList& ViewDisplayList::paintCommandList() |
+PaintClipRecorder::PaintClipRecorder(RenderLayer* layer, ClipDisplayItem::ClipType clipType) |
+ |
+{ |
+ clipDisplayItem = adoptPtr(new ClipDisplayItem); |
+ clipDisplayItem->layer = layer; |
+ clipDisplayItem->clipType = clipType; |
+} |
+ |
+void PaintClipRecorder::setClipRect(IntRect clipRect) |
+{ |
+ clipDisplayItem->clipRect = clipRect; |
+} |
+ |
+void PaintClipRecorder::addRoundedRectClip(const RoundedRect& roundedRect) |
+{ |
+ clipDisplayItem->roundedRectClips.append(roundedRect); |
+} |
+ |
+void PaintClipRecorder::startClip() |
+{ |
+ clipDisplayItem->layer->renderer()->view()->viewDisplayList().add(clipDisplayItem.release()); |
+} |
+ |
+void PaintClipRecorder::endClip() |
+{ |
+ OwnPtr<EndClipDisplayItem> endClip = adoptPtr(new EndClipDisplayItem); |
+ clipDisplayItem->layer->renderer()->view()->viewDisplayList().add(endClip.release()); |
+} |
+ |
+const PaintList& ViewDisplayList::paintList() |
{ |
ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
- updatePaintCommandList(); |
+ updatePaintList(); |
return m_newPaints; |
} |
-void ViewDisplayList::add(WTF::PassOwnPtr<AtomicPaintChunk> atomicPaintChunk) |
+void ViewDisplayList::add(WTF::PassOwnPtr<DisplayItem> displayItem) |
{ |
ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
- m_newPaints.append(atomicPaintChunk); |
+ m_newPaints.append(displayItem); |
} |
void ViewDisplayList::invalidate(const RenderObject* renderer) |
@@ -52,7 +100,7 @@ void ViewDisplayList::invalidate(const RenderObject* renderer) |
m_invalidated.add(renderer); |
} |
-bool ViewDisplayList::isRepaint(PaintCommandList::iterator begin, const AtomicPaintChunk& atomicPaintChunk) |
+bool ViewDisplayList::isRepaint(PaintList::iterator begin, const DisplayItem& displayItem) |
{ |
notImplemented(); |
return false; |
@@ -63,7 +111,7 @@ bool ViewDisplayList::isRepaint(PaintCommandList::iterator begin, const AtomicPa |
// |
// The algorithm should be O(|existing paint list| + |newly painted list|). By using the ordering |
// implied by the existing paint list, extra treewalks are avoided. |
-void ViewDisplayList::updatePaintCommandList() |
+void ViewDisplayList::updatePaintList() |
{ |
notImplemented(); |
} |