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

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: Do not apply the modifications to tables which behave differently. Also there is no need to relayou… Created 5 years 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 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 // If the child is an orthogonal flow, child's height determines the wid th, but the height is not available until layout. 2137 // If the child is an orthogonal flow, child's height determines the wid th, but the height is not available until layout.
2138 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit 2138 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit
2139 if (!child.needsLayout()) { 2139 if (!child.needsLayout()) {
2140 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch ild).logicalHeight(); 2140 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch ild).logicalHeight();
2141 return; 2141 return;
2142 } 2142 }
2143 m_needsRecalcLogicalWidthAfterLayoutChildren = true; 2143 m_needsRecalcLogicalWidthAfterLayoutChildren = true;
2144 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child) .computeLogicalHeightWithoutLayout(); 2144 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child) .computeLogicalHeightWithoutLayout();
2145 return; 2145 return;
2146 } 2146 }
2147 minPreferredLogicalWidth = child.minPreferredLogicalWidth(); 2147
2148 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); 2148 if (child.isLayoutBlock() && !child.isTable() && !child.isReplaced()) {
mstensho (USE GERRIT) 2015/12/09 16:56:04 Why exclude table?
svillar 2015/12/09 17:41:32 Because there is a different section in the spec f
mstensho (USE GERRIT) 2015/12/09 19:17:33 This? http://imgur.com/osjEW7F I think we should
2149 const Length& computedInlineSize = child.styleRef().logicalWidth();
2150 if (computedInlineSize.isFitContent() || computedInlineSize.isFillAvaila ble() || computedInlineSize.isAuto()
2151 || (computedInlineSize.hasPercent() && !toLayoutBox(child).percentag eLogicalHeightIsResolvable())) {
2152 minPreferredLogicalWidth = child.minPreferredLogicalWidth();
2153 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth();
2154 } else {
2155 ASSERT(computedInlineSize.isMinContent() || computedInlineSize.isMax Content() || computedInlineSize.isSpecified());
2156 LogicalExtentComputedValues computedValues;
2157 toLayoutBlock(child).computeLogicalWidth(computedValues);
mstensho (USE GERRIT) 2015/12/09 16:56:04 How is this supposed to work if we haven't laid ou
svillar 2015/12/09 17:41:32 It will work because for min|max-content computeLo
mstensho (USE GERRIT) 2015/12/09 19:17:33 OK, that should work. But I still think my sugges
2158 minPreferredLogicalWidth = maxPreferredLogicalWidth = computedValues .m_extent;
2159 }
2160 } else {
2161 // TODO(svillar): we leave the original implementation as default fallba ck. Still need to specialcase
2162 // some other situations: https://drafts.csswg.org/css-sizing/#intrinsic
2163 minPreferredLogicalWidth = child.minPreferredLogicalWidth();
2164 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth();
2165 }
2166
2149 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft erLayoutChildren()) 2167 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft erLayoutChildren())
2150 m_needsRecalcLogicalWidthAfterLayoutChildren = true; 2168 m_needsRecalcLogicalWidthAfterLayoutChildren = true;
2151 } 2169 }
2152 2170
2153 bool LayoutBlock::hasLineIfEmpty() const 2171 bool LayoutBlock::hasLineIfEmpty() const
2154 { 2172 {
2155 if (!node()) 2173 if (!node())
2156 return false; 2174 return false;
2157 2175
2158 if (node()->isRootEditableElement()) 2176 if (node()->isRootEditableElement())
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2912 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2930 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2913 { 2931 {
2914 showLayoutObject(); 2932 showLayoutObject();
2915 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2933 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2916 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2934 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2917 } 2935 }
2918 2936
2919 #endif 2937 #endif
2920 2938
2921 } // namespace blink 2939 } // 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