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

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 co… Created 3 years, 7 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
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 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (!has_perpendicular_containing_block && container_logical_width && 2705 if (!has_perpendicular_containing_block && container_logical_width &&
2706 container_logical_width != 2706 container_logical_width !=
2707 (computed_values.extent_ + computed_values.margins_.start_ + 2707 (computed_values.extent_ + computed_values.margins_.start_ +
2708 computed_values.margins_.end_) && 2708 computed_values.margins_.end_) &&
2709 !IsFloating() && !IsInline() && !cb->IsFlexibleBoxIncludingDeprecated() && 2709 !IsFloating() && !IsInline() && !cb->IsFlexibleBoxIncludingDeprecated() &&
2710 !cb->IsLayoutGrid()) { 2710 !cb->IsLayoutGrid()) {
2711 LayoutUnit new_margin = container_logical_width - computed_values.extent_ - 2711 LayoutUnit new_margin_total =
2712 cb->MarginStartForChild(*this); 2712 container_logical_width - computed_values.extent_;
2713 bool has_inverted_direction = cb->Style()->IsLeftToRightDirection() != 2713 bool has_inverted_direction = cb->Style()->IsLeftToRightDirection() !=
2714 Style()->IsLeftToRightDirection(); 2714 Style()->IsLeftToRightDirection();
2715 if (has_inverted_direction) 2715 if (has_inverted_direction) {
2716 computed_values.margins_.start_ = new_margin; 2716 computed_values.margins_.start_ =
2717 else 2717 new_margin_total - computed_values.margins_.end_;
2718 computed_values.margins_.end_ = new_margin; 2718 } else {
2719 computed_values.margins_.end_ =
2720 new_margin_total - computed_values.margins_.start_;
2721 }
2719 } 2722 }
2720 2723
2721 if (style_to_use.TextAutosizingMultiplier() != 1 && 2724 if (style_to_use.TextAutosizingMultiplier() != 1 &&
2722 style_to_use.MarginStart().GetType() == kFixed) { 2725 style_to_use.MarginStart().GetType() == kFixed) {
2723 Node* parent_node = GeneratingNode(); 2726 Node* parent_node = GeneratingNode();
2724 if (parent_node && (isHTMLOListElement(*parent_node) || 2727 if (parent_node && (isHTMLOListElement(*parent_node) ||
2725 isHTMLUListElement(*parent_node))) { 2728 isHTMLUListElement(*parent_node))) {
2726 // Make sure the markers in a list are properly positioned (i.e. not 2729 // Make sure the markers in a list are properly positioned (i.e. not
2727 // chopped off) when autosized. 2730 // chopped off) when autosized.
2728 const float adjusted_margin = 2731 const float adjusted_margin =
(...skipping 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after
5900 void LayoutBox::MutableForPainting:: 5903 void LayoutBox::MutableForPainting::
5901 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5904 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5902 auto& rare_data = GetLayoutBox().EnsureRareData(); 5905 auto& rare_data = GetLayoutBox().EnsureRareData();
5903 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5906 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5904 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5907 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5905 rare_data.previous_layout_overflow_rect_ = 5908 rare_data.previous_layout_overflow_rect_ =
5906 GetLayoutBox().LayoutOverflowRect(); 5909 GetLayoutBox().LayoutOverflowRect();
5907 } 5910 }
5908 5911
5909 } // namespace blink 5912 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698