| 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 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class LayoutTable; | 13 class LayoutTable; |
| 14 | 14 |
| 15 // Common super class for LayoutTableCol, LayoutTableSection and LayoutTableRow. | 15 // Common super class for LayoutTableCol, LayoutTableSection and LayoutTableRow. |
| 16 class CORE_EXPORT LayoutTableBoxComponent : public LayoutBox { | 16 class CORE_EXPORT LayoutTableBoxComponent : public LayoutBox { |
| 17 public: | 17 public: |
| 18 bool backgroundChangedSinceLastPaintInvalidation() const { | |
| 19 return m_backgroundChangedSinceLastPaintInvalidation; | |
| 20 } | |
| 21 void clearBackgroundChangedSinceLastPaintInvalidation() { | |
| 22 m_backgroundChangedSinceLastPaintInvalidation = false; | |
| 23 } | |
| 24 static bool doCellsHaveDirtyWidth(const LayoutObject& tablePart, | 18 static bool doCellsHaveDirtyWidth(const LayoutObject& tablePart, |
| 25 const LayoutTable&, | 19 const LayoutTable&, |
| 26 const StyleDifference&, | 20 const StyleDifference&, |
| 27 const ComputedStyle& oldStyle); | 21 const ComputedStyle& oldStyle); |
| 28 | 22 |
| 29 protected: | 23 protected: |
| 30 explicit LayoutTableBoxComponent(Element* element) | 24 explicit LayoutTableBoxComponent(Element* element) : LayoutBox(element) {} |
| 31 : LayoutBox(element), | |
| 32 m_backgroundChangedSinceLastPaintInvalidation(false) {} | |
| 33 | 25 |
| 34 const LayoutObjectChildList* children() const { return &m_children; } | 26 const LayoutObjectChildList* children() const { return &m_children; } |
| 35 LayoutObjectChildList* children() { return &m_children; } | 27 LayoutObjectChildList* children() { return &m_children; } |
| 36 | 28 |
| 37 LayoutObject* firstChild() const { | 29 LayoutObject* firstChild() const { |
| 38 DCHECK(children() == virtualChildren()); | 30 DCHECK(children() == virtualChildren()); |
| 39 return children()->firstChild(); | 31 return children()->firstChild(); |
| 40 } | 32 } |
| 41 LayoutObject* lastChild() const { | 33 LayoutObject* lastChild() const { |
| 42 DCHECK(children() == virtualChildren()); | 34 DCHECK(children() == virtualChildren()); |
| 43 return children()->lastChild(); | 35 return children()->lastChild(); |
| 44 } | 36 } |
| 45 | 37 |
| 46 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; | |
| 47 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override; | |
| 48 | |
| 49 void clearPaintInvalidationFlags() override { | |
| 50 LayoutBox::clearPaintInvalidationFlags(); | |
| 51 m_backgroundChangedSinceLastPaintInvalidation = false; | |
| 52 } | |
| 53 | |
| 54 #if ENABLE(ASSERT) | |
| 55 bool paintInvalidationStateIsDirty() const override { | |
| 56 return m_backgroundChangedSinceLastPaintInvalidation || | |
| 57 LayoutBox::paintInvalidationStateIsDirty(); | |
| 58 } | |
| 59 #endif | |
| 60 | |
| 61 private: | 38 private: |
| 62 // If you have a LayoutTableBoxComponent, use firstChild or lastChild instead. | 39 // If you have a LayoutTableBoxComponent, use firstChild or lastChild instead. |
| 63 void slowFirstChild() const = delete; | 40 void slowFirstChild() const = delete; |
| 64 void slowLastChild() const = delete; | 41 void slowLastChild() const = delete; |
| 65 | 42 |
| 66 LayoutObjectChildList* virtualChildren() override { return children(); } | 43 LayoutObjectChildList* virtualChildren() override { return children(); } |
| 67 const LayoutObjectChildList* virtualChildren() const override { | 44 const LayoutObjectChildList* virtualChildren() const override { |
| 68 return children(); | 45 return children(); |
| 69 } | 46 } |
| 70 | 47 |
| 71 LayoutObjectChildList m_children; | 48 LayoutObjectChildList m_children; |
| 72 bool m_backgroundChangedSinceLastPaintInvalidation; | |
| 73 }; | 49 }; |
| 74 | 50 |
| 75 } // namespace blink | 51 } // namespace blink |
| 76 | 52 |
| 77 #endif // LayoutTableBoxComponent_h | 53 #endif // LayoutTableBoxComponent_h |
| OLD | NEW |