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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc

Issue 2872593003: [LayoutNG] Introduce NGPositionedFloat. (Closed)
Patch Set: address comments. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ng/inline/ng_inline_layout_algorithm.h" 5 #include "core/layout/ng/inline/ng_inline_layout_algorithm.h"
6 6
7 #include "core/layout/ng/inline/ng_bidi_paragraph.h" 7 #include "core/layout/ng/inline/ng_bidi_paragraph.h"
8 #include "core/layout/ng/inline/ng_inline_break_token.h" 8 #include "core/layout/ng/inline/ng_inline_break_token.h"
9 #include "core/layout/ng/inline/ng_inline_node.h" 9 #include "core/layout/ng/inline/ng_inline_node.h"
10 #include "core/layout/ng/inline/ng_line_box_fragment.h" 10 #include "core/layout/ng/inline/ng_line_box_fragment.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 layout_result->PhysicalFragment().Get()); 386 layout_result->PhysicalFragment().Get());
387 387
388 bool float_does_not_fit = end_position + float_fragment.InlineSize() > 388 bool float_does_not_fit = end_position + float_fragment.InlineSize() >
389 current_opportunity_.InlineSize(); 389 current_opportunity_.InlineSize();
390 // Check if we already have a pending float. That's because a float cannot be 390 // Check if we already have a pending float. That's because a float cannot be
391 // higher than any block or floated box generated before. 391 // higher than any block or floated box generated before.
392 if (!container_builder_.UnpositionedFloats().IsEmpty() || 392 if (!container_builder_.UnpositionedFloats().IsEmpty() ||
393 float_does_not_fit) { 393 float_does_not_fit) {
394 container_builder_.AddUnpositionedFloat(floating_object); 394 container_builder_.AddUnpositionedFloat(floating_object);
395 } else { 395 } else {
396 floating_object->logical_offset = 396 container_builder_.MutablePositionedFloats().push_back(
397 PositionFloat(floating_object.Get(), MutableConstraintSpace()); 397 PositionFloat(floating_object.Get(), MutableConstraintSpace()));
398 container_builder_.MutablePositionedFloats().push_back(floating_object);
399 FindNextLayoutOpportunity(); 398 FindNextLayoutOpportunity();
400 } 399 }
401 } 400 }
402 401
403 bool NGInlineLayoutAlgorithm::PlaceItems( 402 bool NGInlineLayoutAlgorithm::PlaceItems(
404 const Vector<LineItemChunk, 32>& line_item_chunks) { 403 const Vector<LineItemChunk, 32>& line_item_chunks) {
405 const Vector<NGInlineItem>& items = Node()->Items(); 404 const Vector<NGInlineItem>& items = Node()->Items();
406 405
407 const ComputedStyle& line_style = LineStyle(); 406 const ComputedStyle& line_style = LineStyle();
408 NGLineHeightMetrics line_metrics(line_style, baseline_type_); 407 NGLineHeightMetrics line_metrics(line_style, baseline_type_);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 593
595 // max-content is the width without any line wrapping. 594 // max-content is the width without any line wrapping.
596 // TODO(kojii): Implement hard breaks (<br> etc.) to break. 595 // TODO(kojii): Implement hard breaks (<br> etc.) to break.
597 for (const auto& item : Node()->Items()) 596 for (const auto& item : Node()->Items())
598 sizes.max_content += InlineSize(item); 597 sizes.max_content += InlineSize(item);
599 598
600 return sizes; 599 return sizes;
601 } 600 }
602 601
603 } // namespace blink 602 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698