OLD | NEW |
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode di
rection, LinePositionMode mode) const | 119 int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode di
rection, LinePositionMode mode) const |
120 { | 120 { |
121 ASSERT(mode == PositionOnContainingLine); | 121 ASSERT(mode == PositionOnContainingLine); |
122 int baseline = firstLineBoxBaseline(); | 122 int baseline = firstLineBoxBaseline(); |
123 if (baseline == -1) | 123 if (baseline == -1) |
124 baseline = synthesizedBaselineFromContentBox(this, direction); | 124 baseline = synthesizedBaselineFromContentBox(this, direction); |
125 | 125 |
126 return beforeMarginInLineDirection(direction) + baseline; | 126 return beforeMarginInLineDirection(direction) + baseline; |
127 } | 127 } |
128 | 128 |
129 int RenderFlexibleBox::firstLineBoxBaseline() const | 129 int RenderFlexibleBox::firstLineBoxBaseline(bool autoBaseline, FontBaseline base
lineType) const |
130 { | 130 { |
131 if (m_numberOfInFlowChildrenOnFirstLine <= 0) | 131 if (m_numberOfInFlowChildrenOnFirstLine <= 0) |
132 return -1; | 132 return -1; |
133 RenderBox* baselineChild = 0; | 133 RenderBox* baselineChild = 0; |
134 int childNumber = 0; | 134 int childNumber = 0; |
135 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera
tor.next()) { | 135 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera
tor.next()) { |
136 if (child->isOutOfFlowPositioned()) | 136 if (child->isOutOfFlowPositioned()) |
137 continue; | 137 continue; |
138 if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsI
nCrossAxis(child)) { | 138 if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsI
nCrossAxis(child)) { |
139 baselineChild = child; | 139 baselineChild = child; |
140 break; | 140 break; |
141 } | 141 } |
142 if (!baselineChild) | 142 if (!baselineChild) |
143 baselineChild = child; | 143 baselineChild = child; |
144 | 144 |
145 ++childNumber; | 145 ++childNumber; |
146 if (childNumber == m_numberOfInFlowChildrenOnFirstLine) | 146 if (childNumber == m_numberOfInFlowChildrenOnFirstLine) |
147 break; | 147 break; |
148 } | 148 } |
149 | 149 |
150 if (!baselineChild) | 150 if (!baselineChild) |
151 return -1; | 151 return -1; |
152 | 152 |
153 if (!isColumnFlow() && hasOrthogonalFlow(baselineChild)) | 153 if (!isColumnFlow() && hasOrthogonalFlow(baselineChild)) |
154 return crossAxisExtentForChild(baselineChild) + baselineChild->logicalTo
p(); | 154 return crossAxisExtentForChild(baselineChild) + baselineChild->logicalTo
p(); |
155 if (isColumnFlow() && !hasOrthogonalFlow(baselineChild)) | 155 if (isColumnFlow() && !hasOrthogonalFlow(baselineChild)) |
156 return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop
(); | 156 return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop
(); |
157 | 157 |
158 int baseline = baselineChild->firstLineBoxBaseline(); | 158 int baseline = baselineChild->firstLineBoxBaseline(autoBaseline, baselineTyp
e); |
159 if (baseline == -1) { | 159 if (baseline == -1) { |
160 // FIXME: We should pass |direction| into firstLineBoxBaseline and stop
bailing out if we're a writing mode root. | 160 // FIXME: We should pass |direction| into firstLineBoxBaseline and stop
bailing out if we're a writing mode root. |
161 // This would also fix some cases where the flexbox is orthogonal to its
container. | 161 // This would also fix some cases where the flexbox is orthogonal to its
container. |
162 LineDirectionMode direction = HorizontalLine; | 162 LineDirectionMode direction = HorizontalLine; |
163 return synthesizedBaselineFromContentBox(baselineChild, direction) + bas
elineChild->logicalTop(); | 163 return synthesizedBaselineFromContentBox(baselineChild, direction) + bas
elineChild->logicalTop(); |
164 } | 164 } |
165 | 165 |
166 return baseline + baselineChild->logicalTop(); | 166 return baseline + baselineChild->logicalTop(); |
167 } | 167 } |
168 | 168 |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 ASSERT(child); | 1246 ASSERT(child); |
1247 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1247 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
1248 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1248 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
1249 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1249 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
1250 adjustAlignmentForChild(child, newOffset - originalOffset); | 1250 adjustAlignmentForChild(child, newOffset - originalOffset); |
1251 } | 1251 } |
1252 } | 1252 } |
1253 } | 1253 } |
1254 | 1254 |
1255 } | 1255 } |
OLD | NEW |