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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 1407633003: [css-grid] Implementation of Baseline Self-Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improving the skipped tesst by solving some rounding issues Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 69e8ef4926e9d1840e445324c309c5d2c23ed883..380aac5ae8b1f6fe8cdef3e01b996157389bc1e9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -2529,7 +2529,9 @@ int LayoutBlockFlow::lineCount(const RootInlineBox* stopRootInlineBox) const {
}
int LayoutBlockFlow::firstLineBoxBaseline() const {
- if (isWritingModeRoot() && !isRubyRun())
+ // Orthogonal grid items can participante in baseline alignment along column
+ // axis.
+ if (isWritingModeRoot() && !isRubyRun() && !isGridItem())
return -1;
if (!childrenInline())
return LayoutBlock::firstLineBoxBaseline();
@@ -2538,6 +2540,18 @@ int LayoutBlockFlow::firstLineBoxBaseline() const {
DCHECK(fontData);
if (!fontData)
return -1;
+ // fontMetrics 'ascent' is the distance above the baseline to the 'over'
+ // edge, which is 'top' for horizontal and 'right' for vertical-lr and
+ // vertical-rl. However, firstLineBox()->logicalTop() gives the offset from
+ // the 'left' edge for vertical-lr, hence we need to use the Font Metrics
+ // 'descent' instead. The result should be handled accordingly by the caller
+ // as a 'descent' value, in order to compute properly the max baseline.
+ if (styleRef().isFlippedLinesWritingMode()) {
+ return (firstLineBox()->logicalTop() +
+ fontData->getFontMetrics().descent(
+ firstRootBox()->baselineType()))
+ .toInt();
+ }
return (firstLineBox()->logicalTop() +
fontData->getFontMetrics().ascent(firstRootBox()->baselineType()))
.toInt();
« no previous file with comments | « third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698