Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutBox.h |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h |
| index ca26cdbff78eeb24b3482ae0b87951d8a4fbbdd2..70b464a08157adc3e357ee76d20c818b7adcbcee 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.h |
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.h |
| @@ -76,8 +76,10 @@ struct LayoutBoxRareData { |
| LayoutUnit m_overrideLogicalContentWidth; |
| LayoutUnit m_overrideLogicalContentHeight; |
| - bool m_hasOverrideContainingBlockContentLogicalWidth; |
| - bool m_hasOverrideContainingBlockContentLogicalHeight; |
| + bool m_hasOverrideContainingBlockContentLogicalWidth : 1; |
| + bool m_hasOverrideContainingBlockContentLogicalHeight : 1; |
| + bool m_hasPreviousOtherBoxGeometries : 1; |
| + |
| LayoutUnit m_overrideContainingBlockContentLogicalWidth; |
| LayoutUnit m_overrideContainingBlockContentLogicalHeight; |
| @@ -98,6 +100,12 @@ struct LayoutBoxRareData { |
| return *m_snapAreas; |
| } |
| + |
| + // Used by BoxPaintInvalidator. Stores the previous content box size and |
| + // layout overflow rect after the last paint invalidation. |
| + // These are valid if m_hasPreviousOtherBoxGeometries is true. |
| + LayoutSize m_previousContentBoxSize; |
| + LayoutRect m_previousLayoutOverflowRect; |
| }; |
| // LayoutBox implements the full CSS box model. |
| @@ -318,7 +326,6 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject { |
| return LayoutSize(m_frameRect.x(), m_frameRect.y()); |
| } |
| LayoutSize size() const { return m_frameRect.size(); } |
| - LayoutSize previousSize() const { return m_previousSize; } |
| IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); } |
| void setLocation(const LayoutPoint& location) { |
| @@ -1311,19 +1318,41 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject { |
| class MutableForPainting : public LayoutObject::MutableForPainting { |
| public: |
| - void setPreviousSize(const LayoutSize& size) { |
| - static_cast<LayoutBox&>(m_layoutObject).m_previousSize = size; |
| + void savePreviousSize() { layoutBox().m_previousSize = layoutBox().size(); } |
| + void savePreviousOtherBoxGeometries() { |
|
mstensho (USE GERRIT)
2017/02/21 17:51:51
Pretty unusual to inline the rareData setters. Cou
Xianzhu
2017/02/21 18:14:48
Done.
|
| + auto& rareData = layoutBox().ensureRareData(); |
| + rareData.m_hasPreviousOtherBoxGeometries = true; |
| + rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size(); |
| + rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect(); |
| + } |
| + void clearPreviousOtherBoxGeometries() { |
| + if (layoutBox().m_rareData) |
| + layoutBox().m_rareData->m_hasPreviousOtherBoxGeometries = false; |
| } |
| protected: |
| friend class LayoutBox; |
| MutableForPainting(const LayoutBox& box) |
| : LayoutObject::MutableForPainting(box) {} |
| + LayoutBox& layoutBox() { return static_cast<LayoutBox&>(m_layoutObject); } |
| }; |
| + |
| MutableForPainting getMutableForPainting() const { |
| return MutableForPainting(*this); |
| } |
| + LayoutSize previousSize() const { return m_previousSize; } |
| + LayoutSize previousContentBoxSize() const { |
| + return m_rareData && m_rareData->m_hasPreviousOtherBoxGeometries |
| + ? m_rareData->m_previousContentBoxSize |
| + : previousSize(); |
| + } |
| + LayoutRect previousLayoutOverflowRect() const { |
| + return m_rareData && m_rareData->m_hasPreviousOtherBoxGeometries |
| + ? m_rareData->m_previousLayoutOverflowRect |
| + : LayoutRect(LayoutPoint(), previousSize()); |
| + } |
| + |
| protected: |
| virtual LayoutRect controlClipRect(const LayoutPoint&) const { |
| return LayoutRect(); |