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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_fragment_base.h

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 #ifndef NGFragmentBase_h 5 #ifndef NGFragmentBase_h
6 #define NGFragmentBase_h 6 #define NGFragmentBase_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_physical_constraint_space.h" 9 #include "core/layout/ng/ng_physical_constraint_space.h"
10 #include "core/layout/ng/ng_writing_mode.h" 10 #include "core/layout/ng/ng_writing_mode.h"
11 #include "core/layout/ng/ng_units.h" 11 #include "core/layout/ng/ng_units.h"
12 #include "platform/LayoutUnit.h" 12 #include "platform/LayoutUnit.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 #include "wtf/Vector.h" 14 #include "wtf/Vector.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class NGPhysicalFragmentBase; 18 class NGPhysicalFragmentBase;
19 19
20 class CORE_EXPORT NGFragmentBase : public GarbageCollected<NGFragmentBase> { 20 class CORE_EXPORT NGFragmentBase
21 : public GarbageCollectedFinalized<NGFragmentBase> {
21 public: 22 public:
22 NGWritingMode WritingMode() const { 23 NGWritingMode WritingMode() const {
23 return static_cast<NGWritingMode>(writing_mode_); 24 return static_cast<NGWritingMode>(writing_mode_);
24 } 25 }
25 NGDirection Direction() const { return static_cast<NGDirection>(direction_); } 26 NGDirection Direction() const { return static_cast<NGDirection>(direction_); }
26 27
27 // Returns the border-box size. 28 // Returns the border-box size.
28 LayoutUnit InlineSize() const; 29 LayoutUnit InlineSize() const;
29 LayoutUnit BlockSize() const; 30 LayoutUnit BlockSize() const;
30 31
31 // Returns the total size, including the contents outside of the border-box. 32 // Returns the total size, including the contents outside of the border-box.
32 LayoutUnit InlineOverflow() const; 33 LayoutUnit InlineOverflow() const;
33 LayoutUnit BlockOverflow() const; 34 LayoutUnit BlockOverflow() const;
34 35
35 // Returns the offset relative to the parent fragement's content-box. 36 // Returns the offset relative to the parent fragement's content-box.
36 LayoutUnit InlineOffset() const; 37 LayoutUnit InlineOffset() const;
37 LayoutUnit BlockOffset() const; 38 LayoutUnit BlockOffset() const;
38 39
39 NGMarginStrut MarginStrut() const; 40 NGMarginStrut MarginStrut() const;
40 41
41 NGPhysicalFragmentBase* PhysicalFragment() const { 42 NGPhysicalFragmentBase* PhysicalFragment() const {
42 return physical_fragment_; 43 return physical_fragment_.get();
43 }; 44 };
44 45
45 DECLARE_TRACE(); 46 DEFINE_INLINE_TRACE(){};
46 47
47 protected: 48 protected:
48 NGFragmentBase(NGWritingMode writing_mode, 49 NGFragmentBase(NGWritingMode writing_mode,
49 NGDirection direction, 50 NGDirection direction,
50 NGPhysicalFragmentBase* physical_fragment) 51 NGPhysicalFragmentBase* physical_fragment)
51 : physical_fragment_(physical_fragment), 52 : physical_fragment_(physical_fragment),
52 writing_mode_(writing_mode), 53 writing_mode_(writing_mode),
53 direction_(direction) {} 54 direction_(direction) {}
54 55
55 Member<NGPhysicalFragmentBase> physical_fragment_; 56 std::unique_ptr<NGPhysicalFragmentBase> physical_fragment_;
56 57
57 unsigned writing_mode_ : 3; 58 unsigned writing_mode_ : 3;
58 unsigned direction_ : 1; 59 unsigned direction_ : 1;
59 }; 60 };
60 61
61 } // namespace blink 62 } // namespace blink
62 63
63 #endif // NGFragmentBase_h 64 #endif // NGFragmentBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698