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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1504403002: Fix computation of min|max-content contribution of non-replaced blocks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked patch & tests Created 4 years, 12 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/css-intrinsic-dimensions/resources/intrinsic-size-contribution.css ('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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 if (!child.needsLayout()) { 2119 if (!child.needsLayout()) {
2120 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch ild).logicalHeight(); 2120 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch ild).logicalHeight();
2121 return; 2121 return;
2122 } 2122 }
2123 m_needsRecalcLogicalWidthAfterLayoutChildren = true; 2123 m_needsRecalcLogicalWidthAfterLayoutChildren = true;
2124 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child) .computeLogicalHeightWithoutLayout(); 2124 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child) .computeLogicalHeightWithoutLayout();
2125 return; 2125 return;
2126 } 2126 }
2127 minPreferredLogicalWidth = child.minPreferredLogicalWidth(); 2127 minPreferredLogicalWidth = child.minPreferredLogicalWidth();
2128 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); 2128 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth();
2129
2130 // For non-replaced blocks if the inline size is min|max-content or a defini te size the min|max-content contribution
2131 // is that size plus border, padding and margin https://drafts.csswg.org/css -sizing/#block-intrinsic
2132 if (child.isLayoutBlock()) {
2133 const Length& computedInlineSize = child.styleRef().logicalWidth();
2134 if (computedInlineSize.isMaxContent())
2135 minPreferredLogicalWidth = maxPreferredLogicalWidth;
2136 else if (computedInlineSize.isMinContent())
2137 maxPreferredLogicalWidth = minPreferredLogicalWidth;
2138 }
2139
2129 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft erLayoutChildren()) 2140 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft erLayoutChildren())
2130 m_needsRecalcLogicalWidthAfterLayoutChildren = true; 2141 m_needsRecalcLogicalWidthAfterLayoutChildren = true;
2131 } 2142 }
2132 2143
2133 bool LayoutBlock::hasLineIfEmpty() const 2144 bool LayoutBlock::hasLineIfEmpty() const
2134 { 2145 {
2135 if (!node()) 2146 if (!node())
2136 return false; 2147 return false;
2137 2148
2138 if (node()->isRootEditableElement()) 2149 if (node()->isRootEditableElement())
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2892 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2903 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2893 { 2904 {
2894 showLayoutObject(); 2905 showLayoutObject();
2895 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2906 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2896 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2907 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2897 } 2908 }
2898 2909
2899 #endif 2910 #endif
2900 2911
2901 } // namespace blink 2912 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-intrinsic-dimensions/resources/intrinsic-size-contribution.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698