Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: third_party/WebKit/Source/platform/geometry/LayoutRectOutsets.cpp

Issue 2925293003: Cleanup TextDirection (Closed)
Patch Set: unsigned to uint8_t Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 case WritingMode::kVerticalRl: 88 case WritingMode::kVerticalRl:
89 return left_; 89 return left_;
90 } 90 }
91 NOTREACHED(); 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 IsLtr(direction) ? left_ : right_;
99 return IsLeftToRightDirection(direction) ? top_ : bottom_; 99 return IsLtr(direction) ? top_ : bottom_;
100 } 100 }
101 101
102 LayoutUnit LayoutRectOutsets::end(WritingMode writing_mode, 102 LayoutUnit LayoutRectOutsets::end(WritingMode writing_mode,
103 TextDirection direction) const { 103 TextDirection direction) const {
104 if (IsHorizontalWritingMode(writing_mode)) 104 if (IsHorizontalWritingMode(writing_mode))
105 return IsLeftToRightDirection(direction) ? right_ : left_; 105 return IsLtr(direction) ? right_ : left_;
106 return IsLeftToRightDirection(direction) ? bottom_ : top_; 106 return IsLtr(direction) ? bottom_ : top_;
107 } 107 }
108 108
109 LayoutUnit LayoutRectOutsets::Over(WritingMode writing_mode) const { 109 LayoutUnit LayoutRectOutsets::Over(WritingMode writing_mode) const {
110 return IsHorizontalWritingMode(writing_mode) ? top_ : right_; 110 return IsHorizontalWritingMode(writing_mode) ? top_ : right_;
111 } 111 }
112 112
113 LayoutUnit LayoutRectOutsets::Under(WritingMode writing_mode) const { 113 LayoutUnit LayoutRectOutsets::Under(WritingMode writing_mode) const {
114 return IsHorizontalWritingMode(writing_mode) ? bottom_ : left_; 114 return IsHorizontalWritingMode(writing_mode) ? bottom_ : left_;
115 } 115 }
116 116
(...skipping 28 matching lines...) Expand all
145 default: 145 default:
146 NOTREACHED(); 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 (IsLtr(direction))
156 left_ = value; 156 left_ = value;
157 else 157 else
158 right_ = value; 158 right_ = value;
159 } else { 159 } else {
160 if (IsLeftToRightDirection(direction)) 160 if (IsLtr(direction))
161 top_ = value; 161 top_ = value;
162 else 162 else
163 bottom_ = value; 163 bottom_ = value;
164 } 164 }
165 } 165 }
166 166
167 void LayoutRectOutsets::SetEnd(WritingMode writing_mode, 167 void LayoutRectOutsets::SetEnd(WritingMode writing_mode,
168 TextDirection direction, 168 TextDirection direction,
169 LayoutUnit value) { 169 LayoutUnit value) {
170 if (IsHorizontalWritingMode(writing_mode)) { 170 if (IsHorizontalWritingMode(writing_mode)) {
171 if (IsLeftToRightDirection(direction)) 171 if (IsLtr(direction))
172 right_ = value; 172 right_ = value;
173 else 173 else
174 left_ = value; 174 left_ = value;
175 } else { 175 } else {
176 if (IsLeftToRightDirection(direction)) 176 if (IsLtr(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698