OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "core/layout/ng/geometry/ng_static_position.h" | |
6 | |
7 namespace blink { | |
8 | |
9 NGStaticPosition NGStaticPosition::Create(NGWritingMode writing_mode, | |
10 TextDirection direction, | |
11 NGPhysicalOffset offset) { | |
12 NGStaticPosition position; | |
13 position.offset = offset; | |
14 switch (writing_mode) { | |
15 case kHorizontalTopBottom: | |
16 position.type = (direction == TextDirection::kLtr) ? kTopLeft : kTopRight; | |
17 break; | |
18 case kVerticalRightLeft: | |
19 case kSidewaysRightLeft: | |
20 position.type = | |
21 (direction == TextDirection::kLtr) ? kTopRight : kBottomRight; | |
22 break; | |
23 case kVerticalLeftRight: | |
24 position.type = | |
25 (direction == TextDirection::kLtr) ? kTopLeft : kBottomLeft; | |
26 break; | |
27 case kSidewaysLeftRight: | |
28 position.type = | |
29 (direction == TextDirection::kLtr) ? kBottomLeft : kTopLeft; | |
30 break; | |
31 } | |
32 return position; | |
33 } | |
34 | |
35 } // namespace blink | |
OLD | NEW |