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

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

Issue 2764753007: [LayoutNG] Add NGLineBoxFragment (Closed)
Patch Set: 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_builder.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_line_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_line_builder.h
index 536508b345acc16ccb6a63e259b7e38372562d5f..2ff256def39b86dde213fe9e735c7da7f832fd92 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_line_builder.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_line_builder.h
@@ -8,19 +8,18 @@
#include "core/CoreExport.h"
#include "core/layout/ng/geometry/ng_logical_offset.h"
#include "core/layout/ng/ng_fragment_builder.h"
-#include "core/layout/ng/ng_layout_opportunity_iterator.h"
-#include "core/layout/ng/ng_physical_fragment.h"
+#include "core/layout/ng/ng_line_height_metrics.h"
#include "platform/fonts/FontBaseline.h"
#include "platform/heap/Handle.h"
#include "wtf/Vector.h"
namespace blink {
-class ComputedStyle;
-class FontMetrics;
class NGConstraintSpace;
class NGInlineNode;
class NGLayoutInlineItem;
+class NGLineboxFragmentBuilder;
+class NGTextFragmentBuilder;
// NGLineBuilder creates the fragment tree for a line.
// NGLineBuilder manages the current line as a range, |start| and |end|.
@@ -111,50 +110,14 @@ class CORE_EXPORT NGLineBuilder final {
void BidiReorder(Vector<LineItemChunk, 32>*);
- // Represents block-direction metrics for an |NGLayoutInlineItem|.
- struct InlineItemMetrics {
- float ascent;
- float descent;
- float ascent_and_leading;
- float descent_and_leading;
-
- // Use the leading from the 'line-height' property, or the font metrics of
- // the primary font if 'line-height: normal'.
- InlineItemMetrics(const ComputedStyle&, FontBaseline);
-
- // Use the leading from the font metrics.
- InlineItemMetrics(const FontMetrics&, FontBaseline);
-
- private:
- void Initialize(const FontMetrics&, FontBaseline, float line_height);
- };
-
- // LineBoxData is a set of data for a line box that are computed in early
- // phases, such as in |CreateLine()|, and will be used in later phases.
- // TODO(kojii): Not sure if all these data are needed in fragment tree. If
- // they are, we can create a linebox fragment, store them there, and this
- // isn't needed. For now, we're trying to minimize data in fragments.
- struct LineBoxData {
- unsigned fragment_end;
- LayoutUnit inline_size;
- LayoutUnit top_with_leading;
- float max_ascent = 0;
- float max_descent = 0;
- float max_ascent_and_leading = 0;
- float max_descent_and_leading = 0;
-
- // Include |InlineItemMetrics| into the metrics for this line box.
- void UpdateMaxAscentAndDescent(const InlineItemMetrics&);
- };
-
void PlaceItems(const Vector<LineItemChunk, 32>&);
void AccumulateUsedFonts(const NGLayoutInlineItem&,
const LineItemChunk&,
- LineBoxData*);
+ NGLineboxFragmentBuilder*);
LayoutUnit PlaceAtomicInline(const NGLayoutInlineItem&,
LayoutUnit estimated_baseline,
- LineBoxData*,
- NGFragmentBuilder*);
+ NGLineboxFragmentBuilder*,
+ NGTextFragmentBuilder*);
// Finds the next layout opportunity for the next text fragment.
void FindNextLayoutOpportunity();
@@ -162,7 +125,6 @@ class CORE_EXPORT NGLineBuilder final {
Persistent<NGInlineNode> inline_box_;
NGConstraintSpace* constraint_space_; // Not owned as STACK_ALLOCATED.
Vector<RefPtr<NGLayoutResult>, 32> layout_results_;
- Vector<LineBoxData, 32> line_box_data_list_;
unsigned start_index_ = 0;
unsigned start_offset_ = 0;
unsigned last_index_ = 0;

Powered by Google App Engine
This is Rietveld 408576698