OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 NGBorderEdges_h | 5 #ifndef NGBorderEdges_h |
6 #define NGBorderEdges_h | 6 #define NGBorderEdges_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_writing_mode.h" | 9 #include "core/layout/ng/ng_writing_mode.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 namespace NGBorderEdges { | |
14 | |
15 // Which border edges should be painted. Due to fragmentation one or more may | 13 // Which border edges should be painted. Due to fragmentation one or more may |
16 // be skipped. | 14 // be skipped. |
17 enum Physical { kTop = 1, kRight = 2, kBottom = 4, kLeft = 8 }; | 15 struct CORE_EXPORT NGBorderEdges { |
| 16 unsigned block_start : 1; |
| 17 unsigned line_right : 1; |
| 18 unsigned block_end : 1; |
| 19 unsigned line_left : 1; |
18 | 20 |
19 enum Logical { | 21 NGBorderEdges() |
20 kBlockStart = Physical::kTop, | 22 : block_start(true), line_right(true), block_end(true), line_left(true) {} |
21 kLineRight = Physical::kRight, | 23 NGBorderEdges(bool block_start, |
22 kBlockEnd = Physical::kBottom, | 24 bool line_right, |
23 kLineLeft = Physical::kLeft, | 25 bool block_end, |
24 kAll = kBlockStart | kLineRight | kBlockEnd | kLineLeft | 26 bool line_left) |
| 27 : block_start(block_start), |
| 28 line_right(line_right), |
| 29 block_end(block_end), |
| 30 line_left(line_left) {} |
| 31 |
| 32 enum Physical { |
| 33 kTop = 1, |
| 34 kRight = 2, |
| 35 kBottom = 4, |
| 36 kLeft = 8, |
| 37 kAll = kTop | kRight | kBottom | kLeft |
| 38 }; |
| 39 static NGBorderEdges FromPhysical(unsigned, NGWritingMode); |
| 40 unsigned ToPhysical(NGWritingMode) const; |
25 }; | 41 }; |
26 | 42 |
27 CORE_EXPORT Physical ToPhysical(Logical, NGWritingMode); | |
28 CORE_EXPORT Logical ToLogical(Physical, NGWritingMode); | |
29 | |
30 } // namespace NGBorderEdges | |
31 | |
32 } // namespace blink | 43 } // namespace blink |
33 | 44 |
34 #endif // NGBorderEdges_h | 45 #endif // NGBorderEdges_h |
OLD | NEW |