| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/engine/core/rendering/RenderParagraph.h" | 5 #include "sky/engine/core/rendering/RenderParagraph.h" |
| 6 | 6 |
| 7 #include "sky/engine/core/rendering/BidiRunForLine.h" | 7 #include "sky/engine/core/rendering/BidiRunForLine.h" |
| 8 #include "sky/engine/core/rendering/InlineIterator.h" | 8 #include "sky/engine/core/rendering/InlineIterator.h" |
| 9 #include "sky/engine/core/rendering/RenderLayer.h" | 9 #include "sky/engine/core/rendering/RenderLayer.h" |
| 10 #include "sky/engine/core/rendering/RenderObjectInlines.h" | 10 #include "sky/engine/core/rendering/RenderObjectInlines.h" |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 | 1349 |
| 1350 if (styleToUse->collapseWhiteSpace()) | 1350 if (styleToUse->collapseWhiteSpace()) |
| 1351 stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild); | 1351 stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild); |
| 1352 | 1352 |
| 1353 updatePreferredWidth(minLogicalWidth, inlineMin); | 1353 updatePreferredWidth(minLogicalWidth, inlineMin); |
| 1354 updatePreferredWidth(maxLogicalWidth, inlineMax); | 1354 updatePreferredWidth(maxLogicalWidth, inlineMax); |
| 1355 | 1355 |
| 1356 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); | 1356 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); |
| 1357 } | 1357 } |
| 1358 | 1358 |
| 1359 int RenderParagraph::firstLineBoxBaseline() const | 1359 int RenderParagraph::firstLineBoxBaseline(FontBaselineOrAuto baselineType) const |
| 1360 { | 1360 { |
| 1361 return firstLineBox() ? firstLineBox()->logicalTop() + style(true)->fontMetr
ics().ascent(firstRootBox()->baselineType()) : -1; | 1361 if (!firstLineBox()) |
| 1362 return -1; |
| 1363 FontBaseline baseline; |
| 1364 if (baselineType.m_auto) |
| 1365 baseline = firstRootBox()->baselineType(); |
| 1366 else |
| 1367 baseline = baselineType.m_baseline; |
| 1368 return firstLineBox()->logicalTop() + style(true)->fontMetrics().ascent(baseli
ne); |
| 1362 } | 1369 } |
| 1363 | 1370 |
| 1364 int RenderParagraph::lastLineBoxBaseline(LineDirectionMode lineDirection) const | 1371 int RenderParagraph::lastLineBoxBaseline(LineDirectionMode lineDirection) const |
| 1365 { | 1372 { |
| 1366 if (!firstLineBox() && hasLineIfEmpty()) { | 1373 if (!firstLineBox() && hasLineIfEmpty()) { |
| 1367 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); | 1374 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); |
| 1368 return fontMetrics.ascent() | 1375 return fontMetrics.ascent() |
| 1369 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - f
ontMetrics.height()) / 2 | 1376 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - f
ontMetrics.height()) / 2 |
| 1370 + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : b
orderRight() + paddingRight()); | 1377 + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : b
orderRight() + paddingRight()); |
| 1371 } | 1378 } |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 curr->adjustLogicalPosition(logicalLeft, 0); | 1701 curr->adjustLogicalPosition(logicalLeft, 0); |
| 1695 else | 1702 else |
| 1696 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW
idth - totalLogicalWidth), 0); | 1703 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW
idth - totalLogicalWidth), 0); |
| 1697 } | 1704 } |
| 1698 } | 1705 } |
| 1699 firstLine = false; | 1706 firstLine = false; |
| 1700 } | 1707 } |
| 1701 } | 1708 } |
| 1702 | 1709 |
| 1703 } // namespace blink | 1710 } // namespace blink |
| OLD | NEW |