| 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_fragment_builder.h" | 5 #include "core/layout/ng/ng_fragment_builder.h" |
| 6 | 6 |
| 7 #include "core/layout/ng/inline/ng_physical_text_fragment.h" | 7 #include "core/layout/ng/inline/ng_physical_text_fragment.h" |
| 8 #include "core/layout/ng/ng_block_break_token.h" | 8 #include "core/layout/ng/ng_block_break_token.h" |
| 9 #include "core/layout/ng/ng_block_node.h" | 9 #include "core/layout/ng/ng_block_node.h" |
| 10 #include "core/layout/ng/ng_break_token.h" | 10 #include "core/layout/ng/ng_break_token.h" |
| 11 #include "core/layout/ng/ng_fragment.h" | 11 #include "core/layout/ng/ng_fragment.h" |
| 12 #include "core/layout/ng/ng_layout_result.h" | 12 #include "core/layout/ng/ng_layout_result.h" |
| 13 #include "core/layout/ng/ng_physical_box_fragment.h" | 13 #include "core/layout/ng/ng_physical_box_fragment.h" |
| 14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 // TODO(ikilpatrick): Make writing mode and direction be in the constructor. | 18 // TODO(ikilpatrick): Make writing mode and direction be in the constructor. |
| 19 NGFragmentBuilder::NGFragmentBuilder(NGPhysicalFragment::NGFragmentType type, | 19 NGFragmentBuilder::NGFragmentBuilder(NGPhysicalFragment::NGFragmentType type, |
| 20 NGLayoutInputNode* node) | 20 NGLayoutInputNode* node) |
| 21 : type_(type), | 21 : type_(type), |
| 22 writing_mode_(kHorizontalTopBottom), | 22 writing_mode_(kHorizontalTopBottom), |
| 23 direction_(TextDirection::kLtr), | 23 direction_(TextDirection::kLtr), |
| 24 node_(node), | 24 node_(node), |
| 25 layout_object_(node->GetLayoutObject()), | 25 layout_object_(node->GetLayoutObject()), |
| 26 did_break_(false) {} | 26 did_break_(false), |
| 27 border_edges_(NGBorderEdges::kAll) {} |
| 27 | 28 |
| 28 NGFragmentBuilder::NGFragmentBuilder(NGPhysicalFragment::NGFragmentType type, | 29 NGFragmentBuilder::NGFragmentBuilder(NGPhysicalFragment::NGFragmentType type, |
| 29 LayoutObject* layout_object) | 30 LayoutObject* layout_object) |
| 30 : type_(type), | 31 : type_(type), |
| 31 writing_mode_(kHorizontalTopBottom), | 32 writing_mode_(kHorizontalTopBottom), |
| 32 direction_(TextDirection::kLtr), | 33 direction_(TextDirection::kLtr), |
| 33 layout_object_(layout_object), | 34 layout_object_(layout_object), |
| 34 did_break_(false) {} | 35 did_break_(false) {} |
| 35 | 36 |
| 36 NGFragmentBuilder& NGFragmentBuilder::SetWritingMode( | 37 NGFragmentBuilder& NGFragmentBuilder::SetWritingMode( |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 NGPhysicalFragment* floating_fragment = positioned_float.fragment.Get(); | 222 NGPhysicalFragment* floating_fragment = positioned_float.fragment.Get(); |
| 222 floating_fragment->SetOffset( | 223 floating_fragment->SetOffset( |
| 223 positioned_float.logical_offset.ConvertToPhysical( | 224 positioned_float.logical_offset.ConvertToPhysical( |
| 224 writing_mode_, direction_, physical_size, | 225 writing_mode_, direction_, physical_size, |
| 225 floating_fragment->Size())); | 226 floating_fragment->Size())); |
| 226 } | 227 } |
| 227 | 228 |
| 228 RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment( | 229 RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment( |
| 229 layout_object_, physical_size, overflow_.ConvertToPhysical(writing_mode_), | 230 layout_object_, physical_size, overflow_.ConvertToPhysical(writing_mode_), |
| 230 children_, positioned_floats_, bfc_offset_, end_margin_strut_, | 231 children_, positioned_floats_, bfc_offset_, end_margin_strut_, |
| 232 NGBorderEdges::ToPhysical(border_edges_, writing_mode_), |
| 231 std::move(break_token))); | 233 std::move(break_token))); |
| 232 | 234 |
| 233 return AdoptRef( | 235 return AdoptRef( |
| 234 new NGLayoutResult(std::move(fragment), out_of_flow_descendants_, | 236 new NGLayoutResult(std::move(fragment), out_of_flow_descendants_, |
| 235 out_of_flow_positions_, unpositioned_floats_)); | 237 out_of_flow_positions_, unpositioned_floats_)); |
| 236 } | 238 } |
| 237 | 239 |
| 238 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |