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

Unified Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_line_height_metrics.cc

Issue 2803433002: [LayoutNG] Initial support for the 'vertical-align' property (Closed)
Patch Set: Move all On*() to NGInlineLayoutStateStack Created 3 years, 8 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/ng/inline/ng_line_height_metrics.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_height_metrics.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_height_metrics.cc
index a3258a0c61e3c94f55dac3fdd1dbf66bc1e5f408..a6d4c437c2ff4c82837650852d628de83b03acbf 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_height_metrics.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_height_metrics.cc
@@ -27,6 +27,7 @@ void NGLineHeightMetrics::Initialize(const FontMetrics& font_metrics,
}
void NGLineHeightMetrics::AddLeading(LayoutUnit line_height) {
+ DCHECK(!IsEmpty());
LayoutUnit half_leading = (line_height - (ascent + descent)) / 2;
// TODO(kojii): floor() is to make text dump compatible with legacy test
// results. Revisit when we paint.
@@ -34,6 +35,12 @@ void NGLineHeightMetrics::AddLeading(LayoutUnit line_height) {
descent = line_height - ascent;
}
+void NGLineHeightMetrics::Move(LayoutUnit delta) {
+ DCHECK(!IsEmpty());
+ ascent -= delta;
+ descent += delta;
+}
+
void NGLineHeightMetrics::Unite(const NGLineHeightMetrics& other) {
ascent = std::max(ascent, other.ascent);
descent = std::max(descent, other.descent);

Powered by Google App Engine
This is Rietveld 408576698