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

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 containing block 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..0b395f635b1289b1d0c0d1ec96d7993411d01306 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -2702,8 +2702,15 @@ void LayoutBox::ComputeLogicalWidth(
computed_values.margins_.start_, computed_values.margins_.end_,
Style()->MarginStart(), Style()->MarginEnd());
+ // CSS 2.1 10.3.3
+ // If 'width' is not 'auto' and 'border-left-width' + 'padding-left' + 'width'
+ // + 'padding-right' + 'border-right-width' (plus any of 'margin-left' or
+ // 'margin-right' that are not 'auto') is larger than the width of the
+ // containing block, then any 'auto' values for 'margin-left' or
+ // 'margin-right' treated as zero. The following should only apply for parent
+ // width >= children width
mstensho (USE GERRIT) 2017/04/27 12:37:28 You could remove that last sentence (or at least w
if (!has_perpendicular_containing_block && container_logical_width &&
- container_logical_width !=
+ container_logical_width >
(computed_values.extent_ + computed_values.margins_.start_ +
computed_values.margins_.end_) &&
!IsFloating() && !IsInline() && !cb->IsFlexibleBoxIncludingDeprecated() &&

Powered by Google App Engine
This is Rietveld 408576698