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

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: 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
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.isReplaced()) {
2149 const Length& computedInlineSize = child.styleRef().logicalWidth();
2150 LayoutBlock& blockChild = toLayoutBlock(child);
2151 if (computedInlineSize.isFitContent() || computedInlineSize.isFillAvaila ble() || computedInlineSize.isAuto()
2152 || (computedInlineSize.hasPercent() && !toLayoutBox(child).percentag eLogicalHeightIsResolvable())) {
2153 minPreferredLogicalWidth = blockChild.minPreferredLogicalWidth();
2154 maxPreferredLogicalWidth = blockChild.maxPreferredLogicalWidth();
2155 } else {
2156 ASSERT(computedInlineSize.isMinContent() || computedInlineSize.isMax Content() || computedInlineSize.isSpecified());
mstensho (USE GERRIT) 2015/12/09 13:19:52 This is heavy. Start with bogus initial values. La
2157 m_needsRecalcLogicalWidthAfterLayoutChildren = child.needsLayout();
2158 minPreferredLogicalWidth = blockChild.logicalWidth();
2159 maxPreferredLogicalWidth = blockChild.logicalWidth();
2160 }
2161 } else {
2162 // TODO(svillar): we leave the original implementation as default fallba ck. Still need to specialcase
2163 // some other situations: https://drafts.csswg.org/css-sizing/#intrinsic
2164 minPreferredLogicalWidth = child.minPreferredLogicalWidth();
2165 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth();
2166 }
2167
2149 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft erLayoutChildren()) 2168 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft erLayoutChildren())
2150 m_needsRecalcLogicalWidthAfterLayoutChildren = true; 2169 m_needsRecalcLogicalWidthAfterLayoutChildren = true;
2151 } 2170 }
2152 2171
2153 bool LayoutBlock::hasLineIfEmpty() const 2172 bool LayoutBlock::hasLineIfEmpty() const
2154 { 2173 {
2155 if (!node()) 2174 if (!node())
2156 return false; 2175 return false;
2157 2176
2158 if (node()->isRootEditableElement()) 2177 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 2931 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2913 { 2932 {
2914 showLayoutObject(); 2933 showLayoutObject();
2915 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2934 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2916 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2935 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2917 } 2936 }
2918 2937
2919 #endif 2938 #endif
2920 2939
2921 } // namespace blink 2940 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698