Chromium Code Reviews| 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. | |
| 58 // TODO(jchaffraix): This description is not great but I don't know why this | |
|
mstensho (USE GERRIT)
2015/10/13 16:17:45
I think this is just great. Nothing left TODO. :)
Julien - ping for review
2015/10/13 21:36:43
Not going to argue with you :)
I am not happy tha
| |
| 59 // class exists and probably no one does. | |
| 36 class LayoutReplica final : public LayoutBox { | 60 class LayoutReplica final : public LayoutBox { |
| 37 public: | 61 public: |
| 38 static LayoutReplica* createAnonymous(Document*); | 62 static LayoutReplica* createAnonymous(Document*); |
| 39 ~LayoutReplica() override; | 63 ~LayoutReplica() override; |
| 40 | 64 |
| 41 const char* name() const override { return "LayoutReplica"; } | 65 const char* name() const override { return "LayoutReplica"; } |
| 42 | 66 |
| 43 PaintLayerType layerTypeRequired() const override { return NormalPaintLayer; } | 67 PaintLayerType layerTypeRequired() const override { return NormalPaintLayer; } |
| 44 | 68 |
| 45 void layout() override; | 69 void layout() override; |
| 46 | 70 |
| 47 void paint(const PaintInfo&, const LayoutPoint&) const override; | 71 void paint(const PaintInfo&, const LayoutPoint&) const override; |
| 48 | 72 |
| 49 private: | 73 private: |
| 50 LayoutReplica(); | 74 LayoutReplica(); |
| 51 | 75 |
| 52 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectReplica || LayoutBox::isOfType(type); } | 76 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectReplica || LayoutBox::isOfType(type); } |
| 53 void computePreferredLogicalWidths() override; | 77 void computePreferredLogicalWidths() override; |
| 54 | 78 |
| 55 }; | 79 }; |
| 56 | 80 |
| 57 } // namespace blink | 81 } // namespace blink |
| 58 | 82 |
| 59 #endif // LayoutReplica_h | 83 #endif // LayoutReplica_h |
| OLD | NEW |