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

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

Issue 2676883002: [LayoutNG] Avoid creating empty LineBoxData in NGLineBuilder (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_line_builder.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_line_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_line_builder.cc
index 95191f742924578bcfa32c7ddfae419c75a5795f..2c2a23d1d3cc9ce51c2004364225a91cec2c552c 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_line_builder.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_line_builder.cc
@@ -77,14 +77,16 @@ void NGLineBuilder::CreateLine() {
}
DCHECK_EQ(fragments_.size(), offsets_.size());
- line_box_data_list_.grow(line_box_data_list_.size() + 1);
- LineBoxData& line_box_data = line_box_data_list_.back();
- line_box_data.fragment_end = fragments_.size();
- line_box_data.inline_size = inline_offset;
-
- max_inline_size_ = std::max(max_inline_size_, inline_offset);
- // TODO(kojii): Implement block size when we support baseline alignment.
- content_size_ += LayoutUnit(100);
+ if (!fragments_.isEmpty()) {
+ line_box_data_list_.grow(line_box_data_list_.size() + 1);
+ LineBoxData& line_box_data = line_box_data_list_.back();
+ line_box_data.fragment_end = fragments_.size();
+ line_box_data.inline_size = inline_offset;
+
+ max_inline_size_ = std::max(max_inline_size_, inline_offset);
+ // TODO(kojii): Implement block size when we support baseline alignment.
+ content_size_ += LayoutUnit(100);
+ }
line_item_chunks_.clear();
#if DCHECK_IS_ON()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698