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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2841823006: Resolve inline margins in over-constrained situations correctly. (Closed)
Patch Set: In regular block layout, the width of a child's margin box should always be equal to that of its co… Created 3 years, 8 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/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 6f2ceee06cd38b7eebf8828ca9cde565f9b1a570..ac5e04998211f42304e18a49b431a2ed900d3830 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -2708,14 +2708,17 @@ void LayoutBox::ComputeLogicalWidth(
computed_values.margins_.end_) &&
!IsFloating() && !IsInline() && !cb->IsFlexibleBoxIncludingDeprecated() &&
!cb->IsLayoutGrid()) {
- LayoutUnit new_margin = container_logical_width - computed_values.extent_ -
- cb->MarginStartForChild(*this);
+ LayoutUnit new_margin_total =
+ container_logical_width - computed_values.extent_;
bool has_inverted_direction = cb->Style()->IsLeftToRightDirection() !=
Style()->IsLeftToRightDirection();
- if (has_inverted_direction)
- computed_values.margins_.start_ = new_margin;
- else
- computed_values.margins_.end_ = new_margin;
+ if (has_inverted_direction) {
+ computed_values.margins_.start_ =
+ new_margin_total - computed_values.margins_.end_;
+ } else {
+ computed_values.margins_.end_ =
+ new_margin_total - computed_values.margins_.start_;
+ }
}
if (style_to_use.TextAutosizingMultiplier() != 1 &&

Powered by Google App Engine
This is Rietveld 408576698