| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef LayoutTableBoxComponent_h | 5 #ifndef LayoutTableBoxComponent_h |
| 6 #define LayoutTableBoxComponent_h | 6 #define LayoutTableBoxComponent_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
| 10 #include "core/paint/PaintResult.h" |
| 11 #include "platform/graphics/paint/CullRect.h" |
| 10 | 12 |
| 11 namespace blink { | 13 namespace blink { |
| 12 | 14 |
| 13 class LayoutTable; | 15 class LayoutTable; |
| 14 | 16 |
| 15 // Common super class for LayoutTableCol, LayoutTableSection and LayoutTableRow. | 17 // Common super class for LayoutTableCol, LayoutTableSection and LayoutTableRow. |
| 16 class CORE_EXPORT LayoutTableBoxComponent : public LayoutBox { | 18 class CORE_EXPORT LayoutTableBoxComponent : public LayoutBox { |
| 17 public: | 19 public: |
| 18 static bool doCellsHaveDirtyWidth(const LayoutObject& tablePart, | 20 static bool doCellsHaveDirtyWidth(const LayoutObject& tablePart, |
| 19 const LayoutTable&, | 21 const LayoutTable&, |
| 20 const StyleDifference&, | 22 const StyleDifference&, |
| 21 const ComputedStyle& oldStyle); | 23 const ComputedStyle& oldStyle); |
| 22 | 24 |
| 25 class MutableForPainting : public LayoutObject::MutableForPainting { |
| 26 public: |
| 27 void updatePaintResult(PaintResult, const CullRect& paintRect); |
| 28 |
| 29 private: |
| 30 friend class LayoutTableBoxComponent; |
| 31 MutableForPainting(const LayoutTableBoxComponent& box) |
| 32 : LayoutObject::MutableForPainting(box) {} |
| 33 }; |
| 34 MutableForPainting getMutableForPainting() const { |
| 35 return MutableForPainting(*this); |
| 36 } |
| 37 |
| 23 protected: | 38 protected: |
| 24 explicit LayoutTableBoxComponent(Element* element) : LayoutBox(element) {} | 39 explicit LayoutTableBoxComponent(Element* element) |
| 40 : LayoutBox(element), m_lastPaintResult(FullyPainted) {} |
| 25 | 41 |
| 26 const LayoutObjectChildList* children() const { return &m_children; } | 42 const LayoutObjectChildList* children() const { return &m_children; } |
| 27 LayoutObjectChildList* children() { return &m_children; } | 43 LayoutObjectChildList* children() { return &m_children; } |
| 28 | 44 |
| 29 LayoutObject* firstChild() const { | 45 LayoutObject* firstChild() const { |
| 30 DCHECK(children() == virtualChildren()); | 46 DCHECK(children() == virtualChildren()); |
| 31 return children()->firstChild(); | 47 return children()->firstChild(); |
| 32 } | 48 } |
| 33 LayoutObject* lastChild() const { | 49 LayoutObject* lastChild() const { |
| 34 DCHECK(children() == virtualChildren()); | 50 DCHECK(children() == virtualChildren()); |
| 35 return children()->lastChild(); | 51 return children()->lastChild(); |
| 36 } | 52 } |
| 37 | 53 |
| 38 private: | 54 private: |
| 39 // If you have a LayoutTableBoxComponent, use firstChild or lastChild instead. | 55 // If you have a LayoutTableBoxComponent, use firstChild or lastChild instead. |
| 40 void slowFirstChild() const = delete; | 56 void slowFirstChild() const = delete; |
| 41 void slowLastChild() const = delete; | 57 void slowLastChild() const = delete; |
| 42 | 58 |
| 43 LayoutObjectChildList* virtualChildren() override { return children(); } | 59 LayoutObjectChildList* virtualChildren() override { return children(); } |
| 44 const LayoutObjectChildList* virtualChildren() const override { | 60 const LayoutObjectChildList* virtualChildren() const override { |
| 45 return children(); | 61 return children(); |
| 46 } | 62 } |
| 47 | 63 |
| 48 LayoutObjectChildList m_children; | 64 LayoutObjectChildList m_children; |
| 65 |
| 66 friend class MutableForPainting; |
| 67 PaintResult m_lastPaintResult; |
| 68 CullRect m_lastPaintRect; |
| 49 }; | 69 }; |
| 50 | 70 |
| 51 } // namespace blink | 71 } // namespace blink |
| 52 | 72 |
| 53 #endif // LayoutTableBoxComponent_h | 73 #endif // LayoutTableBoxComponent_h |
| OLD | NEW |