| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ViewDisplayList_h | |
| 6 #define ViewDisplayList_h | |
| 7 | |
| 8 #include "core/rendering/PaintPhase.h" | |
| 9 #include "wtf/HashSet.h" | |
| 10 #include "wtf/PassOwnPtr.h" | |
| 11 #include "wtf/Vector.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 class GraphicsContext; | |
| 16 class RenderObject; | |
| 17 | |
| 18 class DisplayItem { | |
| 19 public: | |
| 20 enum Type { | |
| 21 // DisplayItem types must be kept in sync with PaintPhase. | |
| 22 DrawingPaintPhaseBlockBackground = 0, | |
| 23 DrawingPaintPhaseChildBlockBackground = 1, | |
| 24 DrawingPaintPhaseChildBlockBackgrounds = 2, | |
| 25 DrawingPaintPhaseFloat = 3, | |
| 26 DrawingPaintPhaseForeground = 4, | |
| 27 DrawingPaintPhaseOutline = 5, | |
| 28 DrawingPaintPhaseChildOutlines = 6, | |
| 29 DrawingPaintPhaseSelfOutline = 7, | |
| 30 DrawingPaintPhaseSelection = 8, | |
| 31 DrawingPaintPhaseCollapsedTableBorders = 9, | |
| 32 DrawingPaintPhaseTextClip = 10, | |
| 33 DrawingPaintPhaseMask = 11, | |
| 34 DrawingPaintPhaseClippingMask = 12, | |
| 35 ClipLayerOverflowControls = 13, | |
| 36 ClipLayerBackground = 14, | |
| 37 ClipLayerParent = 15, | |
| 38 ClipLayerFilter = 16, | |
| 39 ClipLayerForeground = 17, | |
| 40 ClipLayerFragmentFloat = 18, | |
| 41 ClipLayerFragmentForeground = 19, | |
| 42 ClipLayerFragmentChildOutline = 20, | |
| 43 ClipLayerFragmentOutline = 21, | |
| 44 ClipLayerFragmentMask = 22, | |
| 45 ClipLayerFragmentClippingMask = 23, | |
| 46 ClipLayerFragmentParent = 24, | |
| 47 ClipLayerFragmentSelection = 25, | |
| 48 ClipLayerFragmentChildBlockBackgrounds = 26, | |
| 49 EndClip = 27, | |
| 50 }; | |
| 51 | |
| 52 virtual ~DisplayItem() { } | |
| 53 | |
| 54 virtual void replay(GraphicsContext*) = 0; | |
| 55 | |
| 56 const RenderObject* renderer() const { return m_id.renderer; } | |
| 57 Type type() const { return m_id.type; } | |
| 58 bool idsEqual(const DisplayItem& other) const { return m_id.renderer == othe
r.m_id.renderer && m_id.type == other.m_id.type; } | |
| 59 | |
| 60 #ifndef NDEBUG | |
| 61 static WTF::String typeAsDebugString(DisplayItem::Type); | |
| 62 static WTF::String rendererDebugString(const RenderObject*); | |
| 63 virtual WTF::String asDebugString() const; | |
| 64 #endif | |
| 65 | |
| 66 protected: | |
| 67 DisplayItem(const RenderObject* renderer, Type type) | |
| 68 : m_id(renderer, type) | |
| 69 { } | |
| 70 | |
| 71 private: | |
| 72 struct Id { | |
| 73 Id(const RenderObject* r, Type t) | |
| 74 : renderer(r) | |
| 75 , type(t) | |
| 76 { } | |
| 77 | |
| 78 const RenderObject* renderer; | |
| 79 const Type type; | |
| 80 } m_id; | |
| 81 }; | |
| 82 | |
| 83 typedef Vector<OwnPtr<DisplayItem> > PaintList; | |
| 84 | |
| 85 class ViewDisplayList { | |
| 86 public: | |
| 87 ViewDisplayList() { }; | |
| 88 | |
| 89 const PaintList& paintList(); | |
| 90 void add(WTF::PassOwnPtr<DisplayItem>); | |
| 91 void invalidate(const RenderObject*); | |
| 92 | |
| 93 #ifndef NDEBUG | |
| 94 void showDebugData() const; | |
| 95 #endif | |
| 96 | |
| 97 private: | |
| 98 PaintList::iterator findDisplayItem(PaintList::iterator, const DisplayItem&)
; | |
| 99 bool wasInvalidated(const DisplayItem&) const; | |
| 100 void updatePaintList(); | |
| 101 | |
| 102 PaintList m_paintList; | |
| 103 HashSet<const RenderObject*> m_paintListRenderers; | |
| 104 HashSet<const RenderObject*> m_invalidated; | |
| 105 PaintList m_newPaints; | |
| 106 }; | |
| 107 | |
| 108 } // namespace blink | |
| 109 | |
| 110 #endif // ViewDisplayList_h | |
| OLD | NEW |