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

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

Issue 2739683006: Use Opportunity Iterator to position text fragments in NGLineBuilder (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_text_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
index ab37fecc93bdd4b124e68615ef51c9937c414861..5c9366d0b2f2e04e0f3643f42a053c7f7b0773b6 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
@@ -9,6 +9,7 @@
#include "core/layout/ng/ng_constraint_space.h"
#include "core/layout/ng/ng_fragment_builder.h"
#include "core/layout/ng/ng_inline_node.h"
+#include "core/layout/ng/ng_layout_opportunity_iterator.h"
#include "core/layout/ng/ng_line_builder.h"
#include "core/layout/ng/ng_text_fragment.h"
#include "core/style/ComputedStyle.h"
@@ -44,8 +45,10 @@ void NGTextLayoutAlgorithm::LayoutInline(NGLineBuilder* line_builder) {
DCHECK(!text_content.isEmpty());
// TODO(kojii): Give the locale to LazyLineBreakIterator.
LazyLineBreakIterator line_break_iterator(text_content);
+
unsigned current_offset = 0;
line_builder->SetStart(0, current_offset);
+ line_builder->FindNextLayoutOpportunity();
kojii 2017/03/09 03:01:54 It looks more natural to call this at the end of |
Gleb Lanbin 2017/03/09 22:26:45 done. Although I think it adds an additional side
kojii 2017/03/10 03:12:43 Yeah, I was thinking of this, eae@ misunderstood t
const unsigned end_offset = text_content.length();
while (current_offset < end_offset) {
// Find the next break opportunity.
@@ -102,6 +105,7 @@ void NGTextLayoutAlgorithm::LayoutInline(NGLineBuilder* line_builder) {
line_builder->SetBreakOpportunity();
}
}
+ line_builder->FindNextLayoutOpportunity();
kojii 2017/03/09 03:01:54 and at the end of |CreateLineUpToLastBreakOpportun
Gleb Lanbin 2017/03/09 22:26:45 Done.
}
// If inline children ended with items left in the line builder, create a line

Powered by Google App Engine
This is Rietveld 408576698