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

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: Do no update the intrinsic size. 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 34394d9fefa93349d81016ebb644b680f17f947e..86b52918281aae069a2f47b0b87c5f53ffb537c2 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,7 +2540,14 @@ int LayoutBlockFlow::firstLineBoxBaseline() const {
DCHECK(fontData);
if (!fontData)
return -1;
- return (firstLineBox()->logicalTop() +
+ // logicalTop() gives the distance to 'over-edge', 'top' for horizontal and
+ // 'right' for vertical-lr and vertical-rl. However, as it happens in
+ // inlineBlockBaseline we will flip lines to compute the baseline in case of
+ // vertical-lr mode, hence we want the distance to 'left' edge.
+ // We perform the same operatio in LayoutBlockFlow::inlineBlockBaseline.
+ return ((styleRef().isFlippedLinesWritingMode()
+ ? logicalHeight() - firstLineBox()->logicalBottom()
+ : firstLineBox()->logicalTop()) +
fontData->getFontMetrics().ascent(firstRootBox()->baselineType()))
.toInt();
}

Powered by Google App Engine
This is Rietveld 408576698