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 #ifndef NGFragment_h | 5 #ifndef NGFragment_h |
6 #define NGFragment_h | 6 #define NGFragment_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/geometry/ng_logical_offset.h" | 9 #include "core/layout/ng/geometry/ng_logical_offset.h" |
10 #include "core/layout/ng/ng_physical_fragment.h" | 10 #include "core/layout/ng/ng_physical_fragment.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 public: | 22 public: |
23 NGFragment(NGWritingMode writing_mode, | 23 NGFragment(NGWritingMode writing_mode, |
24 const NGPhysicalFragment* physical_fragment) | 24 const NGPhysicalFragment* physical_fragment) |
25 : physical_fragment_(physical_fragment), writing_mode_(writing_mode) {} | 25 : physical_fragment_(physical_fragment), writing_mode_(writing_mode) {} |
26 | 26 |
27 NGWritingMode WritingMode() const { | 27 NGWritingMode WritingMode() const { |
28 return static_cast<NGWritingMode>(writing_mode_); | 28 return static_cast<NGWritingMode>(writing_mode_); |
29 } | 29 } |
30 | 30 |
31 // TODO(ikilpatrick): Remove once block layout algorithm refactoring complete. | |
32 explicit operator bool() { return physical_fragment_ != nullptr; } | |
33 | |
34 // Returns the border-box size. | 31 // Returns the border-box size. |
35 LayoutUnit InlineSize() const; | 32 LayoutUnit InlineSize() const; |
36 LayoutUnit BlockSize() const; | 33 LayoutUnit BlockSize() const; |
37 NGLogicalSize Size() const; | 34 NGLogicalSize Size() const; |
38 | 35 |
39 // Returns the offset relative to the parent fragment's content-box. | 36 // Returns the offset relative to the parent fragment's content-box. |
40 LayoutUnit InlineOffset() const; | 37 LayoutUnit InlineOffset() const; |
41 LayoutUnit BlockOffset() const; | 38 LayoutUnit BlockOffset() const; |
42 NGLogicalOffset Offset() const; | 39 NGLogicalOffset Offset() const; |
43 | 40 |
44 NGBorderEdges BorderEdges() const; | 41 NGBorderEdges BorderEdges() const; |
45 | 42 |
46 NGPhysicalFragment::NGFragmentType Type() const; | 43 NGPhysicalFragment::NGFragmentType Type() const; |
47 | 44 |
48 protected: | 45 protected: |
49 const NGPhysicalFragment* physical_fragment_; | 46 const NGPhysicalFragment* physical_fragment_; |
50 | 47 |
51 unsigned writing_mode_ : 3; | 48 unsigned writing_mode_ : 3; |
52 }; | 49 }; |
53 | 50 |
54 } // namespace blink | 51 } // namespace blink |
55 | 52 |
56 #endif // NGFragment_h | 53 #endif // NGFragment_h |
OLD | NEW |