Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/geometry/ng_margin_strut.cc

Issue 2721613003: [LayoutNG] Move remaining ng_units structs to their own files (Closed)
Patch Set: Don't export NGBoxStrut for now Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698