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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc

Issue 2643043003: Constrain width/height to minmax values (Closed)
Patch Set: Fix copypaste error: ResolveWidth->ResolveHeight Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698