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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_hasPreviousContentBoxSizeAndLayoutOverflowRect(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_hasPreviousContentBoxSizeAndLayoutOverflowRect : 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. They are valid if |
| 107 // m_hasPreviousContentBoxSizeAndLayoutOverflowRect 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 Loading... |
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 Loading... |
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 savePreviousContentBoxSizeAndLayoutOverflowRect(); |
| 1324 void clearPreviousContentBoxSizeAndLayoutOverflowRect() { |
| 1325 if (!layoutBox().m_rareData) |
| 1326 return; |
| 1327 layoutBox().m_rareData->m_hasPreviousContentBoxSizeAndLayoutOverflowRect = |
| 1328 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 && |
| 1345 m_rareData->m_hasPreviousContentBoxSizeAndLayoutOverflowRect |
| 1346 ? m_rareData->m_previousContentBoxSize |
| 1347 : previousSize(); |
| 1348 } |
| 1349 LayoutRect previousLayoutOverflowRect() const { |
| 1350 return m_rareData && |
| 1351 m_rareData->m_hasPreviousContentBoxSizeAndLayoutOverflowRect |
| 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 |