| 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..9eeb013444c07937f2cb49f21cd1344e1119a173 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 available_size) const {
|
| + return std::min(max_content, std::max(min_content, available_size));
|
| +}
|
| +
|
| NGPhysicalSize NGLogicalSize::ConvertToPhysical(NGWritingMode mode) const {
|
| return mode == HorizontalTopBottom ? NGPhysicalSize(inline_size, block_size)
|
| : NGPhysicalSize(block_size, inline_size);
|
| @@ -139,6 +143,31 @@ bool NGBoxStrut::operator==(const NGBoxStrut& other) const {
|
| std::tie(inline_start, inline_end, block_start, block_end);
|
| }
|
|
|
| +// Converts physical dimensions to logical ones per
|
| +// https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
|
| +NGBoxStrut NGPhysicalBoxStrut::ConvertToLogical(NGWritingMode writing_mode,
|
| + TextDirection direction) const {
|
| + NGBoxStrut strut;
|
| + switch (writing_mode) {
|
| + case HorizontalTopBottom:
|
| + strut = {left, right, top, bottom};
|
| + break;
|
| + case VerticalRightLeft:
|
| + case SidewaysRightLeft:
|
| + strut = {top, bottom, right, left};
|
| + break;
|
| + case VerticalLeftRight:
|
| + strut = {top, bottom, left, right};
|
| + break;
|
| + case SidewaysLeftRight:
|
| + strut = {bottom, top, left, right};
|
| + break;
|
| + }
|
| + if (direction == RTL)
|
| + std::swap(strut.inline_start, strut.inline_end);
|
| + return strut;
|
| +}
|
| +
|
| LayoutUnit NGMarginStrut::BlockEndSum() const {
|
| return margin_block_end + negative_margin_block_end;
|
| }
|
|
|