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

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

Issue 2764753007: [LayoutNG] Add NGLineBoxFragment (Closed)
Patch Set: Rebase again as other CLs landed faster Created 3 years, 9 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_physical_fragment.h" 5 #include "core/layout/ng/ng_physical_fragment.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_physical_box_fragment.h" 8 #include "core/layout/ng/ng_physical_box_fragment.h"
9 #include "core/layout/ng/ng_physical_line_box_fragment.h"
9 #include "core/layout/ng/ng_physical_text_fragment.h" 10 #include "core/layout/ng/ng_physical_text_fragment.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 NGPhysicalFragment::NGPhysicalFragment(LayoutObject* layout_object, 14 NGPhysicalFragment::NGPhysicalFragment(LayoutObject* layout_object,
14 NGPhysicalSize size, 15 NGPhysicalSize size,
15 NGPhysicalSize overflow,
16 NGFragmentType type, 16 NGFragmentType type,
17 RefPtr<NGBreakToken> break_token) 17 RefPtr<NGBreakToken> break_token)
18 : layout_object_(layout_object), 18 : layout_object_(layout_object),
19 size_(size), 19 size_(size),
20 overflow_(overflow),
21 break_token_(std::move(break_token)), 20 break_token_(std::move(break_token)),
22 type_(type), 21 type_(type),
23 is_placed_(false) {} 22 is_placed_(false) {}
24 23
25 void NGPhysicalFragment::destroy() const { 24 void NGPhysicalFragment::destroy() const {
26 if (Type() == kFragmentText) 25 switch (Type()) {
27 delete static_cast<const NGPhysicalTextFragment*>(this); 26 case kFragmentBox:
28 else 27 delete static_cast<const NGPhysicalBoxFragment*>(this);
29 delete static_cast<const NGPhysicalBoxFragment*>(this); 28 break;
29 case kFragmentText:
30 delete static_cast<const NGPhysicalTextFragment*>(this);
31 break;
32 case kFragmentLineBox:
33 delete static_cast<const NGPhysicalLineBoxFragment*>(this);
34 break;
35 default:
36 NOTREACHED();
37 break;
38 }
30 } 39 }
31 40
32 const ComputedStyle& NGPhysicalFragment::Style() const { 41 const ComputedStyle& NGPhysicalFragment::Style() const {
33 DCHECK(layout_object_); 42 DCHECK(layout_object_);
34 return layout_object_->styleRef(); 43 return layout_object_->styleRef();
35 } 44 }
36 45
37 String NGPhysicalFragment::ToString() const { 46 String NGPhysicalFragment::ToString() const {
38 return String::format("Type: '%d' Size: '%s' Offset: '%s' Placed: '%d'", 47 return String::format("Type: '%d' Size: '%s' Offset: '%s' Placed: '%d'",
39 Type(), Size().ToString().ascii().data(), 48 Type(), Size().ToString().ascii().data(),
40 Offset().ToString().ascii().data(), IsPlaced()); 49 Offset().ToString().ascii().data(), IsPlaced());
41 } 50 }
42 51
43 } // namespace blink 52 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698