OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NGLineHeightMetrics_h |
| 6 #define NGLineHeightMetrics_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/ng_physical_fragment.h" |
| 10 #include "platform/fonts/FontBaseline.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class ComputedStyle; |
| 15 class FontMetrics; |
| 16 |
| 17 // Represents line-progression metrics for line boxes and inline boxes. |
| 18 struct NGLineHeightMetrics { |
| 19 NGLineHeightMetrics() {} |
| 20 |
| 21 // Use the leading from the 'line-height' property, or the font metrics of |
| 22 // the primary font if 'line-height: normal'. |
| 23 NGLineHeightMetrics(const ComputedStyle&, FontBaseline); |
| 24 |
| 25 // Use the leading from the font metrics. |
| 26 NGLineHeightMetrics(const FontMetrics&, FontBaseline); |
| 27 |
| 28 void Unite(const NGLineHeightMetrics&); |
| 29 |
| 30 // TODO(kojii): Replace these floats with LayoutUnit. |
| 31 float ascent = 0; |
| 32 float descent = 0; |
| 33 float ascent_and_leading = 0; |
| 34 float descent_and_leading = 0; |
| 35 |
| 36 LayoutUnit LineHeight() const { |
| 37 return LayoutUnit(ascent_and_leading + descent_and_leading); |
| 38 } |
| 39 |
| 40 private: |
| 41 void Initialize(const FontMetrics&, FontBaseline, float line_height); |
| 42 }; |
| 43 |
| 44 } // namespace blink |
| 45 |
| 46 #endif // NGLineHeightMetrics_h |
OLD | NEW |