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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h

Issue 2215133005: Add grid/flex layout support for <fieldset> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed more ClusterFuzz tests Created 4 years, 3 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePo sitionMode = PositionOnContainingLine) const override; 52 int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePo sitionMode = PositionOnContainingLine) const override;
53 int firstLineBoxBaseline() const override; 53 int firstLineBoxBaseline() const override;
54 int inlineBlockBaseline(LineDirectionMode) const override; 54 int inlineBlockBaseline(LineDirectionMode) const override;
55 IntSize originAdjustmentForScrollbars() const override; 55 IntSize originAdjustmentForScrollbars() const override;
56 bool hasTopOverflow() const override; 56 bool hasTopOverflow() const override;
57 bool hasLeftOverflow() const override; 57 bool hasLeftOverflow() const override;
58 58
59 void paintChildren(const PaintInfo&, const LayoutPoint&) const final; 59 void paintChildren(const PaintInfo&, const LayoutPoint&) const final;
60 60
61 bool isHorizontalFlow() const; 61 bool isHorizontalFlow() const;
62 virtual LayoutObject* layoutSpecialExcludedChild(bool relayoutChildren, Subt reeLayoutScope&) { return nullptr; }
62 63
63 const OrderIterator& orderIterator() const { return m_orderIterator; } 64 const OrderIterator& orderIterator() const { return m_orderIterator; }
64 65
65 LayoutUnit crossSizeForPercentageResolution(const LayoutBox& child); 66 LayoutUnit crossSizeForPercentageResolution(const LayoutBox& child);
66 LayoutUnit mainSizeForPercentageResolution(const LayoutBox& child); 67 LayoutUnit mainSizeForPercentageResolution(const LayoutBox& child);
67 LayoutUnit childLogicalHeightForPercentageResolution(const LayoutBox& child) ; 68 LayoutUnit childLogicalHeightForPercentageResolution(const LayoutBox& child) ;
68 69
69 void clearCachedMainSizeForChild(const LayoutBox& child); 70 void clearCachedMainSizeForChild(const LayoutBox& child);
70 71
71 LayoutUnit staticMainAxisPositionForPositionedChild(const LayoutBox& child); 72 LayoutUnit staticMainAxisPositionForPositionedChild(const LayoutBox& child);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 bool childHasIntrinsicMainAxisSize(const LayoutBox& child) const; 156 bool childHasIntrinsicMainAxisSize(const LayoutBox& child) const;
156 EOverflow mainAxisOverflowForChild(const LayoutBox& child) const; 157 EOverflow mainAxisOverflowForChild(const LayoutBox& child) const;
157 EOverflow crossAxisOverflowForChild(const LayoutBox& child) const; 158 EOverflow crossAxisOverflowForChild(const LayoutBox& child) const;
158 void cacheChildMainSize(const LayoutBox& child); 159 void cacheChildMainSize(const LayoutBox& child);
159 160
160 void layoutFlexItems(bool relayoutChildren, SubtreeLayoutScope&); 161 void layoutFlexItems(bool relayoutChildren, SubtreeLayoutScope&);
161 LayoutUnit autoMarginOffsetInMainAxis(const OrderedFlexItemList&, LayoutUnit & availableFreeSpace); 162 LayoutUnit autoMarginOffsetInMainAxis(const OrderedFlexItemList&, LayoutUnit & availableFreeSpace);
162 void updateAutoMarginsInMainAxis(LayoutBox& child, LayoutUnit autoMarginOffs et); 163 void updateAutoMarginsInMainAxis(LayoutBox& child, LayoutUnit autoMarginOffs et);
163 bool hasAutoMarginsInCrossAxis(const LayoutBox& child) const; 164 bool hasAutoMarginsInCrossAxis(const LayoutBox& child) const;
164 bool updateAutoMarginsInCrossAxis(LayoutBox& child, LayoutUnit availableAlig nmentSpace); 165 bool updateAutoMarginsInCrossAxis(LayoutBox& child, LayoutUnit availableAlig nmentSpace);
165 void repositionLogicalHeightDependentFlexItems(Vector<LineContext>&); 166 void repositionLogicalHeightDependentFlexItems(Vector<LineContext>&, LayoutO bject* childToExclude);
166 LayoutUnit clientLogicalBottomAfterRepositioning(); 167 LayoutUnit clientLogicalBottomAfterRepositioning();
167 168
168 LayoutUnit availableAlignmentSpaceForChild(LayoutUnit lineCrossAxisExtent, c onst LayoutBox& child); 169 LayoutUnit availableAlignmentSpaceForChild(LayoutUnit lineCrossAxisExtent, c onst LayoutBox& child);
169 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit lineCr ossAxisExtent, const LayoutBox& child); 170 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit lineCr ossAxisExtent, const LayoutBox& child);
170 LayoutUnit marginBoxAscentForChild(const LayoutBox& child); 171 LayoutUnit marginBoxAscentForChild(const LayoutBox& child);
171 172
172 LayoutUnit computeChildMarginValue(Length margin); 173 LayoutUnit computeChildMarginValue(Length margin);
173 void prepareOrderIteratorAndMargins(); 174 void prepareOrderIteratorAndMargins();
174 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, LayoutUnit ch ildSize); 175 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, LayoutUnit ch ildSize);
175 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const LayoutBox& child, LayoutUnit childSize); 176 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const LayoutBox& child, LayoutUnit childSize);
176 FlexItem constructFlexItem(LayoutBox& child, ChildLayoutType); 177 FlexItem constructFlexItem(LayoutBox& child, ChildLayoutType);
177 // The hypothetical main size of an item is the flex base size clamped accor ding to its min and max main size properties 178 // The hypothetical main size of an item is the flex base size clamped accor ding to its min and max main size properties
178 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s umFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWei ghtedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren); 179 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s umFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWei ghtedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren, Lay outObject* childToExclude);
179 180
180 void freezeInflexibleItems(FlexSign, OrderedFlexItemList& children, LayoutUn it& remainingFreeSpace, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink); 181 void freezeInflexibleItems(FlexSign, OrderedFlexItemList& children, LayoutUn it& remainingFreeSpace, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink);
181 bool resolveFlexibleLengths(FlexSign, OrderedFlexItemList&, LayoutUnit initi alFreeSpace, LayoutUnit& remainingFreeSpace, double& totalFlexGrow, double& tota lFlexShrink, double& totalWeightedFlexShrink); 182 bool resolveFlexibleLengths(FlexSign, OrderedFlexItemList&, LayoutUnit initi alFreeSpace, LayoutUnit& remainingFreeSpace, double& totalFlexGrow, double& tota lFlexShrink, double& totalWeightedFlexShrink);
182 void freezeViolations(Vector<FlexItem*>&, LayoutUnit& availableFreeSpace, do uble& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink); 183 void freezeViolations(Vector<FlexItem*>&, LayoutUnit& availableFreeSpace, do uble& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink);
183 184
184 void resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& child); 185 void resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& child);
185 void setOverrideMainAxisContentSizeForChild(LayoutBox& child, LayoutUnit chi ldPreferredSize); 186 void setOverrideMainAxisContentSizeForChild(LayoutBox& child, LayoutUnit chi ldPreferredSize);
186 void prepareChildForPositionedLayout(LayoutBox& child); 187 void prepareChildForPositionedLayout(LayoutBox& child);
187 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const; 188 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const;
188 void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexIt emList&, LayoutUnit availableFreeSpace, bool relayoutChildren, SubtreeLayoutScop e&, Vector<LineContext>&); 189 void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexIt emList&, LayoutUnit availableFreeSpace, bool relayoutChildren, SubtreeLayoutScop e&, Vector<LineContext>&);
189 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff set, LayoutUnit availableFreeSpace); 190 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff set, LayoutUnit availableFreeSpace);
190 void alignFlexLines(Vector<LineContext>&); 191 void alignFlexLines(Vector<LineContext>&);
191 void alignChildren(const Vector<LineContext>&); 192 void alignChildren(const Vector<LineContext>&, LayoutObject* childToExclude) ;
192 void applyStretchAlignmentToChild(LayoutBox& child, LayoutUnit lineCrossAxis Extent); 193 void applyStretchAlignmentToChild(LayoutBox& child, LayoutUnit lineCrossAxis Extent);
193 void flipForRightToLeftColumn(); 194 void flipForRightToLeftColumn();
194 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar tEdge); 195 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar tEdge);
195 196
196 float countIntrinsicSizeForAlgorithmChange(LayoutUnit maxPreferredWidth, Lay outBox* child, float previousMaxContentFlexFraction) const; 197 float countIntrinsicSizeForAlgorithmChange(LayoutUnit maxPreferredWidth, Lay outBox* child, float previousMaxContentFlexFraction) const;
197 198
198 // This is used to cache the preferred size for orthogonal flow children so we don't have to relayout to get it 199 // This is used to cache the preferred size for orthogonal flow children so we don't have to relayout to get it
199 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; 200 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis;
200 201
201 // This set is used to keep track of which children we laid out in this curr ent layout iteration. 202 // This set is used to keep track of which children we laid out in this curr ent layout iteration.
202 // We need it because the ones in this set may need an additional layout pas s for correct stretch alignment 203 // We need it because the ones in this set may need an additional layout pas s for correct stretch alignment
203 // handling, as the first layout likely did not use the correct value for pe rcentage sizing of children. 204 // handling, as the first layout likely did not use the correct value for pe rcentage sizing of children.
204 HashSet<const LayoutObject*> m_relaidOutChildren; 205 HashSet<const LayoutObject*> m_relaidOutChildren;
205 206
206 mutable OrderIterator m_orderIterator; 207 mutable OrderIterator m_orderIterator;
207 int m_numberOfInFlowChildrenOnFirstLine; 208 int m_numberOfInFlowChildrenOnFirstLine;
208 209
209 // This is SizeIsUnknown outside of layoutBlock() 210 // This is SizeIsUnknown outside of layoutBlock()
210 mutable SizeDefiniteness m_hasDefiniteHeight; 211 mutable SizeDefiniteness m_hasDefiniteHeight;
211 }; 212 };
212 213
213 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); 214 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox());
214 215
215 } // namespace blink 216 } // namespace blink
216 217
217 #endif // LayoutFlexibleBox_h 218 #endif // LayoutFlexibleBox_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFieldset.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698