OLD | NEW |
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/ng_block_layout_algorithm.h" | 5 #include "core/layout/ng/ng_block_layout_algorithm.h" |
6 | 6 |
7 #include "core/layout/ng/ng_break_token.h" | 7 #include "core/layout/ng/ng_break_token.h" |
8 #include "core/layout/ng/ng_constraint_space.h" | 8 #include "core/layout/ng/ng_constraint_space.h" |
9 #include "core/layout/ng/ng_constraint_space_builder.h" | 9 #include "core/layout/ng/ng_constraint_space_builder.h" |
10 #include "core/layout/ng/ng_fragment_builder.h" | 10 #include "core/layout/ng/ng_fragment_builder.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 &offset.block_offset); | 498 &offset.block_offset); |
499 space_for_current_child_->SetOffset(offset); | 499 space_for_current_child_->SetOffset(offset); |
500 | 500 |
501 const NGLayoutOpportunity opportunity = FindLayoutOpportunityForFragment( | 501 const NGLayoutOpportunity opportunity = FindLayoutOpportunityForFragment( |
502 space_for_current_child_, fragment, margins); | 502 space_for_current_child_, fragment, margins); |
503 DCHECK(!opportunity.IsEmpty()) << "Opportunity is empty but it shouldn't be"; | 503 DCHECK(!opportunity.IsEmpty()) << "Opportunity is empty but it shouldn't be"; |
504 | 504 |
505 NGExclusion::Type exclusion_type = NGExclusion::kFloatLeft; | 505 NGExclusion::Type exclusion_type = NGExclusion::kFloatLeft; |
506 // Calculate the float offset if needed. | 506 // Calculate the float offset if needed. |
507 LayoutUnit float_offset; | 507 LayoutUnit float_offset; |
508 if (CurrentChildStyle().floating() == EFloat::Right) { | 508 if (CurrentChildStyle().floating() == EFloat::kRight) { |
509 float_offset = opportunity.size.inline_size - fragment.InlineSize(); | 509 float_offset = opportunity.size.inline_size - fragment.InlineSize(); |
510 exclusion_type = NGExclusion::kFloatRight; | 510 exclusion_type = NGExclusion::kFloatRight; |
511 } | 511 } |
512 | 512 |
513 // Add the float as an exclusion. | 513 // Add the float as an exclusion. |
514 const NGExclusion exclusion = CreateExclusion( | 514 const NGExclusion exclusion = CreateExclusion( |
515 fragment, opportunity, float_offset, margins, exclusion_type); | 515 fragment, opportunity, float_offset, margins, exclusion_type); |
516 constraint_space_->AddExclusion(exclusion); | 516 constraint_space_->AddExclusion(exclusion); |
517 | 517 |
518 return CalculateLogicalOffsetForOpportunity(opportunity, float_offset, | 518 return CalculateLogicalOffsetForOpportunity(opportunity, float_offset, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 visitor->trace(builder_); | 559 visitor->trace(builder_); |
560 visitor->trace(space_builder_); | 560 visitor->trace(space_builder_); |
561 visitor->trace(space_for_current_child_); | 561 visitor->trace(space_for_current_child_); |
562 visitor->trace(current_child_); | 562 visitor->trace(current_child_); |
563 visitor->trace(current_minmax_child_); | 563 visitor->trace(current_minmax_child_); |
564 visitor->trace(out_of_flow_layout_); | 564 visitor->trace(out_of_flow_layout_); |
565 visitor->trace(out_of_flow_candidates_); | 565 visitor->trace(out_of_flow_candidates_); |
566 } | 566 } |
567 | 567 |
568 } // namespace blink | 568 } // namespace blink |
OLD | NEW |