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

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

Issue 2739683006: Use Opportunity Iterator to position text fragments in NGLineBuilder (Closed)
Patch Set: add font-family 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_layout_opportunity_iterator.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
index f95d51d176ef7445381c363cce38b3fa787a9741..f7a8d6c5d2d3f6937aa0577c1accc311610b7829 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "core/layout/ng/ng_layout_opportunity_iterator.h"
-
#include "core/layout/ng/ng_constraint_space.h"
#include "core/layout/ng/ng_exclusion.h"
#include "wtf/NonCopyingSort.h"
@@ -265,25 +264,23 @@ NGExclusion ToLeaderExclusion(const NGLogicalOffset& origin_point,
NGLayoutOpportunityIterator::NGLayoutOpportunityIterator(
const NGConstraintSpace* space,
- const WTF::Optional<NGLogicalOffset>& opt_origin_point,
+ const WTF::Optional<NGLogicalOffset>& opt_offset,
const WTF::Optional<NGLogicalOffset>& opt_leader_point)
- : constraint_space_(space) {
+ : constraint_space_(space),
+ offset_(opt_offset ? opt_offset.value() : space->BfcOffset()) {
// TODO(chrome-layout-team): Combine exclusions that shadow each other.
auto& exclusions = constraint_space_->Exclusions();
DCHECK(std::is_sorted(exclusions->storage.begin(), exclusions->storage.end(),
&CompareNGExclusionsByTopAsc))
<< "Exclusions are expected to be sorted by TOP";
- NGLogicalOffset origin_point =
- opt_origin_point ? opt_origin_point.value() : NGLogicalOffset();
NGLayoutOpportunity initial_opportunity =
- CreateLayoutOpportunityFromConstraintSpace(*constraint_space_,
- origin_point);
+ CreateLayoutOpportunityFromConstraintSpace(*constraint_space_, Offset());
opportunity_tree_root_ = new NGLayoutOpportunityTreeNode(initial_opportunity);
if (opt_leader_point) {
const NGExclusion leader_exclusion =
- ToLeaderExclusion(origin_point, opt_leader_point.value());
+ ToLeaderExclusion(Offset(), opt_leader_point.value());
InsertExclusion(MutableOpportunityTreeRoot(), &leader_exclusion,
opportunities_);
}

Powered by Google App Engine
This is Rietveld 408576698