OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, Google Inc. All rights reserved. | 2 * Copyright (c) 2012, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 LayoutUnit LayoutRectOutsets::Before(WritingMode writing_mode) const { | 69 LayoutUnit LayoutRectOutsets::Before(WritingMode writing_mode) const { |
70 switch (writing_mode) { | 70 switch (writing_mode) { |
71 case WritingMode::kHorizontalTb: | 71 case WritingMode::kHorizontalTb: |
72 return top_; | 72 return top_; |
73 case WritingMode::kVerticalLr: | 73 case WritingMode::kVerticalLr: |
74 return left_; | 74 return left_; |
75 case WritingMode::kVerticalRl: | 75 case WritingMode::kVerticalRl: |
76 return right_; | 76 return right_; |
77 } | 77 } |
78 ASSERT_NOT_REACHED(); | 78 NOTREACHED(); |
79 return top_; | 79 return top_; |
80 } | 80 } |
81 | 81 |
82 LayoutUnit LayoutRectOutsets::After(WritingMode writing_mode) const { | 82 LayoutUnit LayoutRectOutsets::After(WritingMode writing_mode) const { |
83 switch (writing_mode) { | 83 switch (writing_mode) { |
84 case WritingMode::kHorizontalTb: | 84 case WritingMode::kHorizontalTb: |
85 return bottom_; | 85 return bottom_; |
86 case WritingMode::kVerticalLr: | 86 case WritingMode::kVerticalLr: |
87 return right_; | 87 return right_; |
88 case WritingMode::kVerticalRl: | 88 case WritingMode::kVerticalRl: |
89 return left_; | 89 return left_; |
90 } | 90 } |
91 ASSERT_NOT_REACHED(); | 91 NOTREACHED(); |
92 return bottom_; | 92 return bottom_; |
93 } | 93 } |
94 | 94 |
95 LayoutUnit LayoutRectOutsets::Start(WritingMode writing_mode, | 95 LayoutUnit LayoutRectOutsets::Start(WritingMode writing_mode, |
96 TextDirection direction) const { | 96 TextDirection direction) const { |
97 if (IsHorizontalWritingMode(writing_mode)) | 97 if (IsHorizontalWritingMode(writing_mode)) |
98 return IsLeftToRightDirection(direction) ? left_ : right_; | 98 return IsLeftToRightDirection(direction) ? left_ : right_; |
99 return IsLeftToRightDirection(direction) ? top_ : bottom_; | 99 return IsLeftToRightDirection(direction) ? top_ : bottom_; |
100 } | 100 } |
101 | 101 |
(...skipping 17 matching lines...) Expand all Loading... |
119 case WritingMode::kHorizontalTb: | 119 case WritingMode::kHorizontalTb: |
120 top_ = value; | 120 top_ = value; |
121 break; | 121 break; |
122 case WritingMode::kVerticalLr: | 122 case WritingMode::kVerticalLr: |
123 left_ = value; | 123 left_ = value; |
124 break; | 124 break; |
125 case WritingMode::kVerticalRl: | 125 case WritingMode::kVerticalRl: |
126 right_ = value; | 126 right_ = value; |
127 break; | 127 break; |
128 default: | 128 default: |
129 ASSERT_NOT_REACHED(); | 129 NOTREACHED(); |
130 top_ = value; | 130 top_ = value; |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 void LayoutRectOutsets::SetAfter(WritingMode writing_mode, LayoutUnit value) { | 134 void LayoutRectOutsets::SetAfter(WritingMode writing_mode, LayoutUnit value) { |
135 switch (writing_mode) { | 135 switch (writing_mode) { |
136 case WritingMode::kHorizontalTb: | 136 case WritingMode::kHorizontalTb: |
137 bottom_ = value; | 137 bottom_ = value; |
138 break; | 138 break; |
139 case WritingMode::kVerticalLr: | 139 case WritingMode::kVerticalLr: |
140 right_ = value; | 140 right_ = value; |
141 break; | 141 break; |
142 case WritingMode::kVerticalRl: | 142 case WritingMode::kVerticalRl: |
143 left_ = value; | 143 left_ = value; |
144 break; | 144 break; |
145 default: | 145 default: |
146 ASSERT_NOT_REACHED(); | 146 NOTREACHED(); |
147 bottom_ = value; | 147 bottom_ = value; |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 void LayoutRectOutsets::SetStart(WritingMode writing_mode, | 151 void LayoutRectOutsets::SetStart(WritingMode writing_mode, |
152 TextDirection direction, | 152 TextDirection direction, |
153 LayoutUnit value) { | 153 LayoutUnit value) { |
154 if (IsHorizontalWritingMode(writing_mode)) { | 154 if (IsHorizontalWritingMode(writing_mode)) { |
155 if (IsLeftToRightDirection(direction)) | 155 if (IsLeftToRightDirection(direction)) |
156 left_ = value; | 156 left_ = value; |
(...skipping 17 matching lines...) Expand all Loading... |
174 left_ = value; | 174 left_ = value; |
175 } else { | 175 } else { |
176 if (IsLeftToRightDirection(direction)) | 176 if (IsLeftToRightDirection(direction)) |
177 bottom_ = value; | 177 bottom_ = value; |
178 else | 178 else |
179 top_ = value; | 179 top_ = value; |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 } // namespace blink | 183 } // namespace blink |
OLD | NEW |