Chromium Code Reviews| Index: third_party/WebKit/Source/platform/LengthBox.cpp |
| diff --git a/third_party/WebKit/Source/platform/LengthBox.cpp b/third_party/WebKit/Source/platform/LengthBox.cpp |
| index af0f27191c4766f7ecec07e92bccaf452820df21..a78defdd4536ca8b574776be2850778dd8e9cfbd 100644 |
| --- a/third_party/WebKit/Source/platform/LengthBox.cpp |
| +++ b/third_party/WebKit/Source/platform/LengthBox.cpp |
| @@ -76,6 +76,40 @@ const Length& LengthBox::After(WritingMode writing_mode, |
| return bottom; |
| } |
| +const Length& LengthBox::Start(WritingMode writing_mode, |
| + TextDirection direction, |
| + const Length& top, |
| + const Length& left, |
| + const Length& right, |
| + const Length& bottom) { |
| + if (IsHorizontalWritingMode(writing_mode)) |
| + return IsLeftToRightDirection(direction) ? left : right; |
| + return IsLeftToRightDirection(direction) ? top : bottom; |
| +} |
| + |
| +const Length& LengthBox::End(WritingMode writing_mode, |
| + TextDirection direction, |
| + const Length& top, |
| + const Length& left, |
| + const Length& right, |
| + const Length& bottom) { |
| + if (IsHorizontalWritingMode(writing_mode)) |
| + return IsLeftToRightDirection(direction) ? right : left; |
| + return IsLeftToRightDirection(direction) ? bottom : top; |
| +} |
| + |
| +const Length& LengthBox::Over(WritingMode writing_mode, |
| + const Length& top, |
| + const Length& right) { |
| + return IsHorizontalWritingMode(writing_mode) ? top : right; |
| +} |
| + |
| +const Length& LengthBox::Under(WritingMode writing_mode, |
| + const Length& bottom, |
| + const Length& left) { |
| + return IsHorizontalWritingMode(writing_mode) ? bottom : left; |
| +} |
|
alancutter (OOO until 2018)
2017/04/19 07:01:21
Thought: I don't think layout logic belongs in thi
shend
2017/04/19 07:19:24
Aha, I was looking for a better place to put these
|
| + |
| const Length& LengthBox::LogicalLeft(WritingMode writing_mode) const { |
| return LengthBox::LogicalLeft(writing_mode, left_, top_); |
| } |
| @@ -94,24 +128,21 @@ const Length& LengthBox::After(WritingMode writing_mode) const { |
| const Length& LengthBox::Start(WritingMode writing_mode, |
| TextDirection direction) const { |
| - if (IsHorizontalWritingMode(writing_mode)) |
| - return IsLeftToRightDirection(direction) ? left_ : right_; |
| - return IsLeftToRightDirection(direction) ? top_ : bottom_; |
| + return LengthBox::Start(writing_mode, direction, top_, left_, right_, |
| + bottom_); |
| } |
| const Length& LengthBox::end(WritingMode writing_mode, |
| TextDirection direction) const { |
| - if (IsHorizontalWritingMode(writing_mode)) |
| - return IsLeftToRightDirection(direction) ? right_ : left_; |
| - return IsLeftToRightDirection(direction) ? bottom_ : top_; |
| + return LengthBox::End(writing_mode, direction, top_, left_, right_, bottom_); |
| } |
| const Length& LengthBox::Over(WritingMode writing_mode) const { |
| - return IsHorizontalWritingMode(writing_mode) ? top_ : right_; |
| + return LengthBox::Over(writing_mode, top_, right_); |
| } |
| const Length& LengthBox::Under(WritingMode writing_mode) const { |
| - return IsHorizontalWritingMode(writing_mode) ? bottom_ : left_; |
| + return LengthBox::Under(writing_mode, bottom_, left_); |
| } |
| } // namespace blink |