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

Side by Side Diff: Source/core/rendering/RenderFlexibleBox.h

Issue 555213002: Convert RenderFlexibleBox code to use RenderBox references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | Source/core/rendering/RenderFlexibleBox.cpp » ('j') | 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) 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 typedef HashMap<const RenderBox*, LayoutUnit> InflexibleFlexItemSize; 77 typedef HashMap<const RenderBox*, LayoutUnit> InflexibleFlexItemSize;
78 typedef Vector<RenderBox*> OrderedFlexItemList; 78 typedef Vector<RenderBox*> OrderedFlexItemList;
79 79
80 struct LineContext; 80 struct LineContext;
81 struct Violation; 81 struct Violation;
82 82
83 // Use an inline capacity of 8, since flexbox containers usually have less t han 8 children. 83 // Use an inline capacity of 8, since flexbox containers usually have less t han 8 children.
84 typedef Vector<LayoutRect, 8> ChildFrameRects; 84 typedef Vector<LayoutRect, 8> ChildFrameRects;
85 85
86 bool hasOrthogonalFlow(RenderBox* child) const; 86 bool hasOrthogonalFlow(RenderBox& child) const;
87 bool isColumnFlow() const; 87 bool isColumnFlow() const;
88 bool isLeftToRightFlow() const; 88 bool isLeftToRightFlow() const;
89 bool isMultiline() const; 89 bool isMultiline() const;
90 Length flexBasisForChild(RenderBox* child) const; 90 Length flexBasisForChild(RenderBox& child) const;
91 LayoutUnit crossAxisExtentForChild(RenderBox* child) const; 91 LayoutUnit crossAxisExtentForChild(RenderBox& child) const;
92 LayoutUnit crossAxisIntrinsicExtentForChild(RenderBox* child) const; 92 LayoutUnit crossAxisIntrinsicExtentForChild(RenderBox& child) const;
93 LayoutUnit childIntrinsicHeight(RenderBox* child) const; 93 LayoutUnit childIntrinsicHeight(RenderBox& child) const;
94 LayoutUnit childIntrinsicWidth(RenderBox* child) const; 94 LayoutUnit childIntrinsicWidth(RenderBox& child) const;
95 LayoutUnit mainAxisExtentForChild(RenderBox* child) const; 95 LayoutUnit mainAxisExtentForChild(RenderBox& child) const;
96 LayoutUnit crossAxisExtent() const; 96 LayoutUnit crossAxisExtent() const;
97 LayoutUnit mainAxisExtent() const; 97 LayoutUnit mainAxisExtent() const;
98 LayoutUnit crossAxisContentExtent() const; 98 LayoutUnit crossAxisContentExtent() const;
99 LayoutUnit mainAxisContentExtent(LayoutUnit contentLogicalHeight); 99 LayoutUnit mainAxisContentExtent(LayoutUnit contentLogicalHeight);
100 LayoutUnit computeMainAxisExtentForChild(RenderBox* child, SizeType, const L ength& size); 100 LayoutUnit computeMainAxisExtentForChild(RenderBox& child, SizeType, const L ength& size);
101 WritingMode transformedWritingMode() const; 101 WritingMode transformedWritingMode() const;
102 LayoutUnit flowAwareBorderStart() const; 102 LayoutUnit flowAwareBorderStart() const;
103 LayoutUnit flowAwareBorderEnd() const; 103 LayoutUnit flowAwareBorderEnd() const;
104 LayoutUnit flowAwareBorderBefore() const; 104 LayoutUnit flowAwareBorderBefore() const;
105 LayoutUnit flowAwareBorderAfter() const; 105 LayoutUnit flowAwareBorderAfter() const;
106 LayoutUnit flowAwarePaddingStart() const; 106 LayoutUnit flowAwarePaddingStart() const;
107 LayoutUnit flowAwarePaddingEnd() const; 107 LayoutUnit flowAwarePaddingEnd() const;
108 LayoutUnit flowAwarePaddingBefore() const; 108 LayoutUnit flowAwarePaddingBefore() const;
109 LayoutUnit flowAwarePaddingAfter() const; 109 LayoutUnit flowAwarePaddingAfter() const;
110 LayoutUnit flowAwareMarginStartForChild(RenderBox* child) const; 110 LayoutUnit flowAwareMarginStartForChild(RenderBox* child) const;
111 LayoutUnit flowAwareMarginEndForChild(RenderBox* child) const; 111 LayoutUnit flowAwareMarginEndForChild(RenderBox* child) const;
112 LayoutUnit flowAwareMarginBeforeForChild(RenderBox* child) const; 112 LayoutUnit flowAwareMarginBeforeForChild(RenderBox* child) const;
113 LayoutUnit crossAxisMarginExtentForChild(RenderBox* child) const; 113 LayoutUnit crossAxisMarginExtentForChild(RenderBox* child) const;
114 LayoutUnit crossAxisScrollbarExtent() const; 114 LayoutUnit crossAxisScrollbarExtent() const;
115 LayoutUnit crossAxisScrollbarExtentForChild(RenderBox* child) const; 115 LayoutUnit crossAxisScrollbarExtentForChild(RenderBox* child) const;
116 LayoutPoint flowAwareLocationForChild(RenderBox* child) const; 116 LayoutPoint flowAwareLocationForChild(RenderBox* child) const;
117 // FIXME: Supporting layout deltas. 117 // FIXME: Supporting layout deltas.
118 void setFlowAwareLocationForChild(RenderBox* child, const LayoutPoint&); 118 void setFlowAwareLocationForChild(RenderBox* child, const LayoutPoint&);
119 void adjustAlignmentForChild(RenderBox* child, LayoutUnit); 119 void adjustAlignmentForChild(RenderBox* child, LayoutUnit);
120 ItemPosition alignmentForChild(RenderBox* child) const; 120 ItemPosition alignmentForChild(RenderBox& child) const;
121 LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox* child) const; 121 LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox* child) const;
122 LayoutUnit preferredMainAxisContentExtentForChild(RenderBox* child, bool has InfiniteLineLength, bool relayoutChildren = false); 122 LayoutUnit preferredMainAxisContentExtentForChild(RenderBox* child, bool has InfiniteLineLength, bool relayoutChildren = false);
123 bool childPreferredMainAxisContentExtentRequiresLayout(RenderBox* child, boo l hasInfiniteLineLength) const; 123 bool childPreferredMainAxisContentExtentRequiresLayout(RenderBox& child, boo l hasInfiniteLineLength) const;
124 bool needToStretchChildLogicalHeight(RenderBox* child) const; 124 bool needToStretchChildLogicalHeight(RenderBox& child) const;
125 125
126 void layoutFlexItems(bool relayoutChildren); 126 void layoutFlexItems(bool relayoutChildren);
127 LayoutUnit autoMarginOffsetInMainAxis(const OrderedFlexItemList&, LayoutUnit & availableFreeSpace); 127 LayoutUnit autoMarginOffsetInMainAxis(const OrderedFlexItemList&, LayoutUnit & availableFreeSpace);
128 void updateAutoMarginsInMainAxis(RenderBox* child, LayoutUnit autoMarginOffs et); 128 void updateAutoMarginsInMainAxis(RenderBox* child, LayoutUnit autoMarginOffs et);
129 bool hasAutoMarginsInCrossAxis(RenderBox* child) const; 129 bool hasAutoMarginsInCrossAxis(RenderBox* child) const;
130 bool updateAutoMarginsInCrossAxis(RenderBox* child, LayoutUnit availableAlig nmentSpace); 130 bool updateAutoMarginsInCrossAxis(RenderBox* child, LayoutUnit availableAlig nmentSpace);
131 void repositionLogicalHeightDependentFlexItems(Vector<LineContext>&); 131 void repositionLogicalHeightDependentFlexItems(Vector<LineContext>&);
132 LayoutUnit clientLogicalBottomAfterRepositioning(); 132 LayoutUnit clientLogicalBottomAfterRepositioning();
133 void appendChildFrameRects(ChildFrameRects&); 133 void appendChildFrameRects(ChildFrameRects&);
134 134
135 LayoutUnit availableAlignmentSpaceForChild(LayoutUnit lineCrossAxisExtent, R enderBox*); 135 LayoutUnit availableAlignmentSpaceForChild(LayoutUnit lineCrossAxisExtent, R enderBox*);
136 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit lineCr ossAxisExtent, RenderBox*); 136 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit lineCr ossAxisExtent, RenderBox*);
137 LayoutUnit marginBoxAscentForChild(RenderBox*); 137 LayoutUnit marginBoxAscentForChild(RenderBox*);
138 138
139 LayoutUnit computeChildMarginValue(Length margin); 139 LayoutUnit computeChildMarginValue(Length margin);
140 void prepareOrderIteratorAndMargins(); 140 void prepareOrderIteratorAndMargins();
141 LayoutUnit adjustChildSizeForMinAndMax(RenderBox*, LayoutUnit childSize); 141 LayoutUnit adjustChildSizeForMinAndMax(RenderBox*, LayoutUnit childSize);
142 // The hypothetical main size of an item is the flex base size clamped accor ding to its min and max main size properties 142 // The hypothetical main size of an item is the flex base size clamped accor ding to its min and max main size properties
143 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s umFlexBaseSize, double& totalFlexGrow, double& totalWeightedFlexShrink, LayoutUn it& sumHypotheticalMainSize, bool& hasInfiniteLineLength, bool relayoutChildren) ; 143 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s umFlexBaseSize, double& totalFlexGrow, double& totalWeightedFlexShrink, LayoutUn it& sumHypotheticalMainSize, bool& hasInfiniteLineLength, bool relayoutChildren) ;
144 144
145 bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit & availableFreeSpace, double& totalFlexGrow, double& totalWeightedFlexShrink, In flexibleFlexItemSize&, Vector<LayoutUnit, 16>& childSizes, bool hasInfiniteLineL ength); 145 bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit & availableFreeSpace, double& totalFlexGrow, double& totalWeightedFlexShrink, In flexibleFlexItemSize&, Vector<LayoutUnit, 16>& childSizes, bool hasInfiniteLineL ength);
146 void freezeViolations(const Vector<Violation>&, LayoutUnit& availableFreeSpa ce, double& totalFlexGrow, double& totalWeightedFlexShrink, InflexibleFlexItemSi ze&, bool hasInfiniteLineLength); 146 void freezeViolations(const Vector<Violation>&, LayoutUnit& availableFreeSpa ce, double& totalFlexGrow, double& totalWeightedFlexShrink, InflexibleFlexItemSi ze&, bool hasInfiniteLineLength);
147 147
148 void resetAutoMarginsAndLogicalTopInCrossAxis(RenderBox*); 148 void resetAutoMarginsAndLogicalTopInCrossAxis(RenderBox*);
149 void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize) ; 149 void setLogicalOverrideSize(RenderBox& child, LayoutUnit childPreferredSize) ;
150 void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOf fset, LayoutUnit crossAxisOffset, PositionedLayoutMode); 150 void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOf fset, LayoutUnit crossAxisOffset, PositionedLayoutMode);
151 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const; 151 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const;
152 void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexIt emList&, const Vector<LayoutUnit, 16>& childSizes, LayoutUnit availableFreeSpace , bool relayoutChildren, Vector<LineContext>&, bool hasInfiniteLineLength); 152 void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexIt emList&, const Vector<LayoutUnit, 16>& childSizes, LayoutUnit availableFreeSpace , bool relayoutChildren, Vector<LineContext>&, bool hasInfiniteLineLength);
153 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff set, LayoutUnit availableFreeSpace); 153 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff set, LayoutUnit availableFreeSpace);
154 void alignFlexLines(Vector<LineContext>&); 154 void alignFlexLines(Vector<LineContext>&);
155 void alignChildren(const Vector<LineContext>&); 155 void alignChildren(const Vector<LineContext>&);
156 void applyStretchAlignmentToChild(RenderBox*, LayoutUnit lineCrossAxisExtent ); 156 void applyStretchAlignmentToChild(RenderBox*, LayoutUnit lineCrossAxisExtent );
157 void flipForRightToLeftColumn(); 157 void flipForRightToLeftColumn();
158 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar tEdge); 158 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar tEdge);
159 159
160 // This is used to cache the preferred size for orthogonal flow children so we don't have to relayout to get it 160 // This is used to cache the preferred size for orthogonal flow children so we don't have to relayout to get it
161 HashMap<const RenderObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; 161 HashMap<const RenderObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis;
162 162
163 mutable OrderIterator m_orderIterator; 163 mutable OrderIterator m_orderIterator;
164 int m_numberOfInFlowChildrenOnFirstLine; 164 int m_numberOfInFlowChildrenOnFirstLine;
165 }; 165 };
166 166
167 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderFlexibleBox, isFlexibleBox()); 167 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderFlexibleBox, isFlexibleBox());
168 168
169 } // namespace blink 169 } // namespace blink
170 170
171 #endif // RenderFlexibleBox_h 171 #endif // RenderFlexibleBox_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698