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

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: Resolve inline margins in over-constrained situations correctly. 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/block/over-constrained-auto-margin.html ('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 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 kInlineDirection, cb, container_logical_width, computed_values.extent_, 2675 kInlineDirection, cb, container_logical_width, computed_values.extent_,
2676 computed_values.margins_.start_, computed_values.margins_.end_, 2676 computed_values.margins_.start_, computed_values.margins_.end_,
2677 Style()->MarginStart(), Style()->MarginEnd()); 2677 Style()->MarginStart(), Style()->MarginEnd());
2678 2678
2679 if (!has_perpendicular_containing_block && container_logical_width && 2679 if (!has_perpendicular_containing_block && container_logical_width &&
2680 container_logical_width != 2680 container_logical_width !=
2681 (computed_values.extent_ + computed_values.margins_.start_ + 2681 (computed_values.extent_ + computed_values.margins_.start_ +
2682 computed_values.margins_.end_) && 2682 computed_values.margins_.end_) &&
2683 !IsFloating() && !IsInline() && !cb->IsFlexibleBoxIncludingDeprecated() && 2683 !IsFloating() && !IsInline() && !cb->IsFlexibleBoxIncludingDeprecated() &&
2684 !cb->IsLayoutGrid()) { 2684 !cb->IsLayoutGrid()) {
2685 LayoutUnit new_margin = container_logical_width - computed_values.extent_ - 2685 LayoutUnit new_margin_total =
2686 cb->MarginStartForChild(*this); 2686 container_logical_width - computed_values.extent_;
2687 bool has_inverted_direction = cb->Style()->IsLeftToRightDirection() != 2687 bool has_inverted_direction = cb->Style()->IsLeftToRightDirection() !=
2688 Style()->IsLeftToRightDirection(); 2688 Style()->IsLeftToRightDirection();
2689 if (has_inverted_direction) 2689 if (has_inverted_direction) {
2690 computed_values.margins_.start_ = new_margin; 2690 computed_values.margins_.start_ =
2691 else 2691 new_margin_total - computed_values.margins_.end_;
2692 computed_values.margins_.end_ = new_margin; 2692 } else {
2693 computed_values.margins_.end_ =
2694 new_margin_total - computed_values.margins_.start_;
2695 }
2693 } 2696 }
2694 2697
2695 if (style_to_use.TextAutosizingMultiplier() != 1 && 2698 if (style_to_use.TextAutosizingMultiplier() != 1 &&
2696 style_to_use.MarginStart().GetType() == kFixed) { 2699 style_to_use.MarginStart().GetType() == kFixed) {
2697 Node* parent_node = GeneratingNode(); 2700 Node* parent_node = GeneratingNode();
2698 if (parent_node && (isHTMLOListElement(*parent_node) || 2701 if (parent_node && (isHTMLOListElement(*parent_node) ||
2699 isHTMLUListElement(*parent_node))) { 2702 isHTMLUListElement(*parent_node))) {
2700 // Make sure the markers in a list are properly positioned (i.e. not 2703 // Make sure the markers in a list are properly positioned (i.e. not
2701 // chopped off) when autosized. 2704 // chopped off) when autosized.
2702 const float adjusted_margin = 2705 const float adjusted_margin =
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after
5864 void LayoutBox::MutableForPainting:: 5867 void LayoutBox::MutableForPainting::
5865 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5868 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5866 auto& rare_data = GetLayoutBox().EnsureRareData(); 5869 auto& rare_data = GetLayoutBox().EnsureRareData();
5867 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5870 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5868 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5871 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5869 rare_data.previous_layout_overflow_rect_ = 5872 rare_data.previous_layout_overflow_rect_ =
5870 GetLayoutBox().LayoutOverflowRect(); 5873 GetLayoutBox().LayoutOverflowRect();
5871 } 5874 }
5872 5875
5873 } // namespace blink 5876 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/block/over-constrained-auto-margin.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698