| Index: Source/core/paint/ViewDisplayList.cpp
|
| diff --git a/Source/core/paint/ViewDisplayList.cpp b/Source/core/paint/ViewDisplayList.cpp
|
| index 3e2b919695b7c24d60bbc622f9651b2383b4590c..6d236f68cb51e5d6e19e2d6ded51e3b45966e142 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,51 @@ PaintCommandRecorder::~PaintCommandRecorder()
|
| m_renderer->view()->viewDisplayList().add(paintChunk.release());
|
| }
|
|
|
| -const PaintCommandList& ViewDisplayList::paintCommandList()
|
| +StartClipRecorder::StartClipRecorder(RenderLayer* layer, GraphicsContext* graphicsContext, ClipDisplayItem::ClipType clipType, const ClipRect& clipRect)
|
| + : m_graphicsContext(graphicsContext)
|
| +{
|
| + IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect());
|
| + if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) {
|
| + graphicsContext->save();
|
| + graphicsContext->clip(snappedClipRect);
|
| + } else {
|
| + m_clipDisplayItem = adoptPtr(new ClipDisplayItem);
|
| + m_clipDisplayItem->layer = layer;
|
| + m_clipDisplayItem->clipType = clipType;
|
| + m_clipDisplayItem->clipRect = snappedClipRect;
|
| + }
|
| +}
|
| +
|
| +void StartClipRecorder::addRoundedRectClip(const RoundedRect& roundedRect)
|
| +{
|
| + if (RuntimeEnabledFeatures::slimmingPaintEnabled())
|
| + m_clipDisplayItem->roundedRectClips.append(roundedRect);
|
| + else
|
| + m_graphicsContext->clipRoundedRect(roundedRect);
|
| +}
|
| +
|
| +EndClipRecorder::EndClipRecorder(RenderLayer* layer, GraphicsContext* graphicsContext)
|
| +{
|
| + if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
|
| + OwnPtr<EndClipDisplayItem> endClip = adoptPtr(new EndClipDisplayItem);
|
| + layer->renderer()->view()->viewDisplayList().add(endClip.release());
|
| + } else {
|
| + graphicsContext->restore();
|
| + }
|
| +}
|
| +
|
| +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 +104,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 +115,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();
|
| }
|
|
|