Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.h

Issue 2707073002: Move PreviousBoxGeometries from BoxPaintInvalidator into LayoutBox::m_rareData (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698