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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.h

Issue 2707073002: Move PreviousBoxGeometries from BoxPaintInvalidator into LayoutBox::m_rareData (Closed)
Patch Set: uninline savePreviousOtherBoxGeometries() 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); 58 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData);
59 USING_FAST_MALLOC(LayoutBoxRareData); 59 USING_FAST_MALLOC(LayoutBoxRareData);
60 60
61 public: 61 public:
62 LayoutBoxRareData() 62 LayoutBoxRareData()
63 : m_spannerPlaceholder(nullptr), 63 : m_spannerPlaceholder(nullptr),
64 m_overrideLogicalContentWidth(-1), 64 m_overrideLogicalContentWidth(-1),
65 m_overrideLogicalContentHeight(-1), 65 m_overrideLogicalContentHeight(-1),
66 m_hasOverrideContainingBlockContentLogicalWidth(false), 66 m_hasOverrideContainingBlockContentLogicalWidth(false),
67 m_hasOverrideContainingBlockContentLogicalHeight(false), 67 m_hasOverrideContainingBlockContentLogicalHeight(false),
68 m_hasPreviousOtherBoxGeometries(false),
68 m_percentHeightContainer(nullptr), 69 m_percentHeightContainer(nullptr),
69 m_snapContainer(nullptr), 70 m_snapContainer(nullptr),
70 m_snapAreas(nullptr) {} 71 m_snapAreas(nullptr) {}
71 72
72 // For spanners, the spanner placeholder that lays us out within the multicol 73 // For spanners, the spanner placeholder that lays us out within the multicol
73 // container. 74 // container.
74 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; 75 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder;
75 76
76 LayoutUnit m_overrideLogicalContentWidth; 77 LayoutUnit m_overrideLogicalContentWidth;
77 LayoutUnit m_overrideLogicalContentHeight; 78 LayoutUnit m_overrideLogicalContentHeight;
78 79
79 bool m_hasOverrideContainingBlockContentLogicalWidth; 80 bool m_hasOverrideContainingBlockContentLogicalWidth : 1;
80 bool m_hasOverrideContainingBlockContentLogicalHeight; 81 bool m_hasOverrideContainingBlockContentLogicalHeight : 1;
82 bool m_hasPreviousOtherBoxGeometries : 1;
83
81 LayoutUnit m_overrideContainingBlockContentLogicalWidth; 84 LayoutUnit m_overrideContainingBlockContentLogicalWidth;
82 LayoutUnit m_overrideContainingBlockContentLogicalHeight; 85 LayoutUnit m_overrideContainingBlockContentLogicalHeight;
83 86
84 LayoutUnit m_offsetToNextPage; 87 LayoutUnit m_offsetToNextPage;
85 88
86 LayoutUnit m_paginationStrut; 89 LayoutUnit m_paginationStrut;
87 90
88 LayoutBlock* m_percentHeightContainer; 91 LayoutBlock* m_percentHeightContainer;
89 // For snap area, the owning snap container. 92 // For snap area, the owning snap container.
90 LayoutBox* m_snapContainer; 93 LayoutBox* m_snapContainer;
91 // For snap container, the descendant snap areas that contribute snap 94 // For snap container, the descendant snap areas that contribute snap
92 // points. 95 // points.
93 std::unique_ptr<SnapAreaSet> m_snapAreas; 96 std::unique_ptr<SnapAreaSet> m_snapAreas;
94 97
95 SnapAreaSet& ensureSnapAreas() { 98 SnapAreaSet& ensureSnapAreas() {
96 if (!m_snapAreas) 99 if (!m_snapAreas)
97 m_snapAreas = WTF::wrapUnique(new SnapAreaSet); 100 m_snapAreas = WTF::wrapUnique(new SnapAreaSet);
98 101
99 return *m_snapAreas; 102 return *m_snapAreas;
100 } 103 }
104
105 // Used by BoxPaintInvalidator. Stores the previous content box size and
106 // layout overflow rect after the last paint invalidation.
107 // These are valid if m_hasPreviousOtherBoxGeometries is true.
108 LayoutSize m_previousContentBoxSize;
109 LayoutRect m_previousLayoutOverflowRect;
101 }; 110 };
102 111
103 // LayoutBox implements the full CSS box model. 112 // LayoutBox implements the full CSS box model.
104 // 113 //
105 // LayoutBoxModelObject only introduces some abstractions for LayoutInline and 114 // LayoutBoxModelObject only introduces some abstractions for LayoutInline and
106 // LayoutBox. The logic for the model is in LayoutBox, e.g. the storage for the 115 // LayoutBox. The logic for the model is in LayoutBox, e.g. the storage for the
107 // rectangle and offset forming the CSS box (m_frameRect) and the getters for 116 // rectangle and offset forming the CSS box (m_frameRect) and the getters for
108 // the different boxes. 117 // the different boxes.
109 // 118 //
110 // LayoutBox is also the uppermost class to support scrollbars, however the 119 // LayoutBox is also the uppermost class to support scrollbars, however the
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 setHeight(size); 320 setHeight(size);
312 else 321 else
313 setWidth(size); 322 setWidth(size);
314 } 323 }
315 324
316 LayoutPoint location() const { return m_frameRect.location(); } 325 LayoutPoint location() const { return m_frameRect.location(); }
317 LayoutSize locationOffset() const { 326 LayoutSize locationOffset() const {
318 return LayoutSize(m_frameRect.x(), m_frameRect.y()); 327 return LayoutSize(m_frameRect.x(), m_frameRect.y());
319 } 328 }
320 LayoutSize size() const { return m_frameRect.size(); } 329 LayoutSize size() const { return m_frameRect.size(); }
321 LayoutSize previousSize() const { return m_previousSize; }
322 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); } 330 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); }
323 331
324 void setLocation(const LayoutPoint& location) { 332 void setLocation(const LayoutPoint& location) {
325 if (location == m_frameRect.location()) 333 if (location == m_frameRect.location())
326 return; 334 return;
327 m_frameRect.setLocation(location); 335 m_frameRect.setLocation(location);
328 locationChanged(); 336 locationChanged();
329 } 337 }
330 338
331 // The ancestor box that this object's location and physicalLocation are 339 // The ancestor box that this object's location and physicalLocation are
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 bool intersectsVisibleViewport() const; 1312 bool intersectsVisibleViewport() const;
1305 1313
1306 bool hasNonCompositedScrollbars() const final; 1314 bool hasNonCompositedScrollbars() const final;
1307 1315
1308 void ensureIsReadyForPaintInvalidation() override; 1316 void ensureIsReadyForPaintInvalidation() override;
1309 1317
1310 virtual bool hasControlClip() const { return false; } 1318 virtual bool hasControlClip() const { return false; }
1311 1319
1312 class MutableForPainting : public LayoutObject::MutableForPainting { 1320 class MutableForPainting : public LayoutObject::MutableForPainting {
1313 public: 1321 public:
1314 void setPreviousSize(const LayoutSize& size) { 1322 void savePreviousSize() { layoutBox().m_previousSize = layoutBox().size(); }
1315 static_cast<LayoutBox&>(m_layoutObject).m_previousSize = size; 1323 void savePreviousOtherBoxGeometries() {
1324 layoutBox().savePreviousOtherBoxGeometries();
1325 }
1326 void clearPreviousOtherBoxGeometries() {
1327 if (layoutBox().m_rareData)
1328 layoutBox().m_rareData->m_hasPreviousOtherBoxGeometries = false;
1316 } 1329 }
1317 1330
1318 protected: 1331 protected:
1319 friend class LayoutBox; 1332 friend class LayoutBox;
1320 MutableForPainting(const LayoutBox& box) 1333 MutableForPainting(const LayoutBox& box)
1321 : LayoutObject::MutableForPainting(box) {} 1334 : LayoutObject::MutableForPainting(box) {}
1335 LayoutBox& layoutBox() { return static_cast<LayoutBox&>(m_layoutObject); }
1322 }; 1336 };
1337
1323 MutableForPainting getMutableForPainting() const { 1338 MutableForPainting getMutableForPainting() const {
1324 return MutableForPainting(*this); 1339 return MutableForPainting(*this);
1325 } 1340 }
1326 1341
1342 LayoutSize previousSize() const { return m_previousSize; }
1343 LayoutSize previousContentBoxSize() const {
1344 return m_rareData && m_rareData->m_hasPreviousOtherBoxGeometries
1345 ? m_rareData->m_previousContentBoxSize
1346 : previousSize();
1347 }
1348 LayoutRect previousLayoutOverflowRect() const {
1349 return m_rareData && m_rareData->m_hasPreviousOtherBoxGeometries
1350 ? m_rareData->m_previousLayoutOverflowRect
1351 : LayoutRect(LayoutPoint(), previousSize());
1352 }
1353
1327 protected: 1354 protected:
1328 virtual LayoutRect controlClipRect(const LayoutPoint&) const { 1355 virtual LayoutRect controlClipRect(const LayoutPoint&) const {
1329 return LayoutRect(); 1356 return LayoutRect();
1330 } 1357 }
1331 1358
1332 void willBeDestroyed() override; 1359 void willBeDestroyed() override;
1333 1360
1334 void insertedIntoTree() override; 1361 void insertedIntoTree() override;
1335 void willBeRemovedFromTree() override; 1362 void willBeRemovedFromTree() override;
1336 1363
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 const LayoutObject& container, 1556 const LayoutObject& container,
1530 const LayoutBoxModelObject* ancestorToStopAt) const; 1557 const LayoutBoxModelObject* ancestorToStopAt) const;
1531 1558
1532 LayoutRectOutsets m_marginBoxOutsets; 1559 LayoutRectOutsets m_marginBoxOutsets;
1533 1560
1534 void addSnapArea(const LayoutBox&); 1561 void addSnapArea(const LayoutBox&);
1535 void removeSnapArea(const LayoutBox&); 1562 void removeSnapArea(const LayoutBox&);
1536 1563
1537 LayoutRect debugRect() const override; 1564 LayoutRect debugRect() const override;
1538 1565
1566 void savePreviousOtherBoxGeometries();
mstensho (USE GERRIT) 2017/02/21 20:16:51 Wouldn't it be better to keep this logic in Mutabl
Xianzhu 2017/02/21 20:31:35 The getters are not in MutableForPainting. They ar
mstensho (USE GERRIT) 2017/02/21 21:13:09 Yikes! I really though I had got used to the enfor
1567
1539 // The CSS border box rect for this box. 1568 // The CSS border box rect for this box.
1540 // 1569 //
1541 // The rectangle is in this box's physical coordinates but with a 1570 // The rectangle is in this box's physical coordinates but with a
1542 // flipped block-flow direction (see the COORDINATE SYSTEMS section 1571 // flipped block-flow direction (see the COORDINATE SYSTEMS section
1543 // in LayoutBoxModelObject). The location is the distance from this 1572 // in LayoutBoxModelObject). The location is the distance from this
1544 // object's border edge to the container's border edge (which is not 1573 // object's border edge to the container's border edge (which is not
1545 // always the parent). Thus it includes any logical top/left along 1574 // always the parent). Thus it includes any logical top/left along
1546 // with this box's margins. 1575 // with this box's margins.
1547 LayoutRect m_frameRect; 1576 LayoutRect m_frameRect;
1548 1577
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 breakValue == EBreakBetween::kLeft || 1682 breakValue == EBreakBetween::kLeft ||
1654 breakValue == EBreakBetween::kPage || 1683 breakValue == EBreakBetween::kPage ||
1655 breakValue == EBreakBetween::kRecto || 1684 breakValue == EBreakBetween::kRecto ||
1656 breakValue == EBreakBetween::kRight || 1685 breakValue == EBreakBetween::kRight ||
1657 breakValue == EBreakBetween::kVerso; 1686 breakValue == EBreakBetween::kVerso;
1658 } 1687 }
1659 1688
1660 } // namespace blink 1689 } // namespace blink
1661 1690
1662 #endif // LayoutBox_h 1691 #endif // LayoutBox_h
OLDNEW
« 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