Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/ng/ng_units.cc |
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_units.cc b/third_party/WebKit/Source/core/layout/ng/ng_units.cc |
| index 279ba7a495afd94ac777e28d457e878aa5ac4521..b41bd437dcc3c7d9b4a4c164b35cb7c5a75074c1 100644 |
| --- a/third_party/WebKit/Source/core/layout/ng/ng_units.cc |
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_units.cc |
| @@ -8,6 +8,10 @@ |
| namespace blink { |
| +LayoutUnit MinAndMaxContentSizes::ShrinkToFit(LayoutUnit container_size) const { |
|
cbiesinger
2016/11/11 04:31:47
Interesting idea to add this function as a member
atotic
2016/11/11 05:16:22
Done.
|
| + return std::min(max_content, std::max(min_content, container_size)); |
| +} |
| + |
| NGPhysicalSize NGLogicalSize::ConvertToPhysical(NGWritingMode mode) const { |
| return mode == HorizontalTopBottom ? NGPhysicalSize(inline_size, block_size) |
| : NGPhysicalSize(block_size, inline_size); |
| @@ -139,6 +143,37 @@ bool NGBoxStrut::operator==(const NGBoxStrut& other) const { |
| std::tie(inline_start, inline_end, block_start, block_end); |
| } |
| +NGBoxStrut NGPhysicalBoxStrut::ConvertToLogical(NGWritingMode writing_mode, |
| + TextDirection direction) const { |
|
cbiesinger
2016/11/11 04:31:47
This is equivalent to https://cs.chromium.org/chro
atotic
2016/11/11 05:16:23
Oh man, I missed that one. Done, old one has been
|
| + switch (writing_mode) { |
| + case HorizontalTopBottom: |
| + if (direction == LTR) |
| + return NGBoxStrut{left, right, top, bottom}; |
| + else |
| + return NGBoxStrut{right, left, top, bottom}; |
| + case VerticalRightLeft: |
| + if (direction == LTR) |
| + return NGBoxStrut{top, bottom, right, left}; |
| + else |
| + return NGBoxStrut{bottom, top, right, left}; |
| + case VerticalLeftRight: |
| + if (direction == LTR) |
| + return NGBoxStrut{top, bottom, left, right}; |
| + else |
| + return NGBoxStrut{bottom, top, left, right}; |
| + case SidewaysRightLeft: |
| + if (direction == LTR) |
| + return NGBoxStrut{bottom, top, left, right}; |
| + else |
| + return NGBoxStrut{top, bottom, left, right}; |
| + case SidewaysLeftRight: |
| + if (direction == LTR) |
| + return NGBoxStrut{top, bottom, left, right}; |
| + else |
| + return NGBoxStrut{bottom, top, left, right}; |
| + } |
| +} |
| + |
| LayoutUnit NGMarginStrut::BlockEndSum() const { |
| return margin_block_end + negative_margin_block_end; |
| } |