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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool fitsOnLine() const { return currentWidth() <= m_availableWidth; } | 105 bool fitsOnLine() const { return currentWidth() <= m_availableWidth; } |
106 bool fitsOnLine(float extra) const { return currentWidth() + extra <= m_avai
lableWidth; } | 106 bool fitsOnLine(float extra) const { return currentWidth() + extra <= m_avai
lableWidth; } |
107 float currentWidth() const { return m_committedWidth + m_uncommittedWidth; } | 107 float currentWidth() const { return m_committedWidth + m_uncommittedWidth; } |
108 | 108 |
109 // FIXME: We should eventually replace these three functions by ones that wo
rk on a higher abstraction. | 109 // FIXME: We should eventually replace these three functions by ones that wo
rk on a higher abstraction. |
110 float uncommittedWidth() const { return m_uncommittedWidth; } | 110 float uncommittedWidth() const { return m_uncommittedWidth; } |
111 float committedWidth() const { return m_committedWidth; } | 111 float committedWidth() const { return m_committedWidth; } |
112 float availableWidth() const { return m_availableWidth; } | 112 float availableWidth() const { return m_availableWidth; } |
113 | 113 |
114 void updateAvailableWidth(LayoutUnit minimumHeight = 0); | 114 void updateAvailableWidth(LayoutUnit minimumHeight = 0); |
115 void shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::FloatingObject*); | 115 void shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject*); |
116 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } | 116 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } |
117 void commit() | 117 void commit() |
118 { | 118 { |
119 m_committedWidth += m_uncommittedWidth; | 119 m_committedWidth += m_uncommittedWidth; |
120 m_uncommittedWidth = 0; | 120 m_uncommittedWidth = 0; |
121 } | 121 } |
122 void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject
* endRenderer); | 122 void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject
* endRenderer); |
123 void fitBelowFloats(); | 123 void fitBelowFloats(); |
124 | 124 |
125 bool shouldIndentText() const { return m_shouldIndentText == IndentText; } | 125 bool shouldIndentText() const { return m_shouldIndentText == IndentText; } |
(...skipping 25 matching lines...) Expand all Loading... |
151 m_right = m_block->logicalRightOffsetForLine(height, shouldIndentText(), log
icalHeight); | 151 m_right = m_block->logicalRightOffsetForLine(height, shouldIndentText(), log
icalHeight); |
152 | 152 |
153 if (m_segment) { | 153 if (m_segment) { |
154 m_left = max<float>(m_segment->logicalLeft, m_left); | 154 m_left = max<float>(m_segment->logicalLeft, m_left); |
155 m_right = min<float>(m_segment->logicalRight, m_right); | 155 m_right = min<float>(m_segment->logicalRight, m_right); |
156 } | 156 } |
157 | 157 |
158 computeAvailableWidthFromLeftAndRight(); | 158 computeAvailableWidthFromLeftAndRight(); |
159 } | 159 } |
160 | 160 |
161 inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa
tingObject* newFloat) | 161 inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* n
ewFloat) |
162 { | 162 { |
163 LayoutUnit height = m_block->logicalHeight(); | 163 LayoutUnit height = m_block->logicalHeight(); |
164 if (height < newFloat->logicalTop(m_block->isHorizontalWritingMode()) || hei
ght >= newFloat->logicalBottom(m_block->isHorizontalWritingMode())) | 164 if (height < newFloat->logicalTop(m_block->isHorizontalWritingMode()) || hei
ght >= newFloat->logicalBottom(m_block->isHorizontalWritingMode())) |
165 return; | 165 return; |
166 | 166 |
167 // When floats with shape outside are stacked, the floats are positioned bas
ed on the margin box of the float, | 167 // When floats with shape outside are stacked, the floats are positioned bas
ed on the margin box of the float, |
168 // not the shape's contour. Since we computed the width based on the shape c
ontour when we added the float, | 168 // not the shape's contour. Since we computed the width based on the shape c
ontour when we added the float, |
169 // when we add a subsequent float on the same line, we need to undo the shap
e delta in order to position | 169 // when we add a subsequent float on the same line, we need to undo the shap
e delta in order to position |
170 // based on the margin box. In order to do this, we need to walk back throug
h the floating object list to find | 170 // based on the margin box. In order to do this, we need to walk back throug
h the floating object list to find |
171 // the first previous float that is on the same side as our newFloat. | 171 // the first previous float that is on the same side as our newFloat. |
172 ShapeOutsideInfo* previousShapeOutsideInfo = 0; | 172 ShapeOutsideInfo* previousShapeOutsideInfo = 0; |
173 const RenderBlock::FloatingObjectSet& floatingObjectSet = m_block->m_floatin
gObjects->set(); | 173 const FloatingObjectSet& floatingObjectSet = m_block->m_floatingObjects->set
(); |
174 RenderBlock::FloatingObjectSetIterator it = floatingObjectSet.end(); | 174 FloatingObjectSetIterator it = floatingObjectSet.end(); |
175 RenderBlock::FloatingObjectSetIterator begin = floatingObjectSet.begin(); | 175 FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
176 while (it != begin) { | 176 while (it != begin) { |
177 --it; | 177 --it; |
178 RenderBlock::FloatingObject* previousFloat = *it; | 178 FloatingObject* previousFloat = *it; |
179 if (previousFloat != newFloat && previousFloat->type() == newFloat->type
()) { | 179 if (previousFloat != newFloat && previousFloat->type() == newFloat->type
()) { |
180 previousShapeOutsideInfo = previousFloat->renderer()->shapeOutsideIn
fo(); | 180 previousShapeOutsideInfo = previousFloat->renderer()->shapeOutsideIn
fo(); |
181 if (previousShapeOutsideInfo) { | 181 if (previousShapeOutsideInfo) { |
182 previousShapeOutsideInfo->computeSegmentsForContainingBlockLine(
m_block->logicalHeight(), previousFloat->logicalTop(m_block->isHorizontalWriting
Mode()), logicalHeightForLine(m_block, m_isFirstLine)); | 182 previousShapeOutsideInfo->computeSegmentsForContainingBlockLine(
m_block->logicalHeight(), previousFloat->logicalTop(m_block->isHorizontalWriting
Mode()), logicalHeightForLine(m_block, m_isFirstLine)); |
183 } | 183 } |
184 break; | 184 break; |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo(
); | 188 ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo(
); |
189 if (shapeOutsideInfo) | 189 if (shapeOutsideInfo) |
190 shapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logical
Height(), newFloat->logicalTop(m_block->isHorizontalWritingMode()), logicalHeigh
tForLine(m_block, m_isFirstLine)); | 190 shapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logical
Height(), newFloat->logicalTop(m_block->isHorizontalWritingMode()), logicalHeigh
tForLine(m_block, m_isFirstLine)); |
191 | 191 |
192 if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { | 192 if (newFloat->type() == FloatingObject::FloatLeft) { |
193 float newLeft = newFloat->logicalRight(m_block->isHorizontalWritingMode(
)); | 193 float newLeft = newFloat->logicalRight(m_block->isHorizontalWritingMode(
)); |
194 if (previousShapeOutsideInfo) | 194 if (previousShapeOutsideInfo) |
195 newLeft -= previousShapeOutsideInfo->rightSegmentMarginBoxDelta(); | 195 newLeft -= previousShapeOutsideInfo->rightSegmentMarginBoxDelta(); |
196 if (shapeOutsideInfo) | 196 if (shapeOutsideInfo) |
197 newLeft += shapeOutsideInfo->rightSegmentMarginBoxDelta(); | 197 newLeft += shapeOutsideInfo->rightSegmentMarginBoxDelta(); |
198 | 198 |
199 if (shouldIndentText() && m_block->style()->isLeftToRightDirection()) | 199 if (shouldIndentText() && m_block->style()->isLeftToRightDirection()) |
200 newLeft += floorToInt(m_block->textIndentOffset()); | 200 newLeft += floorToInt(m_block->textIndentOffset()); |
201 m_left = max<float>(m_left, newLeft); | 201 m_left = max<float>(m_left, newLeft); |
202 } else { | 202 } else { |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 | 1436 |
1437 LineInfo& lineInfo() { return m_lineInfo; } | 1437 LineInfo& lineInfo() { return m_lineInfo; } |
1438 const LineInfo& lineInfo() const { return m_lineInfo; } | 1438 const LineInfo& lineInfo() const { return m_lineInfo; } |
1439 | 1439 |
1440 LayoutUnit endLineLogicalTop() const { return m_endLineLogicalTop; } | 1440 LayoutUnit endLineLogicalTop() const { return m_endLineLogicalTop; } |
1441 void setEndLineLogicalTop(LayoutUnit logicalTop) { m_endLineLogicalTop = log
icalTop; } | 1441 void setEndLineLogicalTop(LayoutUnit logicalTop) { m_endLineLogicalTop = log
icalTop; } |
1442 | 1442 |
1443 RootInlineBox* endLine() const { return m_endLine; } | 1443 RootInlineBox* endLine() const { return m_endLine; } |
1444 void setEndLine(RootInlineBox* line) { m_endLine = line; } | 1444 void setEndLine(RootInlineBox* line) { m_endLine = line; } |
1445 | 1445 |
1446 RenderBlock::FloatingObject* lastFloat() const { return m_lastFloat; } | 1446 FloatingObject* lastFloat() const { return m_lastFloat; } |
1447 void setLastFloat(RenderBlock::FloatingObject* lastFloat) { m_lastFloat = la
stFloat; } | 1447 void setLastFloat(FloatingObject* lastFloat) { m_lastFloat = lastFloat; } |
1448 | 1448 |
1449 Vector<RenderBlock::FloatWithRect>& floats() { return m_floats; } | 1449 Vector<RenderBlock::FloatWithRect>& floats() { return m_floats; } |
1450 | 1450 |
1451 unsigned floatIndex() const { return m_floatIndex; } | 1451 unsigned floatIndex() const { return m_floatIndex; } |
1452 void setFloatIndex(unsigned floatIndex) { m_floatIndex = floatIndex; } | 1452 void setFloatIndex(unsigned floatIndex) { m_floatIndex = floatIndex; } |
1453 | 1453 |
1454 LayoutUnit adjustedLogicalLineTop() const { return m_adjustedLogicalLineTop;
} | 1454 LayoutUnit adjustedLogicalLineTop() const { return m_adjustedLogicalLineTop;
} |
1455 void setAdjustedLogicalLineTop(LayoutUnit value) { m_adjustedLogicalLineTop
= value; } | 1455 void setAdjustedLogicalLineTop(LayoutUnit value) { m_adjustedLogicalLineTop
= value; } |
1456 | 1456 |
1457 RenderFlowThread* flowThread() const { return m_flowThread; } | 1457 RenderFlowThread* flowThread() const { return m_flowThread; } |
1458 void setFlowThread(RenderFlowThread* thread) { m_flowThread = thread; } | 1458 void setFlowThread(RenderFlowThread* thread) { m_flowThread = thread; } |
1459 | 1459 |
1460 private: | 1460 private: |
1461 Vector<RenderBlock::FloatWithRect> m_floats; | 1461 Vector<RenderBlock::FloatWithRect> m_floats; |
1462 RenderBlock::FloatingObject* m_lastFloat; | 1462 FloatingObject* m_lastFloat; |
1463 RootInlineBox* m_endLine; | 1463 RootInlineBox* m_endLine; |
1464 LineInfo m_lineInfo; | 1464 LineInfo m_lineInfo; |
1465 unsigned m_floatIndex; | 1465 unsigned m_floatIndex; |
1466 LayoutUnit m_endLineLogicalTop; | 1466 LayoutUnit m_endLineLogicalTop; |
1467 bool m_endLineMatched; | 1467 bool m_endLineMatched; |
1468 bool m_checkForFloatsFromLastLine; | 1468 bool m_checkForFloatsFromLastLine; |
1469 | 1469 |
1470 bool m_isFullLayout; | 1470 bool m_isFullLayout; |
1471 | 1471 |
1472 // FIXME: Should this be a range object instead of two ints? | 1472 // FIXME: Should this be a range object instead of two ints? |
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3480 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 3480 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
3481 | 3481 |
3482 setLineGridBox(lineGridBox); | 3482 setLineGridBox(lineGridBox); |
3483 | 3483 |
3484 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 3484 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
3485 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 3485 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
3486 // to this grid. | 3486 // to this grid. |
3487 } | 3487 } |
3488 | 3488 |
3489 } | 3489 } |
OLD | NEW |