OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 { | 87 { |
88 ASSERT(block); | 88 ASSERT(block); |
89 #if ENABLE(CSS_EXCLUSIONS) | 89 #if ENABLE(CSS_EXCLUSIONS) |
90 ExclusionShapeInsideInfo* exclusionShapeInsideInfo = layoutExclusionShap
eInsideInfo(m_block); | 90 ExclusionShapeInsideInfo* exclusionShapeInsideInfo = layoutExclusionShap
eInsideInfo(m_block); |
91 // FIXME: Bug 91878: Add support for multiple segments, currently we onl
y support one | 91 // FIXME: Bug 91878: Add support for multiple segments, currently we onl
y support one |
92 if (exclusionShapeInsideInfo && exclusionShapeInsideInfo->hasSegments()) | 92 if (exclusionShapeInsideInfo && exclusionShapeInsideInfo->hasSegments()) |
93 m_segment = &exclusionShapeInsideInfo->segments()[0]; | 93 m_segment = &exclusionShapeInsideInfo->segments()[0]; |
94 #endif | 94 #endif |
95 updateAvailableWidth(); | 95 updateAvailableWidth(); |
96 } | 96 } |
97 #if ENABLE(SUBPIXEL_LAYOUT) | |
98 bool fitsOnLine() const { return currentWidth() <= m_availableWidth; } | 97 bool fitsOnLine() const { return currentWidth() <= m_availableWidth; } |
99 bool fitsOnLine(float extra) const { return currentWidth() + extra <= m_avai
lableWidth; } | 98 bool fitsOnLine(float extra) const { return currentWidth() + extra <= m_avai
lableWidth; } |
100 #else | |
101 bool fitsOnLine() const { return currentWidth() <= m_availableWidth; } | |
102 bool fitsOnLine(float extra) const { return currentWidth() + extra <= m_avai
lableWidth; } | |
103 #endif | |
104 float currentWidth() const { return m_committedWidth + m_uncommittedWidth; } | 99 float currentWidth() const { return m_committedWidth + m_uncommittedWidth; } |
105 | 100 |
106 // FIXME: We should eventually replace these three functions by ones that wo
rk on a higher abstraction. | 101 // FIXME: We should eventually replace these three functions by ones that wo
rk on a higher abstraction. |
107 float uncommittedWidth() const { return m_uncommittedWidth; } | 102 float uncommittedWidth() const { return m_uncommittedWidth; } |
108 float committedWidth() const { return m_committedWidth; } | 103 float committedWidth() const { return m_committedWidth; } |
109 float availableWidth() const { return m_availableWidth; } | 104 float availableWidth() const { return m_availableWidth; } |
110 | 105 |
111 void updateAvailableWidth(); | 106 void updateAvailableWidth(); |
112 void shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::FloatingObject*); | 107 void shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::FloatingObject*); |
113 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } | 108 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 computeAvailableWidthFromLeftAndRight(); | 165 computeAvailableWidthFromLeftAndRight(); |
171 } | 166 } |
172 | 167 |
173 inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa
tingObject* newFloat) | 168 inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa
tingObject* newFloat) |
174 { | 169 { |
175 LayoutUnit height = m_block->logicalHeight(); | 170 LayoutUnit height = m_block->logicalHeight(); |
176 if (height < m_block->logicalTopForFloat(newFloat) || height >= m_block->log
icalBottomForFloat(newFloat)) | 171 if (height < m_block->logicalTopForFloat(newFloat) || height >= m_block->log
icalBottomForFloat(newFloat)) |
177 return; | 172 return; |
178 | 173 |
179 if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { | 174 if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { |
180 float newLeft = m_block->pixelSnappedLogicalRightForFloat(newFloat); | 175 float newLeft = m_block->logicalRightForFloat(newFloat); |
181 if (m_isFirstLine && m_block->style()->isLeftToRightDirection()) | 176 if (m_isFirstLine && m_block->style()->isLeftToRightDirection()) |
182 newLeft += floorToInt(m_block->textIndentOffset()); | 177 newLeft += floorToInt(m_block->textIndentOffset()); |
183 m_left = max<float>(m_left, newLeft); | 178 m_left = max<float>(m_left, newLeft); |
184 } else { | 179 } else { |
185 float newRight = m_block->pixelSnappedLogicalLeftForFloat(newFloat); | 180 float newRight = m_block->logicalLeftForFloat(newFloat); |
186 if (m_isFirstLine && !m_block->style()->isLeftToRightDirection()) | 181 if (m_isFirstLine && !m_block->style()->isLeftToRightDirection()) |
187 newRight -= floorToInt(m_block->textIndentOffset()); | 182 newRight -= floorToInt(m_block->textIndentOffset()); |
188 m_right = min<float>(m_right, newRight); | 183 m_right = min<float>(m_right, newRight); |
189 } | 184 } |
190 | 185 |
191 computeAvailableWidthFromLeftAndRight(); | 186 computeAvailableWidthFromLeftAndRight(); |
192 } | 187 } |
193 | 188 |
194 void LineWidth::applyOverhang(RenderRubyRun* rubyRun, RenderObject* startRendere
r, RenderObject* endRenderer) | 189 void LineWidth::applyOverhang(RenderRubyRun* rubyRun, RenderObject* startRendere
r, RenderObject* endRenderer) |
195 { | 190 { |
(...skipping 2895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3091 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 3086 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
3092 | 3087 |
3093 setLineGridBox(lineGridBox); | 3088 setLineGridBox(lineGridBox); |
3094 | 3089 |
3095 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 3090 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
3096 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 3091 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
3097 // to this grid. | 3092 // to this grid. |
3098 } | 3093 } |
3099 | 3094 |
3100 } | 3095 } |
OLD | NEW |