| Index: third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc b/third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc
|
| index e5f711bacb67d42b1452d8de0fdf2610c7a8d14f..f31568adecdf118812aa7718298cb5e41837ad0a 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc
|
| @@ -17,6 +17,34 @@ String NGExclusion::ToString() const {
|
| type);
|
| }
|
|
|
| +bool NGExclusion::MaybeCombineWith(const NGExclusion& other) {
|
| + if (other.rect.BlockEndOffset() < rect.BlockEndOffset())
|
| + return false;
|
| +
|
| + if (other.type != type)
|
| + return false;
|
| +
|
| + switch (other.type) {
|
| + case NGExclusion::kFloatLeft: {
|
| + if (other.rect.offset == rect.InlineEndBlockStartOffset()) {
|
| + rect.size = {other.rect.InlineSize() + rect.InlineSize(),
|
| + other.rect.BlockSize()};
|
| + return true;
|
| + }
|
| + }
|
| + case NGExclusion::kFloatRight: {
|
| + if (rect.offset == other.rect.InlineEndBlockStartOffset()) {
|
| + rect.offset = other.rect.offset;
|
| + rect.size = {other.rect.InlineSize() + rect.InlineSize(),
|
| + other.rect.BlockSize()};
|
| + return true;
|
| + }
|
| + }
|
| + default:
|
| + return false;
|
| + }
|
| +}
|
| +
|
| std::ostream& operator<<(std::ostream& stream, const NGExclusion& value) {
|
| return stream << value.ToString();
|
| }
|
|
|