OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return LayoutUnit::fromFloatFloor(totalWidth) <= | 56 return LayoutUnit::fromFloatFloor(totalWidth) <= |
57 m_availableWidth + LayoutUnit::epsilon(); | 57 m_availableWidth + LayoutUnit::epsilon(); |
58 } | 58 } |
59 bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const { | 59 bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const { |
60 LayoutUnit w = LayoutUnit::fromFloatFloor(currentWidth() + extra); | 60 LayoutUnit w = LayoutUnit::fromFloatFloor(currentWidth() + extra); |
61 if (whitespaceTreatment == ExcludeWhitespace) | 61 if (whitespaceTreatment == ExcludeWhitespace) |
62 w -= LayoutUnit::fromFloatCeil(trailingWhitespaceWidth()); | 62 w -= LayoutUnit::fromFloatCeil(trailingWhitespaceWidth()); |
63 return w <= m_availableWidth; | 63 return w <= m_availableWidth; |
64 } | 64 } |
65 | 65 |
66 // Note that m_uncommittedWidth may not be LayoutUnit-snapped at this point.
Because | 66 // Note that m_uncommittedWidth may not be LayoutUnit-snapped at this point. |
67 // currentWidth() is used by the code that lays out words in a single LayoutTe
xt, it's | 67 // Because currentWidth() is used by the code that lays out words in a single |
68 // expected that offsets will not be snapped until an InlineBox boundary is re
ached. | 68 // LayoutText, it's expected that offsets will not be snapped until an |
| 69 // InlineBox boundary is reached. |
69 float currentWidth() const { return m_committedWidth + m_uncommittedWidth; } | 70 float currentWidth() const { return m_committedWidth + m_uncommittedWidth; } |
70 | 71 |
71 // FIXME: We should eventually replace these three functions by ones that work
on a higher abstraction. | 72 // FIXME: We should eventually replace these three functions by ones that work |
| 73 // on a higher abstraction. |
72 float uncommittedWidth() const { return m_uncommittedWidth; } | 74 float uncommittedWidth() const { return m_uncommittedWidth; } |
73 float committedWidth() const { return m_committedWidth; } | 75 float committedWidth() const { return m_committedWidth; } |
74 float availableWidth() const { return m_availableWidth; } | 76 float availableWidth() const { return m_availableWidth; } |
75 float trailingWhitespaceWidth() const { return m_trailingWhitespaceWidth; } | 77 float trailingWhitespaceWidth() const { return m_trailingWhitespaceWidth; } |
76 | 78 |
77 void updateAvailableWidth(LayoutUnit minimumHeight = LayoutUnit()); | 79 void updateAvailableWidth(LayoutUnit minimumHeight = LayoutUnit()); |
78 void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&); | 80 void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&); |
79 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } | 81 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } |
80 void commit(); | 82 void commit(); |
81 void applyOverhang(LineLayoutRubyRun, | 83 void applyOverhang(LineLayoutRubyRun, |
(...skipping 14 matching lines...) Expand all Loading... |
96 void computeAvailableWidthFromLeftAndRight(); | 98 void computeAvailableWidthFromLeftAndRight(); |
97 void updateLineDimension(LayoutUnit newLineTop, | 99 void updateLineDimension(LayoutUnit newLineTop, |
98 LayoutUnit newLineWidth, | 100 LayoutUnit newLineWidth, |
99 const LayoutUnit& newLineLeft, | 101 const LayoutUnit& newLineLeft, |
100 const LayoutUnit& newLineRight); | 102 const LayoutUnit& newLineRight); |
101 void wrapNextToShapeOutside(bool isFirstLine); | 103 void wrapNextToShapeOutside(bool isFirstLine); |
102 | 104 |
103 LineLayoutBlockFlow m_block; | 105 LineLayoutBlockFlow m_block; |
104 float m_uncommittedWidth; | 106 float m_uncommittedWidth; |
105 float m_committedWidth; | 107 float m_committedWidth; |
106 float | 108 // The amount by which |m_availableWidth| has been inflated to account for |
107 m_overhangWidth; // The amount by which |m_availableWidth| has been infla
ted to account for possible contraction due to ruby overhang. | 109 // possible contraction due to ruby overhang. |
| 110 float m_overhangWidth; |
108 float m_trailingWhitespaceWidth; | 111 float m_trailingWhitespaceWidth; |
109 LayoutUnit m_left; | 112 LayoutUnit m_left; |
110 LayoutUnit m_right; | 113 LayoutUnit m_right; |
111 LayoutUnit m_availableWidth; | 114 LayoutUnit m_availableWidth; |
112 bool m_isFirstLine; | 115 bool m_isFirstLine; |
113 IndentTextOrNot m_indentText; | 116 IndentTextOrNot m_indentText; |
114 }; | 117 }; |
115 | 118 |
116 } // namespace blink | 119 } // namespace blink |
117 | 120 |
118 #endif // LineWidth_h | 121 #endif // LineWidth_h |
OLD | NEW |