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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2695 computed_values.extent_ = ConstrainLogicalWidthByMinMax( 2695 computed_values.extent_ = ConstrainLogicalWidthByMinMax(
2696 preferred_width, container_width_in_inline_direction, cb); 2696 preferred_width, container_width_in_inline_direction, cb);
2697 } 2697 }
2698 2698
2699 // Margin calculations. 2699 // Margin calculations.
2700 ComputeMarginsForDirection( 2700 ComputeMarginsForDirection(
2701 kInlineDirection, cb, container_logical_width, computed_values.extent_, 2701 kInlineDirection, cb, container_logical_width, computed_values.extent_,
2702 computed_values.margins_.start_, computed_values.margins_.end_, 2702 computed_values.margins_.start_, computed_values.margins_.end_,
2703 Style()->MarginStart(), Style()->MarginEnd()); 2703 Style()->MarginStart(), Style()->MarginEnd());
2704 2704
2705 // CSS 2.1 10.3.3
2706 // If 'width' is not 'auto' and 'border-left-width' + 'padding-left' + 'width'
2707 // + 'padding-right' + 'border-right-width' (plus any of 'margin-left' or
2708 // 'margin-right' that are not 'auto') is larger than the width of the
2709 // containing block, then any 'auto' values for 'margin-left' or
2710 // 'margin-right' treated as zero. The following should only apply for parent
2711 // width >= children width
2705 if (!has_perpendicular_containing_block && container_logical_width && 2712 if (!has_perpendicular_containing_block && container_logical_width &&
2706 container_logical_width != 2713 container_logical_width >=
facetothefate 2017/04/26 18:09:43 To keep the old behavior, should be > I guess
2707 (computed_values.extent_ + computed_values.margins_.start_ + 2714 (computed_values.extent_ + computed_values.margins_.start_ +
2708 computed_values.margins_.end_) && 2715 computed_values.margins_.end_) &&
2709 !IsFloating() && !IsInline() && !cb->IsFlexibleBoxIncludingDeprecated() && 2716 !IsFloating() && !IsInline() && !cb->IsFlexibleBoxIncludingDeprecated() &&
2710 !cb->IsLayoutGrid()) { 2717 !cb->IsLayoutGrid()) {
2711 LayoutUnit new_margin = container_logical_width - computed_values.extent_ - 2718 LayoutUnit new_margin = container_logical_width - computed_values.extent_ -
2712 cb->MarginStartForChild(*this); 2719 cb->MarginStartForChild(*this);
2713 bool has_inverted_direction = cb->Style()->IsLeftToRightDirection() != 2720 bool has_inverted_direction = cb->Style()->IsLeftToRightDirection() !=
2714 Style()->IsLeftToRightDirection(); 2721 Style()->IsLeftToRightDirection();
2715 if (has_inverted_direction) 2722 if (has_inverted_direction)
2716 computed_values.margins_.start_ = new_margin; 2723 computed_values.margins_.start_ = new_margin;
(...skipping 3183 matching lines...) Expand 10 before | Expand all | Expand 10 after
5900 void LayoutBox::MutableForPainting:: 5907 void LayoutBox::MutableForPainting::
5901 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5908 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5902 auto& rare_data = GetLayoutBox().EnsureRareData(); 5909 auto& rare_data = GetLayoutBox().EnsureRareData();
5903 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5910 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5904 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5911 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5905 rare_data.previous_layout_overflow_rect_ = 5912 rare_data.previous_layout_overflow_rect_ =
5906 GetLayoutBox().LayoutOverflowRect(); 5913 GetLayoutBox().LayoutOverflowRect();
5907 } 5914 }
5908 5915
5909 } // namespace blink 5916 } // namespace blink
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698