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

Side by Side Diff: Source/core/rendering/RenderDeprecatedFlexibleBox.cpp

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * This file is part of the render object implementation for KHTML. 2 * This file is part of the render object implementation for KHTML.
3 * 3 *
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * Copyright (C) 2003 Apple Computer, Inc. 6 * Copyright (C) 2003 Apple Computer, Inc.
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 30 matching lines...) Expand all
41 FlexBoxIterator(RenderDeprecatedFlexibleBox* parent) 41 FlexBoxIterator(RenderDeprecatedFlexibleBox* parent)
42 : m_box(parent) 42 : m_box(parent)
43 , m_largestOrdinal(1) 43 , m_largestOrdinal(1)
44 { 44 {
45 if (m_box->style()->boxOrient() == HORIZONTAL && !m_box->style()->isLeft ToRightDirection()) 45 if (m_box->style()->boxOrient() == HORIZONTAL && !m_box->style()->isLeft ToRightDirection())
46 m_forward = m_box->style()->boxDirection() != BNORMAL; 46 m_forward = m_box->style()->boxDirection() != BNORMAL;
47 else 47 else
48 m_forward = m_box->style()->boxDirection() == BNORMAL; 48 m_forward = m_box->style()->boxDirection() == BNORMAL;
49 if (!m_forward) { 49 if (!m_forward) {
50 // No choice, since we're going backwards, we have to find out the h ighest ordinal up front. 50 // No choice, since we're going backwards, we have to find out the h ighest ordinal up front.
51 RenderBox* child = m_box->firstChildBox(); 51 LayoutBox* child = m_box->firstChildBox();
52 while (child) { 52 while (child) {
53 if (child->style()->boxOrdinalGroup() > m_largestOrdinal) 53 if (child->style()->boxOrdinalGroup() > m_largestOrdinal)
54 m_largestOrdinal = child->style()->boxOrdinalGroup(); 54 m_largestOrdinal = child->style()->boxOrdinalGroup();
55 child = child->nextSiblingBox(); 55 child = child->nextSiblingBox();
56 } 56 }
57 } 57 }
58 58
59 reset(); 59 reset();
60 } 60 }
61 61
62 void reset() 62 void reset()
63 { 63 {
64 m_currentChild = 0; 64 m_currentChild = 0;
65 m_ordinalIteration = -1; 65 m_ordinalIteration = -1;
66 } 66 }
67 67
68 RenderBox* first() 68 LayoutBox* first()
69 { 69 {
70 reset(); 70 reset();
71 return next(); 71 return next();
72 } 72 }
73 73
74 RenderBox* next() 74 LayoutBox* next()
75 { 75 {
76 do { 76 do {
77 if (!m_currentChild) { 77 if (!m_currentChild) {
78 ++m_ordinalIteration; 78 ++m_ordinalIteration;
79 79
80 if (!m_ordinalIteration) 80 if (!m_ordinalIteration)
81 m_currentOrdinal = m_forward ? 1 : m_largestOrdinal; 81 m_currentOrdinal = m_forward ? 1 : m_largestOrdinal;
82 else { 82 else {
83 if (static_cast<size_t>(m_ordinalIteration) >= m_ordinalValu es.size() + 1) 83 if (static_cast<size_t>(m_ordinalIteration) >= m_ordinalValu es.size() + 1)
84 return 0; 84 return 0;
(...skipping 18 matching lines...) Expand all
103 } 103 }
104 104
105 private: 105 private:
106 bool notFirstOrdinalValue() 106 bool notFirstOrdinalValue()
107 { 107 {
108 unsigned int firstOrdinalValue = m_forward ? 1 : m_largestOrdinal; 108 unsigned int firstOrdinalValue = m_forward ? 1 : m_largestOrdinal;
109 return m_currentOrdinal == firstOrdinalValue && m_currentChild->style()- >boxOrdinalGroup() != firstOrdinalValue; 109 return m_currentOrdinal == firstOrdinalValue && m_currentChild->style()- >boxOrdinalGroup() != firstOrdinalValue;
110 } 110 }
111 111
112 RenderDeprecatedFlexibleBox* m_box; 112 RenderDeprecatedFlexibleBox* m_box;
113 RenderBox* m_currentChild; 113 LayoutBox* m_currentChild;
114 bool m_forward; 114 bool m_forward;
115 unsigned int m_currentOrdinal; 115 unsigned int m_currentOrdinal;
116 unsigned int m_largestOrdinal; 116 unsigned int m_largestOrdinal;
117 HashSet<unsigned int> m_ordinalValues; 117 HashSet<unsigned int> m_ordinalValues;
118 Vector<unsigned int> m_sortedOrdinalValues; 118 Vector<unsigned int> m_sortedOrdinalValues;
119 int m_ordinalIteration; 119 int m_ordinalIteration;
120 }; 120 };
121 121
122 RenderDeprecatedFlexibleBox::RenderDeprecatedFlexibleBox(Element& element) 122 RenderDeprecatedFlexibleBox::RenderDeprecatedFlexibleBox(Element& element)
123 : RenderBlock(&element) 123 : RenderBlock(&element)
124 { 124 {
125 ASSERT(!childrenInline()); 125 ASSERT(!childrenInline());
126 m_stretchingChildren = false; 126 m_stretchingChildren = false;
127 if (!isAnonymous()) { 127 if (!isAnonymous()) {
128 const KURL& url = document().url(); 128 const KURL& url = document().url();
129 if (url.protocolIs("chrome")) 129 if (url.protocolIs("chrome"))
130 UseCounter::count(document(), UseCounter::DeprecatedFlexboxChrome); 130 UseCounter::count(document(), UseCounter::DeprecatedFlexboxChrome);
131 else if (url.protocolIs("chrome-extension")) 131 else if (url.protocolIs("chrome-extension"))
132 UseCounter::count(document(), UseCounter::DeprecatedFlexboxChromeExt ension); 132 UseCounter::count(document(), UseCounter::DeprecatedFlexboxChromeExt ension);
133 else 133 else
134 UseCounter::count(document(), UseCounter::DeprecatedFlexboxWebConten t); 134 UseCounter::count(document(), UseCounter::DeprecatedFlexboxWebConten t);
135 } 135 }
136 } 136 }
137 137
138 RenderDeprecatedFlexibleBox::~RenderDeprecatedFlexibleBox() 138 RenderDeprecatedFlexibleBox::~RenderDeprecatedFlexibleBox()
139 { 139 {
140 } 140 }
141 141
142 static LayoutUnit marginWidthForChild(RenderBox* child) 142 static LayoutUnit marginWidthForChild(LayoutBox* child)
143 { 143 {
144 // A margin basically has three types: fixed, percentage, and auto (variable ). 144 // A margin basically has three types: fixed, percentage, and auto (variable ).
145 // Auto and percentage margins simply become 0 when computing min/max width. 145 // Auto and percentage margins simply become 0 when computing min/max width.
146 // Fixed margins can be added in as is. 146 // Fixed margins can be added in as is.
147 Length marginLeft = child->style()->marginLeft(); 147 Length marginLeft = child->style()->marginLeft();
148 Length marginRight = child->style()->marginRight(); 148 Length marginRight = child->style()->marginRight();
149 LayoutUnit margin = 0; 149 LayoutUnit margin = 0;
150 if (marginLeft.isFixed()) 150 if (marginLeft.isFixed())
151 margin += marginLeft.value(); 151 margin += marginLeft.value();
152 if (marginRight.isFixed()) 152 if (marginRight.isFixed())
153 margin += marginRight.value(); 153 margin += marginRight.value();
154 return margin; 154 return margin;
155 } 155 }
156 156
157 static bool childDoesNotAffectWidthOrFlexing(LayoutObject* child) 157 static bool childDoesNotAffectWidthOrFlexing(LayoutObject* child)
158 { 158 {
159 // Positioned children and collapsed children don't affect the min/max width . 159 // Positioned children and collapsed children don't affect the min/max width .
160 return child->isOutOfFlowPositioned() || child->style()->visibility() == COL LAPSE; 160 return child->isOutOfFlowPositioned() || child->style()->visibility() == COL LAPSE;
161 } 161 }
162 162
163 static LayoutUnit contentWidthForChild(RenderBox* child) 163 static LayoutUnit contentWidthForChild(LayoutBox* child)
164 { 164 {
165 if (child->hasOverrideWidth()) 165 if (child->hasOverrideWidth())
166 return child->overrideLogicalContentWidth(); 166 return child->overrideLogicalContentWidth();
167 return child->logicalWidth() - child->borderAndPaddingLogicalWidth(); 167 return child->logicalWidth() - child->borderAndPaddingLogicalWidth();
168 } 168 }
169 169
170 static LayoutUnit contentHeightForChild(RenderBox* child) 170 static LayoutUnit contentHeightForChild(LayoutBox* child)
171 { 171 {
172 if (child->hasOverrideHeight()) 172 if (child->hasOverrideHeight())
173 return child->overrideLogicalContentHeight(); 173 return child->overrideLogicalContentHeight();
174 return child->logicalHeight() - child->borderAndPaddingLogicalHeight(); 174 return child->logicalHeight() - child->borderAndPaddingLogicalHeight();
175 } 175 }
176 176
177 void RenderDeprecatedFlexibleBox::styleWillChange(StyleDifference diff, const La youtStyle& newStyle) 177 void RenderDeprecatedFlexibleBox::styleWillChange(StyleDifference diff, const La youtStyle& newStyle)
178 { 178 {
179 LayoutStyle* oldStyle = style(); 179 LayoutStyle* oldStyle = style();
180 if (oldStyle && !oldStyle->lineClamp().isNone() && newStyle.lineClamp().isNo ne()) 180 if (oldStyle && !oldStyle->lineClamp().isNone() && newStyle.lineClamp().isNo ne())
181 clearLineClamp(); 181 clearLineClamp();
182 182
183 RenderBlock::styleWillChange(diff, newStyle); 183 RenderBlock::styleWillChange(diff, newStyle);
184 } 184 }
185 185
186 void RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minL ogicalWidth, LayoutUnit& maxLogicalWidth) const 186 void RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minL ogicalWidth, LayoutUnit& maxLogicalWidth) const
187 { 187 {
188 if (hasMultipleLines() || isVertical()) { 188 if (hasMultipleLines() || isVertical()) {
189 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) { 189 for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) {
190 if (childDoesNotAffectWidthOrFlexing(child)) 190 if (childDoesNotAffectWidthOrFlexing(child))
191 continue; 191 continue;
192 192
193 LayoutUnit margin = marginWidthForChild(child); 193 LayoutUnit margin = marginWidthForChild(child);
194 LayoutUnit width = child->minPreferredLogicalWidth() + margin; 194 LayoutUnit width = child->minPreferredLogicalWidth() + margin;
195 minLogicalWidth = std::max(width, minLogicalWidth); 195 minLogicalWidth = std::max(width, minLogicalWidth);
196 196
197 width = child->maxPreferredLogicalWidth() + margin; 197 width = child->maxPreferredLogicalWidth() + margin;
198 maxLogicalWidth = std::max(width, maxLogicalWidth); 198 maxLogicalWidth = std::max(width, maxLogicalWidth);
199 } 199 }
200 } else { 200 } else {
201 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) { 201 for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) {
202 if (childDoesNotAffectWidthOrFlexing(child)) 202 if (childDoesNotAffectWidthOrFlexing(child))
203 continue; 203 continue;
204 204
205 LayoutUnit margin = marginWidthForChild(child); 205 LayoutUnit margin = marginWidthForChild(child);
206 minLogicalWidth += child->minPreferredLogicalWidth() + margin; 206 minLogicalWidth += child->minPreferredLogicalWidth() + margin;
207 maxLogicalWidth += child->maxPreferredLogicalWidth() + margin; 207 maxLogicalWidth += child->maxPreferredLogicalWidth() + margin;
208 } 208 }
209 } 209 }
210 210
211 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); 211 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // we overflow or not. 267 // we overflow or not.
268 if (hasOverflowClip()) 268 if (hasOverflowClip())
269 layer()->scrollableArea()->updateAfterLayout(); 269 layer()->scrollableArea()->updateAfterLayout();
270 270
271 clearNeedsLayout(); 271 clearNeedsLayout();
272 } 272 }
273 273
274 // The first walk over our kids is to find out if we have any flexible children. 274 // The first walk over our kids is to find out if we have any flexible children.
275 static void gatherFlexChildrenInfo(FlexBoxIterator& iterator, bool relayoutChild ren, unsigned int& highestFlexGroup, unsigned int& lowestFlexGroup, bool& haveFl ex) 275 static void gatherFlexChildrenInfo(FlexBoxIterator& iterator, bool relayoutChild ren, unsigned int& highestFlexGroup, unsigned int& lowestFlexGroup, bool& haveFl ex)
276 { 276 {
277 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { 277 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
278 // Check to see if this child flexes. 278 // Check to see if this child flexes.
279 if (!childDoesNotAffectWidthOrFlexing(child) && child->style()->boxFlex( ) > 0.0f) { 279 if (!childDoesNotAffectWidthOrFlexing(child) && child->style()->boxFlex( ) > 0.0f) {
280 // We always have to lay out flexible objects again, since the flex distribution 280 // We always have to lay out flexible objects again, since the flex distribution
281 // may have changed, and we need to reallocate space. 281 // may have changed, and we need to reallocate space.
282 child->clearOverrideSize(); 282 child->clearOverrideSize();
283 if (!relayoutChildren) 283 if (!relayoutChildren)
284 child->setChildNeedsLayout(MarkOnlyThis); 284 child->setChildNeedsLayout(MarkOnlyThis);
285 haveFlex = true; 285 haveFlex = true;
286 unsigned int flexGroup = child->style()->boxFlexGroup(); 286 unsigned int flexGroup = child->style()->boxFlexGroup();
287 if (lowestFlexGroup == 0) 287 if (lowestFlexGroup == 0)
(...skipping 30 matching lines...) Expand all
318 do { 318 do {
319 // Reset our height. 319 // Reset our height.
320 setHeight(yPos); 320 setHeight(yPos);
321 321
322 xPos = borderLeft() + paddingLeft(); 322 xPos = borderLeft() + paddingLeft();
323 323
324 // Our first pass is done without flexing. We simply lay the children 324 // Our first pass is done without flexing. We simply lay the children
325 // out within the box. We have to do a layout first in order to determi ne 325 // out within the box. We have to do a layout first in order to determi ne
326 // our box's intrinsic height. 326 // our box's intrinsic height.
327 LayoutUnit maxAscent = 0, maxDescent = 0; 327 LayoutUnit maxAscent = 0, maxDescent = 0;
328 for (RenderBox* child = iterator.first(); child; child = iterator.next() ) { 328 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) {
329 if (child->isOutOfFlowPositioned()) 329 if (child->isOutOfFlowPositioned())
330 continue; 330 continue;
331 331
332 SubtreeLayoutScope layoutScope(*child); 332 SubtreeLayoutScope layoutScope(*child);
333 if (relayoutChildren || (child->isReplaced() && (child->style()->wid th().isPercent() || child->style()->height().isPercent()))) 333 if (relayoutChildren || (child->isReplaced() && (child->style()->wid th().isPercent() || child->style()->height().isPercent())))
334 layoutScope.setChildNeedsLayout(child); 334 layoutScope.setChildNeedsLayout(child);
335 335
336 // Compute the child's vertical margins. 336 // Compute the child's vertical margins.
337 child->computeAndSetBlockDirectionMargins(this); 337 child->computeAndSetBlockDirectionMargins(this);
338 338
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 oldHeight = size().height(); 371 oldHeight = size().height();
372 updateLogicalHeight(); 372 updateLogicalHeight();
373 373
374 relayoutChildren = false; 374 relayoutChildren = false;
375 if (oldHeight != size().height()) 375 if (oldHeight != size().height())
376 heightSpecified = true; 376 heightSpecified = true;
377 377
378 // Now that our height is actually known, we can place our boxes. 378 // Now that our height is actually known, we can place our boxes.
379 m_stretchingChildren = (style()->boxAlign() == BSTRETCH); 379 m_stretchingChildren = (style()->boxAlign() == BSTRETCH);
380 for (RenderBox* child = iterator.first(); child; child = iterator.next() ) { 380 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) {
381 if (child->isOutOfFlowPositioned()) { 381 if (child->isOutOfFlowPositioned()) {
382 child->containingBlock()->insertPositionedObject(child); 382 child->containingBlock()->insertPositionedObject(child);
383 Layer* childLayer = child->layer(); 383 Layer* childLayer = child->layer();
384 childLayer->setStaticInlinePosition(xPos); 384 childLayer->setStaticInlinePosition(xPos);
385 if (childLayer->staticBlockPosition() != yPos) { 385 if (childLayer->staticBlockPosition() != yPos) {
386 childLayer->setStaticBlockPosition(yPos); 386 childLayer->setStaticBlockPosition(yPos);
387 if (child->style()->hasStaticBlockPosition(style()->isHorizo ntalWritingMode())) 387 if (child->style()->hasStaticBlockPosition(style()->isHorizo ntalWritingMode()))
388 child->setChildNeedsLayout(MarkOnlyThis); 388 child->setChildNeedsLayout(MarkOnlyThis);
389 } 389 }
390 continue; 390 continue;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 for (unsigned i = start; i <= end && remainingSpace; i++) { 459 for (unsigned i = start; i <= end && remainingSpace; i++) {
460 // Always start off by assuming the group can get all the remain ing space. 460 // Always start off by assuming the group can get all the remain ing space.
461 LayoutUnit groupRemainingSpace = remainingSpace; 461 LayoutUnit groupRemainingSpace = remainingSpace;
462 do { 462 do {
463 // Flexing consists of multiple passes, since we have to cha nge ratios every time an object hits its max/min-width 463 // Flexing consists of multiple passes, since we have to cha nge ratios every time an object hits its max/min-width
464 // For a given pass, we always start off by computing the to talFlex of all objects that can grow/shrink at all, and 464 // For a given pass, we always start off by computing the to talFlex of all objects that can grow/shrink at all, and
465 // computing the allowed growth before an object hits its mi n/max width (and thus 465 // computing the allowed growth before an object hits its mi n/max width (and thus
466 // forces a totalFlex recomputation). 466 // forces a totalFlex recomputation).
467 LayoutUnit groupRemainingSpaceAtBeginning = groupRemainingSp ace; 467 LayoutUnit groupRemainingSpaceAtBeginning = groupRemainingSp ace;
468 float totalFlex = 0.0f; 468 float totalFlex = 0.0f;
469 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) { 469 for (LayoutBox* child = iterator.first(); child; child = ite rator.next()) {
470 if (allowedChildFlex(child, expanding, i)) 470 if (allowedChildFlex(child, expanding, i))
471 totalFlex += child->style()->boxFlex(); 471 totalFlex += child->style()->boxFlex();
472 } 472 }
473 LayoutUnit spaceAvailableThisPass = groupRemainingSpace; 473 LayoutUnit spaceAvailableThisPass = groupRemainingSpace;
474 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) { 474 for (LayoutBox* child = iterator.first(); child; child = ite rator.next()) {
475 LayoutUnit allowedFlex = allowedChildFlex(child, expandi ng, i); 475 LayoutUnit allowedFlex = allowedChildFlex(child, expandi ng, i);
476 if (allowedFlex) { 476 if (allowedFlex) {
477 LayoutUnit projectedFlex = (allowedFlex == LayoutUni t::max()) ? allowedFlex : LayoutUnit(allowedFlex * (totalFlex / child->style()-> boxFlex())); 477 LayoutUnit projectedFlex = (allowedFlex == LayoutUni t::max()) ? allowedFlex : LayoutUnit(allowedFlex * (totalFlex / child->style()-> boxFlex()));
478 spaceAvailableThisPass = expanding ? std::min(spaceA vailableThisPass, projectedFlex) : std::max(spaceAvailableThisPass, projectedFle x); 478 spaceAvailableThisPass = expanding ? std::min(spaceA vailableThisPass, projectedFlex) : std::max(spaceAvailableThisPass, projectedFle x);
479 } 479 }
480 } 480 }
481 481
482 // The flex groups may not have any flexible objects this ti me around. 482 // The flex groups may not have any flexible objects this ti me around.
483 if (!spaceAvailableThisPass || totalFlex == 0.0f) { 483 if (!spaceAvailableThisPass || totalFlex == 0.0f) {
484 // If we just couldn't grow/shrink any more, then it's t ime to transition to the next flex group. 484 // If we just couldn't grow/shrink any more, then it's t ime to transition to the next flex group.
485 groupRemainingSpace = 0; 485 groupRemainingSpace = 0;
486 continue; 486 continue;
487 } 487 }
488 488
489 // Now distribute the space to objects. 489 // Now distribute the space to objects.
490 for (RenderBox* child = iterator.first(); child && spaceAvai lableThisPass && totalFlex; child = iterator.next()) { 490 for (LayoutBox* child = iterator.first(); child && spaceAvai lableThisPass && totalFlex; child = iterator.next()) {
491 if (child->style()->visibility() == COLLAPSE) 491 if (child->style()->visibility() == COLLAPSE)
492 continue; 492 continue;
493 493
494 if (allowedChildFlex(child, expanding, i)) { 494 if (allowedChildFlex(child, expanding, i)) {
495 LayoutUnit spaceAdd = LayoutUnit(spaceAvailableThisP ass * (child->style()->boxFlex() / totalFlex)); 495 LayoutUnit spaceAdd = LayoutUnit(spaceAvailableThisP ass * (child->style()->boxFlex() / totalFlex));
496 if (spaceAdd) { 496 if (spaceAdd) {
497 child->setOverrideLogicalContentWidth(contentWid thForChild(child) + spaceAdd); 497 child->setOverrideLogicalContentWidth(contentWid thForChild(child) + spaceAdd);
498 flexingChildren = true; 498 flexingChildren = true;
499 relayoutChildren = true; 499 relayoutChildren = true;
500 } 500 }
501 501
502 spaceAvailableThisPass -= spaceAdd; 502 spaceAvailableThisPass -= spaceAdd;
503 remainingSpace -= spaceAdd; 503 remainingSpace -= spaceAdd;
504 groupRemainingSpace -= spaceAdd; 504 groupRemainingSpace -= spaceAdd;
505 505
506 totalFlex -= child->style()->boxFlex(); 506 totalFlex -= child->style()->boxFlex();
507 } 507 }
508 } 508 }
509 if (groupRemainingSpace == groupRemainingSpaceAtBeginning) { 509 if (groupRemainingSpace == groupRemainingSpaceAtBeginning) {
510 // This is not advancing, avoid getting stuck by distrib uting the remaining pixels. 510 // This is not advancing, avoid getting stuck by distrib uting the remaining pixels.
511 LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1; 511 LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1;
512 for (RenderBox* child = iterator.first(); child && group RemainingSpace; child = iterator.next()) { 512 for (LayoutBox* child = iterator.first(); child && group RemainingSpace; child = iterator.next()) {
513 if (allowedChildFlex(child, expanding, i)) { 513 if (allowedChildFlex(child, expanding, i)) {
514 child->setOverrideLogicalContentWidth(contentWid thForChild(child) + spaceAdd); 514 child->setOverrideLogicalContentWidth(contentWid thForChild(child) + spaceAdd);
515 flexingChildren = true; 515 flexingChildren = true;
516 relayoutChildren = true; 516 relayoutChildren = true;
517 remainingSpace -= spaceAdd; 517 remainingSpace -= spaceAdd;
518 groupRemainingSpace -= spaceAdd; 518 groupRemainingSpace -= spaceAdd;
519 } 519 }
520 } 520 }
521 } 521 }
522 } while (absoluteValue(groupRemainingSpace) >= 1); 522 } while (absoluteValue(groupRemainingSpace) >= 1);
523 } 523 }
524 524
525 // We didn't find any children that could grow. 525 // We didn't find any children that could grow.
526 if (haveFlex && !flexingChildren) 526 if (haveFlex && !flexingChildren)
527 haveFlex = false; 527 haveFlex = false;
528 } 528 }
529 } while (haveFlex); 529 } while (haveFlex);
530 530
531 RenderBlock::finishDelayUpdateScrollInfo(); 531 RenderBlock::finishDelayUpdateScrollInfo();
532 532
533 if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->bo xPack() != Start) 533 if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->bo xPack() != Start)
534 || (!style()->isLeftToRightDirection() && style()->boxPack() != End))) { 534 || (!style()->isLeftToRightDirection() && style()->boxPack() != End))) {
535 // Children must be repositioned. 535 // Children must be repositioned.
536 LayoutUnit offset = 0; 536 LayoutUnit offset = 0;
537 if (style()->boxPack() == Justify) { 537 if (style()->boxPack() == Justify) {
538 // Determine the total number of children. 538 // Determine the total number of children.
539 int totalChildren = 0; 539 int totalChildren = 0;
540 for (RenderBox* child = iterator.first(); child; child = iterator.ne xt()) { 540 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) {
541 if (childDoesNotAffectWidthOrFlexing(child)) 541 if (childDoesNotAffectWidthOrFlexing(child))
542 continue; 542 continue;
543 ++totalChildren; 543 ++totalChildren;
544 } 544 }
545 545
546 // Iterate over the children and space them out according to the 546 // Iterate over the children and space them out according to the
547 // justification level. 547 // justification level.
548 if (totalChildren > 1) { 548 if (totalChildren > 1) {
549 --totalChildren; 549 --totalChildren;
550 bool firstChild = true; 550 bool firstChild = true;
551 for (RenderBox* child = iterator.first(); child; child = iterato r.next()) { 551 for (LayoutBox* child = iterator.first(); child; child = iterato r.next()) {
552 if (childDoesNotAffectWidthOrFlexing(child)) 552 if (childDoesNotAffectWidthOrFlexing(child))
553 continue; 553 continue;
554 554
555 if (firstChild) { 555 if (firstChild) {
556 firstChild = false; 556 firstChild = false;
557 continue; 557 continue;
558 } 558 }
559 559
560 offset += remainingSpace/totalChildren; 560 offset += remainingSpace/totalChildren;
561 remainingSpace -= (remainingSpace/totalChildren); 561 remainingSpace -= (remainingSpace/totalChildren);
562 --totalChildren; 562 --totalChildren;
563 563
564 placeChild(child, child->location() + LayoutSize(offset, 0)) ; 564 placeChild(child, child->location() + LayoutSize(offset, 0)) ;
565 } 565 }
566 } 566 }
567 } else { 567 } else {
568 if (style()->boxPack() == Center) 568 if (style()->boxPack() == Center)
569 offset += remainingSpace / 2; 569 offset += remainingSpace / 2;
570 else // END for LTR, START for RTL 570 else // END for LTR, START for RTL
571 offset += remainingSpace; 571 offset += remainingSpace;
572 for (RenderBox* child = iterator.first(); child; child = iterator.ne xt()) { 572 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) {
573 if (childDoesNotAffectWidthOrFlexing(child)) 573 if (childDoesNotAffectWidthOrFlexing(child))
574 continue; 574 continue;
575 575
576 placeChild(child, child->location() + LayoutSize(offset, 0)); 576 placeChild(child, child->location() + LayoutSize(offset, 0));
577 } 577 }
578 } 578 }
579 } 579 }
580 580
581 // So that the computeLogicalHeight in layoutBlock() knows to relayout posit ioned objects because of 581 // So that the computeLogicalHeight in layoutBlock() knows to relayout posit ioned objects because of
582 // a height change, we revert our height back to the intrinsic height before returning. 582 // a height change, we revert our height back to the intrinsic height before returning.
(...skipping 25 matching lines...) Expand all
608 RenderBlock::startDelayUpdateScrollInfo(); 608 RenderBlock::startDelayUpdateScrollInfo();
609 609
610 // We do 2 passes. The first pass is simply to lay everyone out at 610 // We do 2 passes. The first pass is simply to lay everyone out at
611 // their preferred widths. The second pass handles flexing the children. 611 // their preferred widths. The second pass handles flexing the children.
612 // Our first pass is done without flexing. We simply lay the children 612 // Our first pass is done without flexing. We simply lay the children
613 // out within the box. 613 // out within the box.
614 do { 614 do {
615 setHeight(borderTop() + paddingTop()); 615 setHeight(borderTop() + paddingTop());
616 LayoutUnit minHeight = size().height() + toAdd; 616 LayoutUnit minHeight = size().height() + toAdd;
617 617
618 for (RenderBox* child = iterator.first(); child; child = iterator.next() ) { 618 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) {
619 if (child->isOutOfFlowPositioned()) { 619 if (child->isOutOfFlowPositioned()) {
620 child->containingBlock()->insertPositionedObject(child); 620 child->containingBlock()->insertPositionedObject(child);
621 Layer* childLayer = child->layer(); 621 Layer* childLayer = child->layer();
622 childLayer->setStaticInlinePosition(borderStart() + paddingStart ()); 622 childLayer->setStaticInlinePosition(borderStart() + paddingStart ());
623 if (childLayer->staticBlockPosition() != size().height()) { 623 if (childLayer->staticBlockPosition() != size().height()) {
624 childLayer->setStaticBlockPosition(size().height()); 624 childLayer->setStaticBlockPosition(size().height());
625 if (child->style()->hasStaticBlockPosition(style()->isHorizo ntalWritingMode())) 625 if (child->style()->hasStaticBlockPosition(style()->isHorizo ntalWritingMode()))
626 child->setChildNeedsLayout(MarkOnlyThis); 626 child->setChildNeedsLayout(MarkOnlyThis);
627 } 627 }
628 continue; 628 continue;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 for (unsigned i = start; i <= end && remainingSpace; i++) { 713 for (unsigned i = start; i <= end && remainingSpace; i++) {
714 // Always start off by assuming the group can get all the remain ing space. 714 // Always start off by assuming the group can get all the remain ing space.
715 LayoutUnit groupRemainingSpace = remainingSpace; 715 LayoutUnit groupRemainingSpace = remainingSpace;
716 do { 716 do {
717 // Flexing consists of multiple passes, since we have to cha nge ratios every time an object hits its max/min-width 717 // Flexing consists of multiple passes, since we have to cha nge ratios every time an object hits its max/min-width
718 // For a given pass, we always start off by computing the to talFlex of all objects that can grow/shrink at all, and 718 // For a given pass, we always start off by computing the to talFlex of all objects that can grow/shrink at all, and
719 // computing the allowed growth before an object hits its mi n/max width (and thus 719 // computing the allowed growth before an object hits its mi n/max width (and thus
720 // forces a totalFlex recomputation). 720 // forces a totalFlex recomputation).
721 LayoutUnit groupRemainingSpaceAtBeginning = groupRemainingSp ace; 721 LayoutUnit groupRemainingSpaceAtBeginning = groupRemainingSp ace;
722 float totalFlex = 0.0f; 722 float totalFlex = 0.0f;
723 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) { 723 for (LayoutBox* child = iterator.first(); child; child = ite rator.next()) {
724 if (allowedChildFlex(child, expanding, i)) 724 if (allowedChildFlex(child, expanding, i))
725 totalFlex += child->style()->boxFlex(); 725 totalFlex += child->style()->boxFlex();
726 } 726 }
727 LayoutUnit spaceAvailableThisPass = groupRemainingSpace; 727 LayoutUnit spaceAvailableThisPass = groupRemainingSpace;
728 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) { 728 for (LayoutBox* child = iterator.first(); child; child = ite rator.next()) {
729 LayoutUnit allowedFlex = allowedChildFlex(child, expandi ng, i); 729 LayoutUnit allowedFlex = allowedChildFlex(child, expandi ng, i);
730 if (allowedFlex) { 730 if (allowedFlex) {
731 LayoutUnit projectedFlex = (allowedFlex == LayoutUni t::max()) ? allowedFlex : static_cast<LayoutUnit>(allowedFlex * (totalFlex / chi ld->style()->boxFlex())); 731 LayoutUnit projectedFlex = (allowedFlex == LayoutUni t::max()) ? allowedFlex : static_cast<LayoutUnit>(allowedFlex * (totalFlex / chi ld->style()->boxFlex()));
732 spaceAvailableThisPass = expanding ? std::min(spaceA vailableThisPass, projectedFlex) : std::max(spaceAvailableThisPass, projectedFle x); 732 spaceAvailableThisPass = expanding ? std::min(spaceA vailableThisPass, projectedFlex) : std::max(spaceAvailableThisPass, projectedFle x);
733 } 733 }
734 } 734 }
735 735
736 // The flex groups may not have any flexible objects this ti me around. 736 // The flex groups may not have any flexible objects this ti me around.
737 if (!spaceAvailableThisPass || totalFlex == 0.0f) { 737 if (!spaceAvailableThisPass || totalFlex == 0.0f) {
738 // If we just couldn't grow/shrink any more, then it's t ime to transition to the next flex group. 738 // If we just couldn't grow/shrink any more, then it's t ime to transition to the next flex group.
739 groupRemainingSpace = 0; 739 groupRemainingSpace = 0;
740 continue; 740 continue;
741 } 741 }
742 742
743 // Now distribute the space to objects. 743 // Now distribute the space to objects.
744 for (RenderBox* child = iterator.first(); child && spaceAvai lableThisPass && totalFlex; child = iterator.next()) { 744 for (LayoutBox* child = iterator.first(); child && spaceAvai lableThisPass && totalFlex; child = iterator.next()) {
745 if (allowedChildFlex(child, expanding, i)) { 745 if (allowedChildFlex(child, expanding, i)) {
746 LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceA vailableThisPass * (child->style()->boxFlex() / totalFlex)); 746 LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceA vailableThisPass * (child->style()->boxFlex() / totalFlex));
747 if (spaceAdd) { 747 if (spaceAdd) {
748 child->setOverrideLogicalContentHeight(contentHe ightForChild(child) + spaceAdd); 748 child->setOverrideLogicalContentHeight(contentHe ightForChild(child) + spaceAdd);
749 flexingChildren = true; 749 flexingChildren = true;
750 relayoutChildren = true; 750 relayoutChildren = true;
751 } 751 }
752 752
753 spaceAvailableThisPass -= spaceAdd; 753 spaceAvailableThisPass -= spaceAdd;
754 remainingSpace -= spaceAdd; 754 remainingSpace -= spaceAdd;
755 groupRemainingSpace -= spaceAdd; 755 groupRemainingSpace -= spaceAdd;
756 756
757 totalFlex -= child->style()->boxFlex(); 757 totalFlex -= child->style()->boxFlex();
758 } 758 }
759 } 759 }
760 if (groupRemainingSpace == groupRemainingSpaceAtBeginning) { 760 if (groupRemainingSpace == groupRemainingSpaceAtBeginning) {
761 // This is not advancing, avoid getting stuck by distrib uting the remaining pixels. 761 // This is not advancing, avoid getting stuck by distrib uting the remaining pixels.
762 LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1; 762 LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1;
763 for (RenderBox* child = iterator.first(); child && group RemainingSpace; child = iterator.next()) { 763 for (LayoutBox* child = iterator.first(); child && group RemainingSpace; child = iterator.next()) {
764 if (allowedChildFlex(child, expanding, i)) { 764 if (allowedChildFlex(child, expanding, i)) {
765 child->setOverrideLogicalContentHeight(contentHe ightForChild(child) + spaceAdd); 765 child->setOverrideLogicalContentHeight(contentHe ightForChild(child) + spaceAdd);
766 flexingChildren = true; 766 flexingChildren = true;
767 relayoutChildren = true; 767 relayoutChildren = true;
768 remainingSpace -= spaceAdd; 768 remainingSpace -= spaceAdd;
769 groupRemainingSpace -= spaceAdd; 769 groupRemainingSpace -= spaceAdd;
770 } 770 }
771 } 771 }
772 } 772 }
773 } while (absoluteValue(groupRemainingSpace) >= 1); 773 } while (absoluteValue(groupRemainingSpace) >= 1);
774 } 774 }
775 775
776 // We didn't find any children that could grow. 776 // We didn't find any children that could grow.
777 if (haveFlex && !flexingChildren) 777 if (haveFlex && !flexingChildren)
778 haveFlex = false; 778 haveFlex = false;
779 } 779 }
780 } while (haveFlex); 780 } while (haveFlex);
781 781
782 RenderBlock::finishDelayUpdateScrollInfo(); 782 RenderBlock::finishDelayUpdateScrollInfo();
783 783
784 if (style()->boxPack() != Start && remainingSpace > 0) { 784 if (style()->boxPack() != Start && remainingSpace > 0) {
785 // Children must be repositioned. 785 // Children must be repositioned.
786 LayoutUnit offset = 0; 786 LayoutUnit offset = 0;
787 if (style()->boxPack() == Justify) { 787 if (style()->boxPack() == Justify) {
788 // Determine the total number of children. 788 // Determine the total number of children.
789 int totalChildren = 0; 789 int totalChildren = 0;
790 for (RenderBox* child = iterator.first(); child; child = iterator.ne xt()) { 790 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) {
791 if (childDoesNotAffectWidthOrFlexing(child)) 791 if (childDoesNotAffectWidthOrFlexing(child))
792 continue; 792 continue;
793 793
794 ++totalChildren; 794 ++totalChildren;
795 } 795 }
796 796
797 // Iterate over the children and space them out according to the 797 // Iterate over the children and space them out according to the
798 // justification level. 798 // justification level.
799 if (totalChildren > 1) { 799 if (totalChildren > 1) {
800 --totalChildren; 800 --totalChildren;
801 bool firstChild = true; 801 bool firstChild = true;
802 for (RenderBox* child = iterator.first(); child; child = iterato r.next()) { 802 for (LayoutBox* child = iterator.first(); child; child = iterato r.next()) {
803 if (childDoesNotAffectWidthOrFlexing(child)) 803 if (childDoesNotAffectWidthOrFlexing(child))
804 continue; 804 continue;
805 805
806 if (firstChild) { 806 if (firstChild) {
807 firstChild = false; 807 firstChild = false;
808 continue; 808 continue;
809 } 809 }
810 810
811 offset += remainingSpace/totalChildren; 811 offset += remainingSpace/totalChildren;
812 remainingSpace -= (remainingSpace/totalChildren); 812 remainingSpace -= (remainingSpace/totalChildren);
813 --totalChildren; 813 --totalChildren;
814 placeChild(child, child->location() + LayoutSize(0, offset)) ; 814 placeChild(child, child->location() + LayoutSize(0, offset)) ;
815 } 815 }
816 } 816 }
817 } else { 817 } else {
818 if (style()->boxPack() == Center) 818 if (style()->boxPack() == Center)
819 offset += remainingSpace / 2; 819 offset += remainingSpace / 2;
820 else // END 820 else // END
821 offset += remainingSpace; 821 offset += remainingSpace;
822 for (RenderBox* child = iterator.first(); child; child = iterator.ne xt()) { 822 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) {
823 if (childDoesNotAffectWidthOrFlexing(child)) 823 if (childDoesNotAffectWidthOrFlexing(child))
824 continue; 824 continue;
825 placeChild(child, child->location() + LayoutSize(0, offset)); 825 placeChild(child, child->location() + LayoutSize(0, offset));
826 } 826 }
827 } 827 }
828 } 828 }
829 829
830 // So that the computeLogicalHeight in layoutBlock() knows to relayout posit ioned objects because of 830 // So that the computeLogicalHeight in layoutBlock() knows to relayout posit ioned objects because of
831 // a height change, we revert our height back to the intrinsic height before returning. 831 // a height change, we revert our height back to the intrinsic height before returning.
832 if (heightSpecified) 832 if (heightSpecified)
833 setHeight(oldHeight); 833 setHeight(oldHeight);
834 } 834 }
835 835
836 void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren) 836 void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren)
837 { 837 {
838 UseCounter::count(document(), UseCounter::LineClamp); 838 UseCounter::count(document(), UseCounter::LineClamp);
839 839
840 int maxLineCount = 0; 840 int maxLineCount = 0;
841 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { 841 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
842 if (childDoesNotAffectWidthOrFlexing(child)) 842 if (childDoesNotAffectWidthOrFlexing(child))
843 continue; 843 continue;
844 844
845 child->clearOverrideSize(); 845 child->clearOverrideSize();
846 if (relayoutChildren || (child->isReplaced() && (child->style()->width() .isPercent() || child->style()->height().isPercent())) 846 if (relayoutChildren || (child->isReplaced() && (child->style()->width() .isPercent() || child->style()->height().isPercent()))
847 || (child->style()->height().isAuto() && child->isRenderBlock())) { 847 || (child->style()->height().isAuto() && child->isRenderBlock())) {
848 child->setChildNeedsLayout(MarkOnlyThis); 848 child->setChildNeedsLayout(MarkOnlyThis);
849 849
850 // Dirty all the positioned objects. 850 // Dirty all the positioned objects.
851 if (child->isRenderBlock()) { 851 if (child->isRenderBlock()) {
852 toRenderBlock(child)->markPositionedObjectsForLayout(); 852 toRenderBlock(child)->markPositionedObjectsForLayout();
853 toRenderBlock(child)->clearTruncation(); 853 toRenderBlock(child)->clearTruncation();
854 } 854 }
855 } 855 }
856 child->layoutIfNeeded(); 856 child->layoutIfNeeded();
857 if (child->style()->height().isAuto() && child->isRenderBlock()) 857 if (child->style()->height().isAuto() && child->isRenderBlock())
858 maxLineCount = std::max(maxLineCount, toRenderBlock(child)->lineCoun t()); 858 maxLineCount = std::max(maxLineCount, toRenderBlock(child)->lineCoun t());
859 } 859 }
860 860
861 // Get the number of lines and then alter all block flow children with auto height to use the 861 // Get the number of lines and then alter all block flow children with auto height to use the
862 // specified height. We always try to leave room for at least one line. 862 // specified height. We always try to leave room for at least one line.
863 LineClampValue lineClamp = style()->lineClamp(); 863 LineClampValue lineClamp = style()->lineClamp();
864 int numVisibleLines = lineClamp.isPercentage() ? std::max(1, (maxLineCount + 1) * lineClamp.value() / 100) : lineClamp.value(); 864 int numVisibleLines = lineClamp.isPercentage() ? std::max(1, (maxLineCount + 1) * lineClamp.value() / 100) : lineClamp.value();
865 if (numVisibleLines >= maxLineCount) 865 if (numVisibleLines >= maxLineCount)
866 return; 866 return;
867 867
868 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { 868 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
869 if (childDoesNotAffectWidthOrFlexing(child) || !child->style()->height() .isAuto() || !child->isRenderBlock()) 869 if (childDoesNotAffectWidthOrFlexing(child) || !child->style()->height() .isAuto() || !child->isRenderBlock())
870 continue; 870 continue;
871 871
872 RenderBlock* blockChild = toRenderBlock(child); 872 RenderBlock* blockChild = toRenderBlock(child);
873 int lineCount = blockChild->lineCount(); 873 int lineCount = blockChild->lineCount();
874 if (lineCount <= numVisibleLines) 874 if (lineCount <= numVisibleLines)
875 continue; 875 continue;
876 876
877 LayoutUnit newHeight = blockChild->heightForLineCount(numVisibleLines); 877 LayoutUnit newHeight = blockChild->heightForLineCount(numVisibleLines);
878 if (newHeight == child->size().height()) 878 if (newHeight == child->size().height())
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 // FIXME: the text alignment should be recomputed after the width change s due to truncation. 929 // FIXME: the text alignment should be recomputed after the width change s due to truncation.
930 LayoutUnit blockLeftEdge = destBlock.logicalLeftOffsetForLine(lastVisibl eLine->y(), false); 930 LayoutUnit blockLeftEdge = destBlock.logicalLeftOffsetForLine(lastVisibl eLine->y(), false);
931 lastVisibleLine->placeEllipsis(anchorBox ? ellipsisAndSpaceStr : ellipsi sStr, leftToRight, blockLeftEdge.toFloat(), blockRightEdge.toFloat(), totalWidth , anchorBox); 931 lastVisibleLine->placeEllipsis(anchorBox ? ellipsisAndSpaceStr : ellipsi sStr, leftToRight, blockLeftEdge.toFloat(), blockRightEdge.toFloat(), totalWidth , anchorBox);
932 destBlock.setHasMarkupTruncation(true); 932 destBlock.setHasMarkupTruncation(true);
933 } 933 }
934 } 934 }
935 935
936 void RenderDeprecatedFlexibleBox::clearLineClamp() 936 void RenderDeprecatedFlexibleBox::clearLineClamp()
937 { 937 {
938 FlexBoxIterator iterator(this); 938 FlexBoxIterator iterator(this);
939 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { 939 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
940 if (childDoesNotAffectWidthOrFlexing(child)) 940 if (childDoesNotAffectWidthOrFlexing(child))
941 continue; 941 continue;
942 942
943 child->clearOverrideSize(); 943 child->clearOverrideSize();
944 if ((child->isReplaced() && (child->style()->width().isPercent() || chil d->style()->height().isPercent())) 944 if ((child->isReplaced() && (child->style()->width().isPercent() || chil d->style()->height().isPercent()))
945 || (child->style()->height().isAuto() && child->isRenderBlock())) { 945 || (child->style()->height().isAuto() && child->isRenderBlock())) {
946 child->setChildNeedsLayout(); 946 child->setChildNeedsLayout();
947 947
948 if (child->isRenderBlock()) { 948 if (child->isRenderBlock()) {
949 toRenderBlock(child)->markPositionedObjectsForLayout(); 949 toRenderBlock(child)->markPositionedObjectsForLayout();
950 toRenderBlock(child)->clearTruncation(); 950 toRenderBlock(child)->clearTruncation();
951 } 951 }
952 } 952 }
953 } 953 }
954 } 954 }
955 955
956 void RenderDeprecatedFlexibleBox::placeChild(RenderBox* child, const LayoutPoint & location) 956 void RenderDeprecatedFlexibleBox::placeChild(LayoutBox* child, const LayoutPoint & location)
957 { 957 {
958 // FIXME Investigate if this can be removed based on other flags. crbug.com/ 370010 958 // FIXME Investigate if this can be removed based on other flags. crbug.com/ 370010
959 child->setMayNeedPaintInvalidation(); 959 child->setMayNeedPaintInvalidation();
960 960
961 // Place the child. 961 // Place the child.
962 child->setLocation(location); 962 child->setLocation(location);
963 } 963 }
964 964
965 LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsigned int group) 965 LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(LayoutBox* child, bool expanding, unsigned group)
966 { 966 {
967 if (childDoesNotAffectWidthOrFlexing(child) || child->style()->boxFlex() == 0.0f || child->style()->boxFlexGroup() != group) 967 if (childDoesNotAffectWidthOrFlexing(child) || child->style()->boxFlex() == 0.0f || child->style()->boxFlexGroup() != group)
968 return 0; 968 return 0;
969 969
970 if (expanding) { 970 if (expanding) {
971 if (isHorizontal()) { 971 if (isHorizontal()) {
972 // FIXME: For now just handle fixed values. 972 // FIXME: For now just handle fixed values.
973 LayoutUnit maxWidth = LayoutUnit::max(); 973 LayoutUnit maxWidth = LayoutUnit::max();
974 LayoutUnit width = contentWidthForChild(child); 974 LayoutUnit width = contentWidthForChild(child);
975 if (child->style()->maxWidth().isFixed()) 975 if (child->style()->maxWidth().isFixed())
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 if (isOutOfFlowPositioned()) 1028 if (isOutOfFlowPositioned())
1029 return "RenderDeprecatedFlexibleBox (positioned)"; 1029 return "RenderDeprecatedFlexibleBox (positioned)";
1030 if (isAnonymous()) 1030 if (isAnonymous())
1031 return "RenderDeprecatedFlexibleBox (generated)"; 1031 return "RenderDeprecatedFlexibleBox (generated)";
1032 if (isRelPositioned()) 1032 if (isRelPositioned())
1033 return "RenderDeprecatedFlexibleBox (relative positioned)"; 1033 return "RenderDeprecatedFlexibleBox (relative positioned)";
1034 return "RenderDeprecatedFlexibleBox"; 1034 return "RenderDeprecatedFlexibleBox";
1035 } 1035 }
1036 1036
1037 } // namespace blink 1037 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderDeprecatedFlexibleBox.h ('k') | Source/core/rendering/RenderFileUploadControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698