OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 24 matching lines...) Expand all Loading... |
35 * version of this file only under the terms of one of those two | 35 * version of this file only under the terms of one of those two |
36 * licenses (the MPL or the GPL) and not to allow others to use your | 36 * licenses (the MPL or the GPL) and not to allow others to use your |
37 * version of this file under the LGPL, indicate your decision by | 37 * version of this file under the LGPL, indicate your decision by |
38 * deletingthe provisions above and replace them with the notice and | 38 * deletingthe provisions above and replace them with the notice and |
39 * other provisions required by the MPL or the GPL, as the case may be. | 39 * other provisions required by the MPL or the GPL, as the case may be. |
40 * If you do not delete the provisions above, a recipient may use your | 40 * If you do not delete the provisions above, a recipient may use your |
41 * version of this file under any of the LGPL, the MPL or the GPL. | 41 * version of this file under any of the LGPL, the MPL or the GPL. |
42 */ | 42 */ |
43 | 43 |
44 #include "config.h" | 44 #include "config.h" |
45 #include "core/rendering/RenderLayerReflectionInfo.h" | 45 #include "core/layout/LayerReflectionInfo.h" |
46 | 46 |
47 #include "core/frame/UseCounter.h" | 47 #include "core/frame/UseCounter.h" |
| 48 #include "core/layout/Layer.h" |
48 #include "core/paint/LayerPainter.h" | 49 #include "core/paint/LayerPainter.h" |
49 #include "core/rendering/RenderLayer.h" | |
50 #include "core/rendering/RenderReplica.h" | 50 #include "core/rendering/RenderReplica.h" |
51 #include "core/rendering/style/RenderStyle.h" | 51 #include "core/rendering/style/RenderStyle.h" |
52 #include "platform/transforms/ScaleTransformOperation.h" | 52 #include "platform/transforms/ScaleTransformOperation.h" |
53 #include "platform/transforms/TranslateTransformOperation.h" | 53 #include "platform/transforms/TranslateTransformOperation.h" |
54 | 54 |
55 #include "wtf/RefPtr.h" | 55 #include "wtf/RefPtr.h" |
56 | 56 |
57 namespace blink { | 57 namespace blink { |
58 | 58 |
59 RenderLayerReflectionInfo::RenderLayerReflectionInfo(RenderBox& renderer) | 59 LayerReflectionInfo::LayerReflectionInfo(RenderBox& renderer) |
60 : m_box(&renderer) | 60 : m_box(&renderer) |
61 , m_isPaintingInsideReflection(false) | 61 , m_isPaintingInsideReflection(false) |
62 { | 62 { |
63 UseCounter::count(box().document(), UseCounter::Reflection); | 63 UseCounter::count(box().document(), UseCounter::Reflection); |
64 | 64 |
65 m_reflection = RenderReplica::createAnonymous(&box().document()); | 65 m_reflection = RenderReplica::createAnonymous(&box().document()); |
66 m_reflection->setParent(m_box); // We create a 1-way connection. | 66 m_reflection->setParent(m_box); // We create a 1-way connection. |
67 } | 67 } |
68 | 68 |
69 void RenderLayerReflectionInfo::destroy() | 69 void LayerReflectionInfo::destroy() |
70 { | 70 { |
71 if (!m_reflection->documentBeingDestroyed()) | 71 if (!m_reflection->documentBeingDestroyed()) |
72 m_reflection->removeLayers(box().layer()); | 72 m_reflection->removeLayers(box().layer()); |
73 | 73 |
74 m_reflection->setParent(0); | 74 m_reflection->setParent(0); |
75 m_reflection->destroy(); | 75 m_reflection->destroy(); |
76 m_reflection = nullptr; | 76 m_reflection = nullptr; |
77 } | 77 } |
78 | 78 |
79 RenderLayer* RenderLayerReflectionInfo::reflectionLayer() const | 79 Layer* LayerReflectionInfo::reflectionLayer() const |
80 { | 80 { |
81 return m_reflection->layer(); | 81 return m_reflection->layer(); |
82 } | 82 } |
83 | 83 |
84 void RenderLayerReflectionInfo::updateAfterStyleChange(const RenderStyle* oldSty
le) | 84 void LayerReflectionInfo::updateAfterStyleChange(const RenderStyle* oldStyle) |
85 { | 85 { |
86 RefPtr<RenderStyle> newStyle = RenderStyle::create(); | 86 RefPtr<RenderStyle> newStyle = RenderStyle::create(); |
87 newStyle->inheritFrom(box().style()); | 87 newStyle->inheritFrom(box().style()); |
88 | 88 |
89 // Map in our transform. | 89 // Map in our transform. |
90 TransformOperations transform; | 90 TransformOperations transform; |
91 switch (box().style()->boxReflect()->direction()) { | 91 switch (box().style()->boxReflect()->direction()) { |
92 case ReflectionBelow: | 92 case ReflectionBelow: |
93 transform.operations().append(TranslateTransformOperation::create(Length
(0, Fixed), | 93 transform.operations().append(TranslateTransformOperation::create(Length
(0, Fixed), |
94 Length(100., Percent), TransformOperation::Translate)); | 94 Length(100., Percent), TransformOperation::Translate)); |
(...skipping 27 matching lines...) Expand all Loading... |
122 break; | 122 break; |
123 } | 123 } |
124 newStyle->setTransform(transform); | 124 newStyle->setTransform(transform); |
125 | 125 |
126 // Map in our mask. | 126 // Map in our mask. |
127 newStyle->setMaskBoxImage(box().style()->boxReflect()->mask()); | 127 newStyle->setMaskBoxImage(box().style()->boxReflect()->mask()); |
128 | 128 |
129 m_reflection->setStyle(newStyle.release()); | 129 m_reflection->setStyle(newStyle.release()); |
130 } | 130 } |
131 | 131 |
132 void RenderLayerReflectionInfo::paint(GraphicsContext* context, const LayerPaint
ingInfo& paintingInfo, PaintLayerFlags flags) | 132 void LayerReflectionInfo::paint(GraphicsContext* context, const LayerPaintingInf
o& paintingInfo, PaintLayerFlags flags) |
133 { | 133 { |
134 if (m_isPaintingInsideReflection) | 134 if (m_isPaintingInsideReflection) |
135 return; | 135 return; |
136 | 136 |
137 // Mark that we are now inside replica painting. | 137 // Mark that we are now inside replica painting. |
138 m_isPaintingInsideReflection = true; | 138 m_isPaintingInsideReflection = true; |
139 LayerPainter(*reflectionLayer()).paintLayer(context, paintingInfo, flags); | 139 LayerPainter(*reflectionLayer()).paintLayer(context, paintingInfo, flags); |
140 m_isPaintingInsideReflection = false; | 140 m_isPaintingInsideReflection = false; |
141 } | 141 } |
142 | 142 |
143 } // namespace blink | 143 } // namespace blink |
OLD | NEW |