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 #include "core/layout/ng/ng_fragment_base.h" | 5 #include "core/layout/ng/ng_fragment_base.h" |
6 #include "core/layout/ng/ng_fragment.h" | 6 #include "core/layout/ng/ng_fragment.h" |
7 #include "core/layout/ng/ng_text_fragment.h" | 7 #include "core/layout/ng/ng_text_fragment.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 NGFragmentBase::NGFragmentBase(NGLogicalSize size, | 11 NGFragmentBase::NGFragmentBase(NGLogicalSize size, |
12 NGLogicalSize overflow, | 12 NGLogicalSize overflow, |
13 NGWritingMode writing_mode, | 13 NGWritingMode writing_mode, |
14 NGDirection direction, | 14 NGDirection direction, |
15 NGFragmentType type) | 15 NGFragmentType type) |
16 : size_(size), | 16 : size_(size), |
17 overflow_(overflow), | 17 overflow_(overflow), |
18 type_(type), | 18 type_(type), |
19 writing_mode_(writing_mode), | 19 writing_mode_(writing_mode), |
20 direction_(direction), | 20 direction_(direction), |
21 has_been_placed_(false) {} | 21 has_been_placed_(false) {} |
22 | 22 |
23 void NGFragmentBase::SetOffset(LayoutUnit inline_offset, | 23 void NGFragmentBase::SetOffset(LayoutUnit inline_offset, |
24 LayoutUnit block_offset) { | 24 LayoutUnit block_offset) { |
25 // setOffset should only be called once. | 25 // setOffset should only be called once. |
26 DCHECK(!has_been_placed_); | 26 DCHECK(!has_been_placed_); |
27 offset_.inlineOffset = inline_offset; | 27 offset_.inline_offset = inline_offset; |
28 offset_.blockOffset = block_offset; | 28 offset_.block_offset = block_offset; |
29 has_been_placed_ = true; | 29 has_been_placed_ = true; |
30 } | 30 } |
31 | 31 |
32 DEFINE_TRACE(NGFragmentBase) { | 32 DEFINE_TRACE(NGFragmentBase) { |
33 if (Type() == FragmentText) | 33 if (Type() == FragmentText) |
34 static_cast<NGTextFragment*>(this)->traceAfterDispatch(visitor); | 34 static_cast<NGTextFragment*>(this)->traceAfterDispatch(visitor); |
35 else | 35 else |
36 static_cast<NGFragment*>(this)->traceAfterDispatch(visitor); | 36 static_cast<NGFragment*>(this)->traceAfterDispatch(visitor); |
37 } | 37 } |
38 | 38 |
39 } // namespace blink | 39 } // namespace blink |
OLD | NEW |