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 |
31 // Returns the border-box size. | 34 // Returns the border-box size. |
32 LayoutUnit InlineSize() const; | 35 LayoutUnit InlineSize() const; |
33 LayoutUnit BlockSize() const; | 36 LayoutUnit BlockSize() const; |
34 NGLogicalSize Size() const; | 37 NGLogicalSize Size() const; |
35 | 38 |
36 // Returns the offset relative to the parent fragment's content-box. | 39 // Returns the offset relative to the parent fragment's content-box. |
37 LayoutUnit InlineOffset() const; | 40 LayoutUnit InlineOffset() const; |
38 LayoutUnit BlockOffset() const; | 41 LayoutUnit BlockOffset() const; |
39 NGLogicalOffset Offset() const; | 42 NGLogicalOffset Offset() const; |
40 | 43 |
41 NGBorderEdges BorderEdges() const; | 44 NGBorderEdges BorderEdges() const; |
42 | 45 |
43 NGPhysicalFragment::NGFragmentType Type() const; | 46 NGPhysicalFragment::NGFragmentType Type() const; |
44 | 47 |
45 protected: | 48 protected: |
46 const NGPhysicalFragment* physical_fragment_; | 49 const NGPhysicalFragment* physical_fragment_; |
47 | 50 |
48 unsigned writing_mode_ : 3; | 51 unsigned writing_mode_ : 3; |
49 }; | 52 }; |
50 | 53 |
51 } // namespace blink | 54 } // namespace blink |
52 | 55 |
53 #endif // NGFragment_h | 56 #endif // NGFragment_h |
OLD | NEW |