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

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

Issue 2948743002: [LayoutNG] Let NGLineBreaker pass line box location to NGInlineLayoutAlgorithm (Closed)
Patch Set: ikilpatrick review Created 3 years, 6 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 | « third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h ('k') | 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/inline/ng_line_breaker.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
index 6696cd7080cc2c835850f06134ffa1822b108523..3d17448627c46c6f7d7a58e650ab83603a247ac9 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
@@ -86,7 +86,15 @@ bool NGLineBreaker::NextLine(NGLineInfo* line_info,
// measuring. Need to decide which one works the best.
SkipCollapsibleWhitespaces();
- return !line_info->Results().IsEmpty();
+ if (line_info->Results().IsEmpty())
+ return false;
+
+ // TODO(kojii): There are cases where we need to PlaceItems() without creating
+ // line boxes. These cases need to be reviewed.
+ if (should_create_line_box_)
+ ComputeLineLocation(line_info);
+
+ return true;
}
void NGLineBreaker::BreakLine(NGLineInfo* line_info) {
@@ -104,7 +112,7 @@ void NGLineBreaker::BreakLine(NGLineInfo* line_info) {
if (container_builder_->BfcOffset())
UpdateAvailableWidth();
else
- available_width_.reset();
+ opportunity_.reset();
while (item_index_ < items.size()) {
// CloseTag prohibits to break before.
@@ -160,8 +168,17 @@ void NGLineBreaker::UpdateAvailableWidth() {
NGLayoutOpportunityIterator iter(constraint_space_->Exclusions().get(),
constraint_space_->AvailableSize(), offset);
- NGLayoutOpportunity opportunity = iter.Next();
- available_width_ = opportunity.InlineSize();
+ opportunity_ = iter.Next();
+}
+
+void NGLineBreaker::ComputeLineLocation(NGLineInfo* line_info) const {
+ // Both NGLayoutOpportunity and BfcOffset are in visual order that
+ // "inline-start" are actually "line-left".
+ // https://drafts.csswg.org/css-writing-modes-3/#line-left
+ LayoutUnit line_left = opportunity_.value().InlineStartOffset() -
+ constraint_space_->BfcOffset().inline_offset;
+ line_info->SetLineLocation(line_left, AvailableWidth(),
+ content_offset_.block_offset);
}
NGLineBreaker::LineBreakState NGLineBreaker::HandleText(
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698