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_units.h" | 5 #include "core/layout/ng/ng_units.h" |
6 | 6 |
7 #include "core/layout/ng/ng_writing_mode.h" | 7 #include "core/layout/ng/ng_writing_mode.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 | 220 |
221 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 221 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
222 return std::tie(other.margin_block_start, other.margin_block_end, | 222 return std::tie(other.margin_block_start, other.margin_block_end, |
223 other.negative_margin_block_start, | 223 other.negative_margin_block_start, |
224 other.negative_margin_block_end) == | 224 other.negative_margin_block_end) == |
225 std::tie(margin_block_start, margin_block_end, | 225 std::tie(margin_block_start, margin_block_end, |
226 negative_margin_block_start, negative_margin_block_end); | 226 negative_margin_block_start, negative_margin_block_end); |
227 } | 227 } |
228 | 228 |
| 229 NGCorner NGCorner::Create(NGWritingMode writing_mode, |
| 230 TextDirection direction, |
| 231 NGPhysicalOffset offset) { |
| 232 NGCorner c; |
| 233 c.offset = offset; |
| 234 switch (writing_mode) { |
| 235 case kHorizontalTopBottom: |
| 236 c.type = (direction == LTR) ? kTopLeft : kTopRight; |
| 237 break; |
| 238 case kVerticalRightLeft: |
| 239 case kSidewaysRightLeft: |
| 240 c.type = (direction == LTR) ? kTopRight : kBottomRight; |
| 241 break; |
| 242 case kVerticalLeftRight: |
| 243 c.type = (direction == LTR) ? kTopLeft : kBottomLeft; |
| 244 break; |
| 245 case kSidewaysLeftRight: |
| 246 c.type = (direction == LTR) ? kBottomLeft : kTopLeft; |
| 247 break; |
| 248 } |
| 249 return c; |
| 250 } |
| 251 |
229 } // namespace blink | 252 } // namespace blink |
OLD | NEW |