OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/layout/ng/geometry/ng_margin_strut.h" |
| 6 |
| 7 #include "wtf/text/WTFString.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 LayoutUnit NGMarginStrut::Sum() const { |
| 12 return margin + negative_margin; |
| 13 } |
| 14 |
| 15 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
| 16 return margin == other.margin && negative_margin == other.negative_margin; |
| 17 } |
| 18 |
| 19 void NGMarginStrut::Append(const LayoutUnit& value) { |
| 20 if (value < 0) { |
| 21 negative_margin = std::min(value, negative_margin); |
| 22 } else { |
| 23 margin = std::max(value, margin); |
| 24 } |
| 25 } |
| 26 |
| 27 String NGMarginStrut::ToString() const { |
| 28 return String::format("%d %d", margin.toInt(), negative_margin.toInt()); |
| 29 } |
| 30 |
| 31 std::ostream& operator<<(std::ostream& stream, const NGMarginStrut& value) { |
| 32 return stream << value.ToString(); |
| 33 } |
| 34 |
| 35 } // namespace blink |
OLD | NEW |