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

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

Issue 2623103002: [layoutng] Fix extra margin space computation (Closed)
Patch Set: 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_absolute_utils.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_absolute_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_absolute_utils.cc
index 3b5b8ab88fffe12ce4c175dc0a5c4e89b527026f..35bdbccda698338c5a759763de7fe8acbb66bd5e 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_absolute_utils.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_absolute_utils.cc
@@ -117,12 +117,13 @@ void ComputeAbsoluteHorizontal(
margin_right = margin_space - *margin_left;
} else {
// Are values overconstrained?
- if (*margin_left + *margin_right != margin_space) {
+ LayoutUnit margin_extra = margin_space - *margin_left - *margin_right;
+ if (margin_extra) {
// Relax the end.
if (space.Direction() == TextDirection::kLtr)
- right = *right - *margin_left + *margin_right - margin_space;
+ right = *right + margin_extra;
else
- left = *left - *margin_left + *margin_right - margin_space;
+ left = *left + margin_extra;
}
}
}
@@ -260,11 +261,9 @@ void ComputeAbsoluteVertical(
} else if (!margin_bottom) {
margin_bottom = margin_space - *margin_top;
} else {
- // Are values overconstrained?
- if (*margin_top + *margin_bottom != margin_space) {
- // Relax the end.
- bottom = *bottom - *margin_top + *margin_bottom - margin_space;
- }
+ LayoutUnit margin_extra = margin_space - *margin_top - *margin_bottom;
+ if (margin_extra)
+ bottom = *bottom + margin_extra;
}
}

Powered by Google App Engine
This is Rietveld 408576698