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

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

Issue 2764753007: [LayoutNG] Add NGLineBoxFragment (Closed)
Patch Set: Rebase again as other CLs landed faster 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/ng/ng_line_height_metrics.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_line_height_metrics.h b/third_party/WebKit/Source/core/layout/ng/ng_line_height_metrics.h
new file mode 100644
index 0000000000000000000000000000000000000000..9b5a1e90ef1d16d4a0c9224d92de9864cf65b4dc
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_line_height_metrics.h
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NGLineHeightMetrics_h
+#define NGLineHeightMetrics_h
+
+#include "core/CoreExport.h"
+#include "core/layout/ng/ng_physical_fragment.h"
+#include "platform/fonts/FontBaseline.h"
+
+namespace blink {
+
+class ComputedStyle;
+class FontMetrics;
+
+// Represents line-progression metrics for line boxes and inline boxes.
+struct NGLineHeightMetrics {
+ NGLineHeightMetrics() {}
+
+ // Use the leading from the 'line-height' property, or the font metrics of
+ // the primary font if 'line-height: normal'.
+ NGLineHeightMetrics(const ComputedStyle&, FontBaseline);
+
+ // Use the leading from the font metrics.
+ NGLineHeightMetrics(const FontMetrics&, FontBaseline);
+
+ void Unite(const NGLineHeightMetrics&);
+
+ // TODO(kojii): Replace these floats with LayoutUnit.
+ float ascent = 0;
+ float descent = 0;
+ float ascent_and_leading = 0;
+ float descent_and_leading = 0;
+
+ LayoutUnit LineHeight() const {
+ return LayoutUnit(ascent_and_leading + descent_and_leading);
+ }
+
+ private:
+ void Initialize(const FontMetrics&, FontBaseline, float line_height);
+};
+
+} // namespace blink
+
+#endif // NGLineHeightMetrics_h

Powered by Google App Engine
This is Rietveld 408576698