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(LayoutUnit inlineSize, | 11 NGFragmentBase::NGFragmentBase(NGLogicalSize size, |
12 LayoutUnit blockSize, | 12 NGLogicalSize overflow, |
13 LayoutUnit inlineOverflow, | 13 NGWritingMode writing_mode, |
14 LayoutUnit blockOverflow, | |
15 NGWritingMode writingMode, | |
16 NGDirection direction, | 14 NGDirection direction, |
17 NGFragmentType type) | 15 NGFragmentType type) |
18 : m_inlineSize(inlineSize), | 16 : size_(size), |
19 m_blockSize(blockSize), | 17 overflow_(overflow), |
20 m_inlineOverflow(inlineOverflow), | 18 type_(type), |
21 m_blockOverflow(blockOverflow), | 19 writing_mode_(writing_mode), |
22 m_type(type), | 20 direction_(direction), |
23 m_writingMode(writingMode), | 21 has_been_placed_(false) {} |
24 m_direction(direction), | |
25 m_hasBeenPlaced(false) {} | |
26 | 22 |
27 void NGFragmentBase::setOffset(LayoutUnit inlineOffset, | 23 void NGFragmentBase::SetOffset(LayoutUnit inline_offset, |
28 LayoutUnit blockOffset) { | 24 LayoutUnit block_offset) { |
29 // setOffset should only be called once. | 25 // setOffset should only be called once. |
30 DCHECK(!m_hasBeenPlaced); | 26 DCHECK(!has_been_placed_); |
31 m_inlineOffset = inlineOffset; | 27 offset_.inlineOffset = inline_offset; |
32 m_blockOffset = blockOffset; | 28 offset_.blockOffset = block_offset; |
33 m_hasBeenPlaced = true; | 29 has_been_placed_ = true; |
34 } | 30 } |
35 | 31 |
36 DEFINE_TRACE(NGFragmentBase) { | 32 DEFINE_TRACE(NGFragmentBase) { |
37 if (type() == FragmentText) | 33 if (Type() == FragmentText) |
38 static_cast<NGTextFragment*>(this)->traceAfterDispatch(visitor); | 34 static_cast<NGTextFragment*>(this)->traceAfterDispatch(visitor); |
39 else | 35 else |
40 static_cast<NGFragment*>(this)->traceAfterDispatch(visitor); | 36 static_cast<NGFragment*>(this)->traceAfterDispatch(visitor); |
41 } | 37 } |
42 | 38 |
43 } // namespace blink | 39 } // namespace blink |
OLD | NEW |