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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 void addOverflowFromChild(LayoutBox* child) { | 484 void addOverflowFromChild(LayoutBox* child) { |
485 addOverflowFromChild(child, child->locationOffset()); | 485 addOverflowFromChild(child, child->locationOffset()); |
486 } | 486 } |
487 void addOverflowFromChild(LayoutBox* child, const LayoutSize& delta); | 487 void addOverflowFromChild(LayoutBox* child, const LayoutSize& delta); |
488 void clearLayoutOverflow(); | 488 void clearLayoutOverflow(); |
489 void clearAllOverflows() { m_overflow.reset(); } | 489 void clearAllOverflows() { m_overflow.reset(); } |
490 | 490 |
491 void updateLayerTransformAfterLayout(); | 491 void updateLayerTransformAfterLayout(); |
492 | 492 |
493 DISABLE_CFI_PERF LayoutUnit contentWidth() const { | 493 DISABLE_CFI_PERF LayoutUnit contentWidth() const { |
494 return clientWidth() - paddingLeft() - paddingRight(); | 494 // We're dealing with LayoutUnit and saturated arithmetic here, so we need |
| 495 // to guard against negative results. The value returned from clientWidth() |
| 496 // may in itself be a victim of saturated arithmetic; e.g. if both border |
| 497 // sides were sufficiently wide (close to LayoutUnit::max()). Here we |
| 498 // subtract two padding values from that result, which is another source of |
| 499 // saturated arithmetic. |
| 500 return (clientWidth() - paddingLeft() - paddingRight()) |
| 501 .clampNegativeToZero(); |
495 } | 502 } |
496 DISABLE_CFI_PERF LayoutUnit contentHeight() const { | 503 DISABLE_CFI_PERF LayoutUnit contentHeight() const { |
497 return clientHeight() - paddingTop() - paddingBottom(); | 504 // We're dealing with LayoutUnit and saturated arithmetic here, so we need |
| 505 // to guard against negative results. The value returned from clientHeight() |
| 506 // may in itself be a victim of saturated arithmetic; e.g. if both border |
| 507 // sides were sufficiently wide (close to LayoutUnit::max()). Here we |
| 508 // subtract two padding values from that result, which is another source of |
| 509 // saturated arithmetic. |
| 510 return (clientHeight() - paddingTop() - paddingBottom()) |
| 511 .clampNegativeToZero(); |
498 } | 512 } |
499 LayoutSize contentSize() const { | 513 LayoutSize contentSize() const { |
500 return LayoutSize(contentWidth(), contentHeight()); | 514 return LayoutSize(contentWidth(), contentHeight()); |
501 } | 515 } |
502 LayoutUnit contentLogicalWidth() const { | 516 LayoutUnit contentLogicalWidth() const { |
503 return style()->isHorizontalWritingMode() ? contentWidth() | 517 return style()->isHorizontalWritingMode() ? contentWidth() |
504 : contentHeight(); | 518 : contentHeight(); |
505 } | 519 } |
506 LayoutUnit contentLogicalHeight() const { | 520 LayoutUnit contentLogicalHeight() const { |
507 return style()->isHorizontalWritingMode() ? contentHeight() | 521 return style()->isHorizontalWritingMode() ? contentHeight() |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 breakValue == EBreakBetween::kLeft || | 1667 breakValue == EBreakBetween::kLeft || |
1654 breakValue == EBreakBetween::kPage || | 1668 breakValue == EBreakBetween::kPage || |
1655 breakValue == EBreakBetween::kRecto || | 1669 breakValue == EBreakBetween::kRecto || |
1656 breakValue == EBreakBetween::kRight || | 1670 breakValue == EBreakBetween::kRight || |
1657 breakValue == EBreakBetween::kVerso; | 1671 breakValue == EBreakBetween::kVerso; |
1658 } | 1672 } |
1659 | 1673 |
1660 } // namespace blink | 1674 } // namespace blink |
1661 | 1675 |
1662 #endif // LayoutBox_h | 1676 #endif // LayoutBox_h |
OLD | NEW |