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.h" | 5 #include "core/layout/ng/ng_fragment.h" |
6 | 6 |
7 #include "core/layout/ng/ng_macros.h" | |
8 #include "core/layout/ng/ng_physical_fragment.h" | |
9 | |
10 namespace blink { | 7 namespace blink { |
11 | 8 |
12 NGMarginStrut NGFragment::MarginStrut() const { | 9 LayoutUnit NGFragment::InlineSize() const { |
13 WRITING_MODE_IGNORED( | 10 return writing_mode_ == kHorizontalTopBottom ? physical_fragment_->Width() |
14 "Accessing the margin strut is fine here. Changing the writing mode" | 11 : physical_fragment_->Height(); |
15 "establishes a new formatting context, for which a margin strut is never" | 12 } |
16 "set for a fragment."); | 13 |
17 return toNGPhysicalFragment(physical_fragment_)->MarginStrut(); | 14 LayoutUnit NGFragment::BlockSize() const { |
| 15 return writing_mode_ == kHorizontalTopBottom ? physical_fragment_->Height() |
| 16 : physical_fragment_->Width(); |
| 17 } |
| 18 |
| 19 LayoutUnit NGFragment::InlineOverflow() const { |
| 20 return writing_mode_ == kHorizontalTopBottom |
| 21 ? physical_fragment_->WidthOverflow() |
| 22 : physical_fragment_->HeightOverflow(); |
| 23 } |
| 24 |
| 25 LayoutUnit NGFragment::BlockOverflow() const { |
| 26 return writing_mode_ == kHorizontalTopBottom |
| 27 ? physical_fragment_->HeightOverflow() |
| 28 : physical_fragment_->WidthOverflow(); |
| 29 } |
| 30 |
| 31 LayoutUnit NGFragment::InlineOffset() const { |
| 32 return writing_mode_ == kHorizontalTopBottom |
| 33 ? physical_fragment_->LeftOffset() |
| 34 : physical_fragment_->TopOffset(); |
| 35 } |
| 36 |
| 37 LayoutUnit NGFragment::BlockOffset() const { |
| 38 return writing_mode_ == kHorizontalTopBottom |
| 39 ? physical_fragment_->TopOffset() |
| 40 : physical_fragment_->LeftOffset(); |
| 41 } |
| 42 |
| 43 NGPhysicalFragment::NGFragmentType NGFragment::Type() const { |
| 44 return physical_fragment_->Type(); |
| 45 } |
| 46 |
| 47 DEFINE_TRACE(NGFragment) { |
| 48 visitor->trace(physical_fragment_); |
18 } | 49 } |
19 | 50 |
20 } // namespace blink | 51 } // namespace blink |
OLD | NEW |