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

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: Applied suggested changes. Created 4 years, 1 month 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 605c990b65b93b50879aac549a6e53232b9cc04a..c82869d7fdd1d998a05f61f7a86f83e4995f91c8 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -2489,8 +2489,15 @@ int LayoutBlockFlow::lineCount(const RootInlineBox* stopRootInlineBox) const {
return count;
}
+bool LayoutBlockFlow::isDescentBaseline() const {
+ if (isOrthogonalWritingModeRoot())
+ return !styleRef().isHorizontalWritingMode();
kojii 2016/11/16 17:18:06 Just curious, since I don't understand, why do we
jfernandez 2016/11/16 18:50:07 In the general case, we don't compute baselines fo
kojii 2016/11/18 04:14:53 Oh I think I understand this. I think the missing
+ return parent() ? parent()->styleRef().isFlippedLinesWritingMode()
+ : styleRef().isFlippedLinesWritingMode();
+}
+
int LayoutBlockFlow::firstLineBoxBaseline() const {
- if (isWritingModeRoot() && !isRubyRun())
+ if (isWritingModeRoot() && !isRubyRun() && !isGridItem())
return -1;
if (!childrenInline())
return LayoutBlock::firstLineBoxBaseline();
@@ -2500,7 +2507,11 @@ int LayoutBlockFlow::firstLineBoxBaseline() const {
if (!fontData)
return -1;
return (firstLineBox()->logicalTop() +
- fontData->getFontMetrics().ascent(firstRootBox()->baselineType()))
+ (!isDescentBaseline()
+ ? fontData->getFontMetrics().ascent(
+ firstRootBox()->baselineType())
+ : fontData->getFontMetrics().descent(
+ firstRootBox()->baselineType())))
.toInt();
}
return -1;

Powered by Google App Engine
This is Rietveld 408576698