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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat
) | 69 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat
) |
70 { | 70 { |
71 LayoutUnit height = m_block.logicalHeight(); | 71 LayoutUnit height = m_block.logicalHeight(); |
72 if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logic
alBottomForFloat(newFloat)) | 72 if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logic
alBottomForFloat(newFloat)) |
73 return; | 73 return; |
74 | 74 |
75 ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo(
); | 75 ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo(
); |
76 if (shapeOutsideInfo) { | 76 if (shapeOutsideInfo) { |
77 LayoutUnit lineHeight = m_block.lineHeight(m_isFirstLine, m_block.isHori
zontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes
); | 77 LayoutUnit lineHeight = m_block.lineHeight(m_isFirstLine, m_block.isHori
zontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes
); |
78 shapeOutsideInfo->updateDeltasForContainingBlockLine(&m_block, newFloat,
m_block.logicalHeight(), lineHeight); | 78 shapeOutsideInfo->updateDeltasForContainingBlockLine(m_block, *newFloat,
m_block.logicalHeight(), lineHeight); |
79 } | 79 } |
80 | 80 |
81 if (newFloat->type() == FloatingObject::FloatLeft) { | 81 if (newFloat->type() == FloatingObject::FloatLeft) { |
82 float newLeft = m_block.logicalRightForFloat(newFloat); | 82 float newLeft = m_block.logicalRightForFloat(newFloat); |
83 if (shapeOutsideInfo) { | 83 if (shapeOutsideInfo) { |
84 if (shapeOutsideInfo->lineOverlapsShape()) | 84 if (shapeOutsideInfo->lineOverlapsShape()) |
85 newLeft += shapeOutsideInfo->rightMarginBoxDelta(); | 85 newLeft += shapeOutsideInfo->rightMarginBoxDelta(); |
86 else // Per the CSS Shapes spec, If the line doesn't overlap the sha
pe, then ignore this shape for this line. | 86 else // Per the CSS Shapes spec, If the line doesn't overlap the sha
pe, then ignore this shape for this line. |
87 newLeft = m_left; | 87 newLeft = m_left; |
88 } | 88 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shoul
dIndentText(), newLineLeft, newLineRight); | 206 newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shoul
dIndentText(), newLineLeft, newLineRight); |
207 lastFloatLogicalBottom = floatLogicalBottom; | 207 lastFloatLogicalBottom = floatLogicalBottom; |
208 | 208 |
209 if (newLineWidth >= m_uncommittedWidth) { | 209 if (newLineWidth >= m_uncommittedWidth) { |
210 ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo(); | 210 ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo(); |
211 if (shapeInsideInfo) { | 211 if (shapeInsideInfo) { |
212 // To safely update our shape segments, the current segment must
be the first in this line, so committedWidth has to be 0 | 212 // To safely update our shape segments, the current segment must
be the first in this line, so committedWidth has to be 0 |
213 ASSERT(!m_committedWidth); | 213 ASSERT(!m_committedWidth); |
214 | 214 |
215 LayoutUnit logicalOffsetFromShapeContainer = m_block.logicalOffs
etFromShapeAncestorContainer(shapeInsideInfo->owner()).height(); | 215 LayoutUnit logicalOffsetFromShapeContainer = m_block.logicalOffs
etFromShapeAncestorContainer(&shapeInsideInfo->owner()).height(); |
216 LayoutUnit lineHeight = m_block.lineHeight(false, m_block.isHori
zontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes
); | 216 LayoutUnit lineHeight = m_block.lineHeight(false, m_block.isHori
zontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes
); |
217 shapeInsideInfo->updateSegmentsForLine(lastFloatLogicalBottom +
logicalOffsetFromShapeContainer, lineHeight); | 217 shapeInsideInfo->updateSegmentsForLine(lastFloatLogicalBottom +
logicalOffsetFromShapeContainer, lineHeight); |
218 updateCurrentShapeSegment(); | 218 updateCurrentShapeSegment(); |
219 updateAvailableWidth(); | 219 updateAvailableWidth(); |
220 } | 220 } |
221 break; | 221 break; |
222 } | 222 } |
223 } | 223 } |
224 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi
neRight); | 224 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi
neRight); |
225 } | 225 } |
226 | 226 |
227 void LineWidth::updateCurrentShapeSegment() | 227 void LineWidth::updateCurrentShapeSegment() |
228 { | 228 { |
229 if (ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo()) | 229 if (ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo()) |
230 m_segment = shapeInsideInfo->currentSegment(); | 230 m_segment = shapeInsideInfo->currentSegment(); |
231 } | 231 } |
232 | 232 |
233 void LineWidth::computeAvailableWidthFromLeftAndRight() | 233 void LineWidth::computeAvailableWidthFromLeftAndRight() |
234 { | 234 { |
235 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; | 235 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; |
236 } | 236 } |
237 | 237 |
238 } | 238 } |
OLD | NEW |