OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef LayoutReplica_h | 29 #ifndef LayoutReplica_h |
30 #define LayoutReplica_h | 30 #define LayoutReplica_h |
31 | 31 |
32 #include "core/layout/LayoutBox.h" | 32 #include "core/layout/LayoutBox.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
| 36 // LayoutReplica is a synthetic object used to represent reflections. |
| 37 // https://www.webkit.org/blog/182/css-reflections/ |
| 38 // |
| 39 // The object is part of the layout tree, however it is not fully inserted into |
| 40 // it: LayoutReplica::parent() will return the right information but the |
| 41 // parent's children() don't know about the LayoutReplica. |
| 42 // Note that its PaintLayer is fully inserted into the PaintLayer tree, which |
| 43 // requires some special casing in the painting code (e.g. in |
| 44 // PaintLayerStackingNode). |
| 45 // |
| 46 // LayoutReplica's parent() is the object with the -webkit-box-reflect. |
| 47 // LayoutReplica inherits its style from its parent() but also have an extra |
| 48 // 'transform' to paint the reflection correctly. This is done by |
| 49 // PaintLayerReflectionInfo. |
| 50 // |
| 51 // The object is created and managed by PaintLayerReflectionInfo. Also all of |
| 52 // its operations happen through PaintLayerReflectionInfo (e.g. layout, style |
| 53 // updates, ...). |
| 54 // |
| 55 // This class is a big hack. The original intent for it is unclear but has to do |
| 56 // with implementing the correct painting of reflection. It may be to apply a |
| 57 // 'transform' and offset during painting. |
36 class LayoutReplica final : public LayoutBox { | 58 class LayoutReplica final : public LayoutBox { |
37 public: | 59 public: |
38 static LayoutReplica* createAnonymous(Document*); | 60 static LayoutReplica* createAnonymous(Document*); |
39 ~LayoutReplica() override; | 61 ~LayoutReplica() override; |
40 | 62 |
41 const char* name() const override { return "LayoutReplica"; } | 63 const char* name() const override { return "LayoutReplica"; } |
42 | 64 |
43 PaintLayerType layerTypeRequired() const override { return NormalPaintLayer;
} | 65 PaintLayerType layerTypeRequired() const override { return NormalPaintLayer;
} |
44 | 66 |
45 void layout() override; | 67 void layout() override; |
46 | 68 |
47 void paint(const PaintInfo&, const LayoutPoint&) const override; | 69 void paint(const PaintInfo&, const LayoutPoint&) const override; |
48 | 70 |
49 private: | 71 private: |
50 LayoutReplica(); | 72 LayoutReplica(); |
51 | 73 |
52 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectReplica || LayoutBox::isOfType(type); } | 74 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectReplica || LayoutBox::isOfType(type); } |
53 void computePreferredLogicalWidths() override; | 75 void computePreferredLogicalWidths() override; |
54 | 76 |
55 }; | 77 }; |
56 | 78 |
57 } // namespace blink | 79 } // namespace blink |
58 | 80 |
59 #endif // LayoutReplica_h | 81 #endif // LayoutReplica_h |
OLD | NEW |