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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight) | 53 void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight) |
54 { | 54 { |
55 LayoutUnit height = m_block.logicalHeight(); | 55 LayoutUnit height = m_block.logicalHeight(); |
56 LayoutUnit logicalHeight = m_block.minLineHeightForReplacedRenderer(m_isFirs tLine, replacedHeight); | 56 LayoutUnit logicalHeight = m_block.minLineHeightForReplacedRenderer(m_isFirs tLine, replacedHeight); |
57 m_left = m_block.logicalLeftOffsetForLine(height, shouldIndentText(), logica lHeight).toFloat(); | 57 m_left = m_block.logicalLeftOffsetForLine(height, shouldIndentText(), logica lHeight).toFloat(); |
58 m_right = m_block.logicalRightOffsetForLine(height, shouldIndentText(), logi calHeight).toFloat(); | 58 m_right = m_block.logicalRightOffsetForLine(height, shouldIndentText(), logi calHeight).toFloat(); |
59 | 59 |
60 computeAvailableWidthFromLeftAndRight(); | 60 computeAvailableWidthFromLeftAndRight(); |
61 } | 61 } |
62 | 62 |
63 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat ) | 63 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat ) |
Julien - ping for review
2014/12/01 16:12:47
We could use a reference here too.
Sunil Ratnu
2015/03/16 08:06:30
Done.
| |
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.logi calBottomForFloat(*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->renderer()->shapeOutsideI nfo()) { |
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. |
81 newLeft = m_left; | 81 newLeft = m_left; |
82 } | 82 } |
83 if (shouldIndentText() && m_block.style()->isLeftToRightDirection()) | 83 if (shouldIndentText() && m_block.style()->isLeftToRightDirection()) |
84 newLeft += floorToInt(m_block.textIndentOffset()); | 84 newLeft += floorToInt(m_block.textIndentOffset()); |
85 m_left = std::max<float>(m_left, newLeft); | 85 m_left = std::max<float>(m_left, newLeft); |
86 } else { | 86 } else { |
87 float newRight = m_block.logicalLeftForFloat(newFloat).toFloat(); | 87 float newRight = m_block.logicalLeftForFloat(*newFloat).toFloat(); |
88 if (shapeDeltas.isValid()) { | 88 if (shapeDeltas.isValid()) { |
89 if (shapeDeltas.lineOverlapsShape()) | 89 if (shapeDeltas.lineOverlapsShape()) |
90 newRight += shapeDeltas.leftMarginBoxDelta(); | 90 newRight += shapeDeltas.leftMarginBoxDelta(); |
91 else // Per the CSS Shapes spec, If the line doesn't overlap the sha pe, then ignore this shape for this line. | 91 else // Per the CSS Shapes spec, If the line doesn't overlap the sha pe, then ignore this shape for this line. |
92 newRight = m_right; | 92 newRight = m_right; |
93 } | 93 } |
94 if (shouldIndentText() && !m_block.style()->isLeftToRightDirection()) | 94 if (shouldIndentText() && !m_block.style()->isLeftToRightDirection()) |
95 newRight -= floorToInt(m_block.textIndentOffset()); | 95 newRight -= floorToInt(m_block.textIndentOffset()); |
96 m_right = std::min<float>(m_right, newRight); | 96 m_right = std::min<float>(m_right, newRight); |
97 } | 97 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 } | 205 } |
206 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi neRight); | 206 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi neRight); |
207 } | 207 } |
208 | 208 |
209 void LineWidth::computeAvailableWidthFromLeftAndRight() | 209 void LineWidth::computeAvailableWidthFromLeftAndRight() |
210 { | 210 { |
211 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; | 211 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; |
212 } | 212 } |
213 | 213 |
214 } | 214 } |
OLD | NEW |