OLD | NEW |
---|---|
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 m_snapContainer(nullptr), | 69 m_snapContainer(nullptr), |
70 m_snapAreas(nullptr) {} | 70 m_snapAreas(nullptr) {} |
71 | 71 |
72 // For spanners, the spanner placeholder that lays us out within the multicol | 72 // For spanners, the spanner placeholder that lays us out within the multicol |
73 // container. | 73 // container. |
74 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; | 74 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; |
75 | 75 |
76 LayoutUnit m_overrideLogicalContentWidth; | 76 LayoutUnit m_overrideLogicalContentWidth; |
77 LayoutUnit m_overrideLogicalContentHeight; | 77 LayoutUnit m_overrideLogicalContentHeight; |
78 | 78 |
79 bool m_hasOverrideContainingBlockContentLogicalWidth; | 79 bool m_hasOverrideContainingBlockContentLogicalWidth : 1; |
80 bool m_hasOverrideContainingBlockContentLogicalHeight; | 80 bool m_hasOverrideContainingBlockContentLogicalHeight : 1; |
81 bool m_hasPreviousOtherBoxGeometries : 1; | |
82 | |
81 LayoutUnit m_overrideContainingBlockContentLogicalWidth; | 83 LayoutUnit m_overrideContainingBlockContentLogicalWidth; |
82 LayoutUnit m_overrideContainingBlockContentLogicalHeight; | 84 LayoutUnit m_overrideContainingBlockContentLogicalHeight; |
83 | 85 |
84 LayoutUnit m_offsetToNextPage; | 86 LayoutUnit m_offsetToNextPage; |
85 | 87 |
86 LayoutUnit m_paginationStrut; | 88 LayoutUnit m_paginationStrut; |
87 | 89 |
88 LayoutBlock* m_percentHeightContainer; | 90 LayoutBlock* m_percentHeightContainer; |
89 // For snap area, the owning snap container. | 91 // For snap area, the owning snap container. |
90 LayoutBox* m_snapContainer; | 92 LayoutBox* m_snapContainer; |
91 // For snap container, the descendant snap areas that contribute snap | 93 // For snap container, the descendant snap areas that contribute snap |
92 // points. | 94 // points. |
93 std::unique_ptr<SnapAreaSet> m_snapAreas; | 95 std::unique_ptr<SnapAreaSet> m_snapAreas; |
94 | 96 |
95 SnapAreaSet& ensureSnapAreas() { | 97 SnapAreaSet& ensureSnapAreas() { |
96 if (!m_snapAreas) | 98 if (!m_snapAreas) |
97 m_snapAreas = WTF::wrapUnique(new SnapAreaSet); | 99 m_snapAreas = WTF::wrapUnique(new SnapAreaSet); |
98 | 100 |
99 return *m_snapAreas; | 101 return *m_snapAreas; |
100 } | 102 } |
103 | |
104 // Used by BoxPaintInvalidator. Stores the previous content box size and | |
105 // layout overflow rect after the last paint invalidation. | |
106 // These are valid if m_hasPreviousOtherBoxGeometries is true. | |
107 LayoutSize m_previousContentBoxSize; | |
108 LayoutRect m_previousLayoutOverflowRect; | |
101 }; | 109 }; |
102 | 110 |
103 // LayoutBox implements the full CSS box model. | 111 // LayoutBox implements the full CSS box model. |
104 // | 112 // |
105 // LayoutBoxModelObject only introduces some abstractions for LayoutInline and | 113 // LayoutBoxModelObject only introduces some abstractions for LayoutInline and |
106 // LayoutBox. The logic for the model is in LayoutBox, e.g. the storage for the | 114 // 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 | 115 // rectangle and offset forming the CSS box (m_frameRect) and the getters for |
108 // the different boxes. | 116 // the different boxes. |
109 // | 117 // |
110 // LayoutBox is also the uppermost class to support scrollbars, however the | 118 // LayoutBox is also the uppermost class to support scrollbars, however the |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 setHeight(size); | 319 setHeight(size); |
312 else | 320 else |
313 setWidth(size); | 321 setWidth(size); |
314 } | 322 } |
315 | 323 |
316 LayoutPoint location() const { return m_frameRect.location(); } | 324 LayoutPoint location() const { return m_frameRect.location(); } |
317 LayoutSize locationOffset() const { | 325 LayoutSize locationOffset() const { |
318 return LayoutSize(m_frameRect.x(), m_frameRect.y()); | 326 return LayoutSize(m_frameRect.x(), m_frameRect.y()); |
319 } | 327 } |
320 LayoutSize size() const { return m_frameRect.size(); } | 328 LayoutSize size() const { return m_frameRect.size(); } |
321 LayoutSize previousSize() const { return m_previousSize; } | |
322 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); } | 329 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); } |
323 | 330 |
324 void setLocation(const LayoutPoint& location) { | 331 void setLocation(const LayoutPoint& location) { |
325 if (location == m_frameRect.location()) | 332 if (location == m_frameRect.location()) |
326 return; | 333 return; |
327 m_frameRect.setLocation(location); | 334 m_frameRect.setLocation(location); |
328 locationChanged(); | 335 locationChanged(); |
329 } | 336 } |
330 | 337 |
331 // The ancestor box that this object's location and physicalLocation are | 338 // The ancestor box that this object's location and physicalLocation are |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1304 bool intersectsVisibleViewport() const; | 1311 bool intersectsVisibleViewport() const; |
1305 | 1312 |
1306 bool hasNonCompositedScrollbars() const final; | 1313 bool hasNonCompositedScrollbars() const final; |
1307 | 1314 |
1308 void ensureIsReadyForPaintInvalidation() override; | 1315 void ensureIsReadyForPaintInvalidation() override; |
1309 | 1316 |
1310 virtual bool hasControlClip() const { return false; } | 1317 virtual bool hasControlClip() const { return false; } |
1311 | 1318 |
1312 class MutableForPainting : public LayoutObject::MutableForPainting { | 1319 class MutableForPainting : public LayoutObject::MutableForPainting { |
1313 public: | 1320 public: |
1314 void setPreviousSize(const LayoutSize& size) { | 1321 void savePreviousSize() { layoutBox().m_previousSize = layoutBox().size(); } |
1315 static_cast<LayoutBox&>(m_layoutObject).m_previousSize = size; | 1322 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.
| |
1323 auto& rareData = layoutBox().ensureRareData(); | |
1324 rareData.m_hasPreviousOtherBoxGeometries = true; | |
1325 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size(); | |
1326 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect(); | |
1327 } | |
1328 void clearPreviousOtherBoxGeometries() { | |
1329 if (layoutBox().m_rareData) | |
1330 layoutBox().m_rareData->m_hasPreviousOtherBoxGeometries = false; | |
1316 } | 1331 } |
1317 | 1332 |
1318 protected: | 1333 protected: |
1319 friend class LayoutBox; | 1334 friend class LayoutBox; |
1320 MutableForPainting(const LayoutBox& box) | 1335 MutableForPainting(const LayoutBox& box) |
1321 : LayoutObject::MutableForPainting(box) {} | 1336 : LayoutObject::MutableForPainting(box) {} |
1337 LayoutBox& layoutBox() { return static_cast<LayoutBox&>(m_layoutObject); } | |
1322 }; | 1338 }; |
1339 | |
1323 MutableForPainting getMutableForPainting() const { | 1340 MutableForPainting getMutableForPainting() const { |
1324 return MutableForPainting(*this); | 1341 return MutableForPainting(*this); |
1325 } | 1342 } |
1326 | 1343 |
1344 LayoutSize previousSize() const { return m_previousSize; } | |
1345 LayoutSize previousContentBoxSize() const { | |
1346 return m_rareData && m_rareData->m_hasPreviousOtherBoxGeometries | |
1347 ? m_rareData->m_previousContentBoxSize | |
1348 : previousSize(); | |
1349 } | |
1350 LayoutRect previousLayoutOverflowRect() const { | |
1351 return m_rareData && m_rareData->m_hasPreviousOtherBoxGeometries | |
1352 ? m_rareData->m_previousLayoutOverflowRect | |
1353 : LayoutRect(LayoutPoint(), previousSize()); | |
1354 } | |
1355 | |
1327 protected: | 1356 protected: |
1328 virtual LayoutRect controlClipRect(const LayoutPoint&) const { | 1357 virtual LayoutRect controlClipRect(const LayoutPoint&) const { |
1329 return LayoutRect(); | 1358 return LayoutRect(); |
1330 } | 1359 } |
1331 | 1360 |
1332 void willBeDestroyed() override; | 1361 void willBeDestroyed() override; |
1333 | 1362 |
1334 void insertedIntoTree() override; | 1363 void insertedIntoTree() override; |
1335 void willBeRemovedFromTree() override; | 1364 void willBeRemovedFromTree() override; |
1336 | 1365 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |