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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 computeAvailableWidthFromLeftAndRight(); | 60 computeAvailableWidthFromLeftAndRight(); |
61 } | 61 } |
62 | 62 |
63 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat
) | 63 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat
) |
64 { | 64 { |
65 LayoutUnit height = m_block.logicalHeight(); | 65 LayoutUnit height = m_block.logicalHeight(); |
66 if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logic
alBottomForFloat(newFloat)) | 66 if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logic
alBottomForFloat(newFloat)) |
67 return; | 67 return; |
68 | 68 |
69 ShapeOutsideDeltas shapeDeltas; | 69 ShapeOutsideDeltas shapeDeltas; |
70 if (ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideI
nfo()) { | 70 if (ShapeOutsideInfo* shapeOutsideInfo = newFloat->layoutObject()->shapeOuts
ideInfo()) { |
71 LayoutUnit lineHeight = m_block.lineHeight(m_isFirstLine, m_block.isHori
zontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes
); | 71 LayoutUnit lineHeight = m_block.lineHeight(m_isFirstLine, m_block.isHori
zontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes
); |
72 shapeDeltas = shapeOutsideInfo->computeDeltasForContainingBlockLine(m_bl
ock, *newFloat, m_block.logicalHeight(), lineHeight); | 72 shapeDeltas = shapeOutsideInfo->computeDeltasForContainingBlockLine(m_bl
ock, *newFloat, m_block.logicalHeight(), lineHeight); |
73 } | 73 } |
74 | 74 |
75 if (newFloat->type() == FloatingObject::FloatLeft) { | 75 if (newFloat->type() == FloatingObject::FloatLeft) { |
76 float newLeft = m_block.logicalRightForFloat(newFloat).toFloat(); | 76 float newLeft = m_block.logicalRightForFloat(newFloat).toFloat(); |
77 if (shapeDeltas.isValid()) { | 77 if (shapeDeltas.isValid()) { |
78 if (shapeDeltas.lineOverlapsShape()) | 78 if (shapeDeltas.lineOverlapsShape()) |
79 newLeft += shapeDeltas.rightMarginBoxDelta(); | 79 newLeft += shapeDeltas.rightMarginBoxDelta(); |
80 else // Per the CSS Shapes spec, If the line doesn't overlap the sha
pe, then ignore this shape for this line. | 80 else // Per the CSS Shapes spec, If the line doesn't overlap the sha
pe, then ignore this shape for this line. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 ASSERT(!fitsOnLine()); | 167 ASSERT(!fitsOnLine()); |
168 m_block.positionNewFloats(this); | 168 m_block.positionNewFloats(this); |
169 | 169 |
170 LayoutUnit floatLogicalBottom; | 170 LayoutUnit floatLogicalBottom; |
171 LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight(); | 171 LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight(); |
172 float newLineWidth = m_availableWidth; | 172 float newLineWidth = m_availableWidth; |
173 float newLineLeft = m_left; | 173 float newLineLeft = m_left; |
174 float newLineRight = m_right; | 174 float newLineRight = m_right; |
175 | 175 |
176 FloatingObject* lastFloatFromPreviousLine = (m_block.containsFloats() ? m_bl
ock.m_floatingObjects->set().last().get() : 0); | 176 FloatingObject* lastFloatFromPreviousLine = (m_block.containsFloats() ? m_bl
ock.m_floatingObjects->set().last().get() : 0); |
177 if (lastFloatFromPreviousLine && lastFloatFromPreviousLine->renderer()->
shapeOutsideInfo()) | 177 if (lastFloatFromPreviousLine && lastFloatFromPreviousLine->layoutObject
()->shapeOutsideInfo()) |
178 return wrapNextToShapeOutside(isFirstLine); | 178 return wrapNextToShapeOutside(isFirstLine); |
179 | 179 |
180 while (true) { | 180 while (true) { |
181 floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogica
lBottom, ShapeOutsideFloatShapeOffset); | 181 floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogica
lBottom, ShapeOutsideFloatShapeOffset); |
182 if (floatLogicalBottom <= lastFloatLogicalBottom) | 182 if (floatLogicalBottom <= lastFloatLogicalBottom) |
183 break; | 183 break; |
184 | 184 |
185 newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shoul
dIndentText(), newLineLeft, newLineRight); | 185 newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shoul
dIndentText(), newLineLeft, newLineRight); |
186 lastFloatLogicalBottom = floatLogicalBottom; | 186 lastFloatLogicalBottom = floatLogicalBottom; |
187 | 187 |
188 if (newLineWidth >= m_uncommittedWidth) | 188 if (newLineWidth >= m_uncommittedWidth) |
189 break; | 189 break; |
190 } | 190 } |
191 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi
neRight); | 191 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi
neRight); |
192 } | 192 } |
193 | 193 |
194 void LineWidth::computeAvailableWidthFromLeftAndRight() | 194 void LineWidth::computeAvailableWidthFromLeftAndRight() |
195 { | 195 { |
196 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; | 196 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; |
197 } | 197 } |
198 | 198 |
199 } | 199 } |
OLD | NEW |