| 79 | | virtual int maxTopMargin(bool positive) const { return positive ? m_maxTopPosMargin : m_maxTopNegMargin; } |
| 80 | | virtual int maxBottomMargin(bool positive) const { return positive ? m_maxBottomPosMargin : m_maxBottomNegMargin; } |
| 81 | | |
| | 79 | virtual int maxTopMargin(bool positive) const { return positive ? maxTopPosMargin() : maxTopNegMargin(); } |
| | 80 | virtual int maxBottomMargin(bool positive) const { return positive ? maxBottomPosMargin() : maxBottomNegMargin(); } |
| | 81 | |
| | 82 | int maxTopPosMargin() const { return m_maxMargin ? m_maxMargin->m_topPos : MaxMargin::topPosDefault(this); } |
| | 83 | int maxTopNegMargin() const { return m_maxMargin ? m_maxMargin->m_topNeg : MaxMargin::topNegDefault(this); } |
| | 84 | int maxBottomPosMargin() const { return m_maxMargin ? m_maxMargin->m_bottomPos : MaxMargin::bottomPosDefault(this); } |
| | 85 | int maxBottomNegMargin() const { return m_maxMargin ? m_maxMargin->m_bottomNeg : MaxMargin::bottomNegDefault(this); } |
| | 86 | void setMaxTopMargins(int pos, int neg); |
| | 87 | void setMaxBottomMargins(int pos, int neg); |
| | 88 | |
| 84 | | int margTop = marginTop(); |
| 85 | | if (margTop >= 0) { |
| 86 | | m_maxTopPosMargin = margTop; |
| 87 | | m_maxTopNegMargin = 0; |
| 88 | | } else { |
| 89 | | m_maxTopNegMargin = -margTop; |
| 90 | | m_maxTopPosMargin = 0; |
| 91 | | } |
| 92 | | int margBottom = marginBottom(); |
| 93 | | if (margBottom >= 0) { |
| 94 | | m_maxBottomPosMargin = margBottom; |
| 95 | | m_maxBottomNegMargin = 0; |
| 96 | | } else { |
| 97 | | m_maxBottomNegMargin = -margBottom; |
| 98 | | m_maxBottomPosMargin = 0; |
| | 91 | if (m_maxMargin) { |
| | 92 | m_maxMargin->m_topPos = MaxMargin::topPosDefault(this); |
| | 93 | m_maxMargin->m_topNeg = MaxMargin::topNegDefault(this); |
| | 94 | m_maxMargin->m_bottomPos = MaxMargin::bottomPosDefault(this); |
| | 95 | m_maxMargin->m_bottomNeg = MaxMargin::bottomNegDefault(this); |
| 439 | | |
| 440 | | bool m_childrenInline : 1; |
| 441 | | bool m_firstLine : 1; |
| 442 | | unsigned m_clearStatus : 2; // EClear |
| 443 | | bool m_topMarginQuirk : 1; |
| 444 | | bool m_bottomMarginQuirk : 1; |
| 445 | | bool m_hasMarkupTruncation : 1; |
| 446 | | unsigned m_selectionState : 3; // SelectionState |
| | 440 | |
| | 441 | // Allocated only when some of these fields have non-default values |
| | 442 | struct MaxMargin { |
| | 443 | MaxMargin(const RenderBlock* o) |
| | 444 | : m_topPos(topPosDefault(o)) |
| | 445 | , m_topNeg(topNegDefault(o)) |
| | 446 | , m_bottomPos(bottomPosDefault(o)) |
| | 447 | , m_bottomNeg(bottomNegDefault(o)) |
| | 448 | { |
| | 449 | } |
| | 450 | static int topPosDefault(const RenderBlock* o) { return o->marginTop() > 0 ? o->marginTop() : 0; } |
| | 451 | static int topNegDefault(const RenderBlock* o) { return o->marginTop() < 0 ? -o->marginTop() : 0; } |
| | 452 | static int bottomPosDefault(const RenderBlock* o) { return o->marginBottom() > 0 ? o->marginBottom() : 0; } |
| | 453 | static int bottomNegDefault(const RenderBlock* o) { return o->marginBottom() < 0 ? -o->marginBottom() : 0; } |
| | 454 | |
| | 455 | int m_topPos; |
| | 456 | int m_topNeg; |
| | 457 | int m_bottomPos; |
| | 458 | int m_bottomNeg; |
| | 459 | }; |
| | 460 | |
| | 461 | MaxMargin* m_maxMargin; |