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

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

Issue 1549153002: Fix preferred logical widths of orthogonal writing modes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (merge conflict resolved) Created 4 years, 10 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) 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 LayoutBlock::LayoutBlock(ContainerNode* node) 126 LayoutBlock::LayoutBlock(ContainerNode* node)
127 : LayoutBox(node) 127 : LayoutBox(node)
128 , m_hasMarginBeforeQuirk(false) 128 , m_hasMarginBeforeQuirk(false)
129 , m_hasMarginAfterQuirk(false) 129 , m_hasMarginAfterQuirk(false)
130 , m_beingDestroyed(false) 130 , m_beingDestroyed(false)
131 , m_hasMarkupTruncation(false) 131 , m_hasMarkupTruncation(false)
132 , m_widthAvailableToChildrenChanged(false) 132 , m_widthAvailableToChildrenChanged(false)
133 , m_hasOnlySelfCollapsingChildren(false) 133 , m_hasOnlySelfCollapsingChildren(false)
134 , m_descendantsWithFloatsMarkedForLayout(false) 134 , m_descendantsWithFloatsMarkedForLayout(false)
135 , m_needsRecalcLogicalWidthAfterLayoutChildren(false)
136 , m_hasPositionedObjects(false) 135 , m_hasPositionedObjects(false)
137 , m_hasPercentHeightDescendants(false) 136 , m_hasPercentHeightDescendants(false)
138 { 137 {
139 // LayoutBlockFlow calls setChildrenInline(true). 138 // LayoutBlockFlow calls setChildrenInline(true).
140 // By default, subclasses do not have inline children. 139 // By default, subclasses do not have inline children.
141 } 140 }
142 141
143 void LayoutBlock::removeFromGlobalMaps() 142 void LayoutBlock::removeFromGlobalMaps()
144 { 143 {
145 if (hasPositionedObjects()) { 144 if (hasPositionedObjects()) {
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 2067
2069 void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout Unit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const 2068 void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout Unit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const
2070 { 2069 {
2071 if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingM ode()) { 2070 if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingM ode()) {
2072 // If the child is an orthogonal flow, child's height determines the wid th, but the height is not available until layout. 2071 // If the child is an orthogonal flow, child's height determines the wid th, but the height is not available until layout.
2073 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit 2072 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit
2074 if (!child.needsLayout()) { 2073 if (!child.needsLayout()) {
2075 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch ild).logicalHeight(); 2074 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch ild).logicalHeight();
2076 return; 2075 return;
2077 } 2076 }
2078 m_needsRecalcLogicalWidthAfterLayoutChildren = true;
2079 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child) .computeLogicalHeightWithoutLayout(); 2077 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child) .computeLogicalHeightWithoutLayout();
2080 return; 2078 return;
2081 } 2079 }
2082 minPreferredLogicalWidth = child.minPreferredLogicalWidth(); 2080 minPreferredLogicalWidth = child.minPreferredLogicalWidth();
2083 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth(); 2081 maxPreferredLogicalWidth = child.maxPreferredLogicalWidth();
2084 2082
2085 // For non-replaced blocks if the inline size is min|max-content or a defini te size the min|max-content contribution 2083 // For non-replaced blocks if the inline size is min|max-content or a defini te size the min|max-content contribution
2086 // is that size plus border, padding and margin https://drafts.csswg.org/css -sizing/#block-intrinsic 2084 // is that size plus border, padding and margin https://drafts.csswg.org/css -sizing/#block-intrinsic
2087 if (child.isLayoutBlock()) { 2085 if (child.isLayoutBlock()) {
2088 const Length& computedInlineSize = child.styleRef().logicalWidth(); 2086 const Length& computedInlineSize = child.styleRef().logicalWidth();
2089 if (computedInlineSize.isMaxContent()) 2087 if (computedInlineSize.isMaxContent())
2090 minPreferredLogicalWidth = maxPreferredLogicalWidth; 2088 minPreferredLogicalWidth = maxPreferredLogicalWidth;
2091 else if (computedInlineSize.isMinContent()) 2089 else if (computedInlineSize.isMinContent())
2092 maxPreferredLogicalWidth = minPreferredLogicalWidth; 2090 maxPreferredLogicalWidth = minPreferredLogicalWidth;
2093 } 2091 }
2094
2095 if (child.isLayoutBlock() && toLayoutBlock(child).needsRecalcLogicalWidthAft erLayoutChildren())
2096 m_needsRecalcLogicalWidthAfterLayoutChildren = true;
2097 } 2092 }
2098 2093
2099 bool LayoutBlock::hasLineIfEmpty() const 2094 bool LayoutBlock::hasLineIfEmpty() const
2100 { 2095 {
2101 if (!node()) 2096 if (!node())
2102 return false; 2097 return false;
2103 2098
2104 if (node()->isRootEditableElement()) 2099 if (node()->isRootEditableElement())
2105 return true; 2100 return true;
2106 2101
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2853 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2859 { 2854 {
2860 showLayoutObject(); 2855 showLayoutObject();
2861 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2856 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2862 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2857 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2863 } 2858 }
2864 2859
2865 #endif 2860 #endif
2866 2861
2867 } // namespace blink 2862 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698