Index: third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc |
index 58c2b1caec83686914757e00c51238c562bd4b14..3ab6d1546b6209674894024b5291d3a83aec9a36 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc |
@@ -408,4 +408,14 @@ void ApplyAutoMargins(const NGConstraintSpace& constraint_space, |
} |
} |
+LayoutUnit ConstrainByMinMax(LayoutUnit length, |
+ Optional<LayoutUnit> min, |
+ Optional<LayoutUnit> max) { |
+ if (max && length > max.value()) |
+ length = max.value(); |
+ if (min && length < min.value()) |
+ length = min.value(); |
+ return length; |
+} |
+ |
} // namespace blink |