OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "core/layout/LayoutBoxModelObject.h" | 48 #include "core/layout/LayoutBoxModelObject.h" |
49 #include "core/paint/PaintLayerPainter.h" | 49 #include "core/paint/PaintLayerPainter.h" |
50 #include "wtf/Allocator.h" | 50 #include "wtf/Allocator.h" |
51 #include "wtf/Noncopyable.h" | 51 #include "wtf/Noncopyable.h" |
52 | 52 |
53 namespace blink { | 53 namespace blink { |
54 | 54 |
55 class PaintLayer; | 55 class PaintLayer; |
56 class LayoutReplica; | 56 class LayoutReplica; |
57 | 57 |
| 58 // PaintLayerReflectionInfo is the main object used for reflections. |
| 59 // https://www.webkit.org/blog/182/css-reflections/ |
| 60 // |
| 61 // All reflection operations are done through this object, which delegates to |
| 62 // LayoutReplica and ReflectionPainter. |
| 63 // |
| 64 // Painting Reflections is handled by painting the same PaintLayer again with |
| 65 // some special paint flags (the most important being |
| 66 // PaintLayerPaintingReflection). See PaintLayerReflectionInfo::paint() and |
| 67 // ReplicaPainter for the entry point into the reflection painting code. |
| 68 // |
| 69 // See LayoutReplica for the peculiar tree structure generated by this design. |
58 class PaintLayerReflectionInfo { | 70 class PaintLayerReflectionInfo { |
59 WTF_MAKE_FAST_ALLOCATED(PaintLayerReflectionInfo); | 71 WTF_MAKE_FAST_ALLOCATED(PaintLayerReflectionInfo); |
60 WTF_MAKE_NONCOPYABLE(PaintLayerReflectionInfo); | 72 WTF_MAKE_NONCOPYABLE(PaintLayerReflectionInfo); |
61 public: | 73 public: |
62 explicit PaintLayerReflectionInfo(LayoutBox&); | 74 explicit PaintLayerReflectionInfo(LayoutBox&); |
63 void destroy(); | 75 void destroy(); |
64 | 76 |
65 LayoutReplica* reflection() const { return m_reflection; } | 77 LayoutReplica* reflection() const { return m_reflection; } |
66 PaintLayer* reflectionLayer() const; | 78 PaintLayer* reflectionLayer() const; |
67 | 79 |
68 bool isPaintingInsideReflection() const { return m_isPaintingInsideReflectio
n; } | 80 bool isPaintingInsideReflection() const { return m_isPaintingInsideReflectio
n; } |
69 | 81 |
70 void updateAfterStyleChange(const ComputedStyle* oldStyle); | 82 void updateAfterStyleChange(const ComputedStyle* oldStyle); |
71 | 83 |
72 void paint(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags)
; | 84 void paint(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags)
; |
73 | 85 |
74 private: | 86 private: |
75 LayoutBox& box() { return *m_box; } | 87 LayoutBox& box() { return *m_box; } |
76 const LayoutBox& box() const { return *m_box; } | 88 const LayoutBox& box() const { return *m_box; } |
77 | 89 |
| 90 // The reflected box, ie the box with -webkit-box-reflect. |
78 LayoutBox* m_box; | 91 LayoutBox* m_box; |
| 92 |
| 93 // The reflection object. |
| 94 // This LayoutObject is owned by PaintLayerReflectinInfo. |
79 LayoutReplica* m_reflection; | 95 LayoutReplica* m_reflection; |
80 | 96 |
81 // A state bit tracking if we are painting inside a replica. | 97 // A state bit tracking if we are painting inside this replica. |
| 98 // This is done to avoid infinite recursion during painting while also |
| 99 // enabling nested reflection. |
82 unsigned m_isPaintingInsideReflection : 1; | 100 unsigned m_isPaintingInsideReflection : 1; |
83 }; | 101 }; |
84 | 102 |
85 } // namespace blink | 103 } // namespace blink |
86 | 104 |
87 #endif // PaintLayerReflectinInfo_h | 105 #endif // PaintLayerReflectinInfo_h |
OLD | NEW |