Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: sky/engine/core/rendering/RenderParagraph.cpp

Issue 1200233002: Use the baseline information exposed by C++ to pipe baseline data through RenderBox. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(bool autoBaseline, FontBaseline baseli neType) const
1360 { 1360 {
1361 return firstLineBox() ? firstLineBox()->logicalTop() + style(true)->fontMetr ics().ascent(firstRootBox()->baselineType()) : -1; 1361 return firstLineBox() ? firstLineBox()->logicalTop() + style(true)->fontMetr ics().ascent(autoBaseline ? firstRootBox()->baselineType() : baselineType) : -1;
1362 } 1362 }
1363 1363
1364 int RenderParagraph::lastLineBoxBaseline(LineDirectionMode lineDirection) const 1364 int RenderParagraph::lastLineBoxBaseline(LineDirectionMode lineDirection) const
1365 { 1365 {
1366 if (!firstLineBox() && hasLineIfEmpty()) { 1366 if (!firstLineBox() && hasLineIfEmpty()) {
1367 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); 1367 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics();
1368 return fontMetrics.ascent() 1368 return fontMetrics.ascent()
1369 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - f ontMetrics.height()) / 2 1369 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - f ontMetrics.height()) / 2
1370 + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : b orderRight() + paddingRight()); 1370 + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : b orderRight() + paddingRight());
1371 } 1371 }
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 curr->adjustLogicalPosition(logicalLeft, 0); 1694 curr->adjustLogicalPosition(logicalLeft, 0);
1695 else 1695 else
1696 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW idth - totalLogicalWidth), 0); 1696 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW idth - totalLogicalWidth), 0);
1697 } 1697 }
1698 } 1698 }
1699 firstLine = false; 1699 firstLine = false;
1700 } 1700 }
1701 } 1701 }
1702 1702
1703 } // namespace blink 1703 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698