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

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

Issue 2365083002: Make NGFragment to own NGPhysicalFragment (Closed)
Patch Set: Created 4 years, 2 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/ng_fragment_builder.h" 5 #include "core/layout/ng/ng_fragment_builder.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 NGFragmentBuilder::NGFragmentBuilder( 9 NGFragmentBuilder::NGFragmentBuilder(
10 NGPhysicalFragmentBase::NGFragmentType type) 10 NGPhysicalFragmentBase::NGFragmentType type)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 margin_strut_.negative_margin_block_end = from.negative_margin_block_end; 65 margin_strut_.negative_margin_block_end = from.negative_margin_block_end;
66 return *this; 66 return *this;
67 } 67 }
68 68
69 NGPhysicalFragment* NGFragmentBuilder::ToFragment() { 69 NGPhysicalFragment* NGFragmentBuilder::ToFragment() {
70 // TODO(layout-ng): Support text fragments 70 // TODO(layout-ng): Support text fragments
71 DCHECK_EQ(type_, NGPhysicalFragmentBase::FragmentBox); 71 DCHECK_EQ(type_, NGPhysicalFragmentBase::FragmentBox);
72 DCHECK_EQ(offsets_.size(), children_.size()); 72 DCHECK_EQ(offsets_.size(), children_.size());
73 73
74 NGPhysicalSize physical_size = size_.ConvertToPhysical(writing_mode_); 74 NGPhysicalSize physical_size = size_.ConvertToPhysical(writing_mode_);
75 HeapVector<Member<const NGPhysicalFragmentBase>> children; 75 Vector<const NGPhysicalFragmentBase*> children;
76 children.reserveCapacity(children_.size()); 76 children.reserveCapacity(children_.size());
77 77
78 for (size_t i = 0; i < children_.size(); ++i) { 78 for (size_t i = 0; i < children_.size(); ++i) {
79 NGPhysicalFragmentBase* child = children_[i].get(); 79 NGPhysicalFragmentBase* child = children_[i];
80 child->SetOffset(offsets_[i].ConvertToPhysical( 80 child->SetOffset(offsets_[i].ConvertToPhysical(
81 writing_mode_, direction_, physical_size, child->Size())); 81 writing_mode_, direction_, physical_size, child->Size()));
82 children.append(child); 82 children.append(child);
83 } 83 }
84 return new NGPhysicalFragment(physical_size, 84 return new NGPhysicalFragment(physical_size,
85 overflow_.ConvertToPhysical(writing_mode_), 85 overflow_.ConvertToPhysical(writing_mode_),
86 children, margin_strut_); 86 children, margin_strut_);
87 } 87 }
88 88
89 } // namespace blink 89 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698