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

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

Issue 339333002: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing mac error Created 6 years, 6 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 * 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 16 matching lines...) Expand all
27 27
28 #include "core/frame/UseCounter.h" 28 #include "core/frame/UseCounter.h"
29 #include "core/rendering/FastTextAutosizer.h" 29 #include "core/rendering/FastTextAutosizer.h"
30 #include "core/rendering/LayoutRepainter.h" 30 #include "core/rendering/LayoutRepainter.h"
31 #include "core/rendering/RenderLayer.h" 31 #include "core/rendering/RenderLayer.h"
32 #include "core/rendering/RenderView.h" 32 #include "core/rendering/RenderView.h"
33 #include "platform/fonts/Font.h" 33 #include "platform/fonts/Font.h"
34 #include "wtf/StdLibExtras.h" 34 #include "wtf/StdLibExtras.h"
35 #include "wtf/unicode/CharacterNames.h" 35 #include "wtf/unicode/CharacterNames.h"
36 36
37 using namespace std;
38
39 namespace WebCore { 37 namespace WebCore {
40 38
41 class FlexBoxIterator { 39 class FlexBoxIterator {
42 public: 40 public:
43 FlexBoxIterator(RenderDeprecatedFlexibleBox* parent) 41 FlexBoxIterator(RenderDeprecatedFlexibleBox* parent)
44 : m_box(parent) 42 : m_box(parent)
45 , m_largestOrdinal(1) 43 , m_largestOrdinal(1)
46 { 44 {
47 if (m_box->style()->boxOrient() == HORIZONTAL && !m_box->style()->isLeft ToRightDirection()) 45 if (m_box->style()->boxOrient() == HORIZONTAL && !m_box->style()->isLeft ToRightDirection())
48 m_forward = m_box->style()->boxDirection() != BNORMAL; 46 m_forward = m_box->style()->boxDirection() != BNORMAL;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 79
82 if (!m_ordinalIteration) 80 if (!m_ordinalIteration)
83 m_currentOrdinal = m_forward ? 1 : m_largestOrdinal; 81 m_currentOrdinal = m_forward ? 1 : m_largestOrdinal;
84 else { 82 else {
85 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)
86 return 0; 84 return 0;
87 85
88 // Only copy+sort the values once per layout even if the ite rator is reset. 86 // Only copy+sort the values once per layout even if the ite rator is reset.
89 if (m_ordinalValues.size() != m_sortedOrdinalValues.size()) { 87 if (m_ordinalValues.size() != m_sortedOrdinalValues.size()) {
90 copyToVector(m_ordinalValues, m_sortedOrdinalValues); 88 copyToVector(m_ordinalValues, m_sortedOrdinalValues);
91 sort(m_sortedOrdinalValues.begin(), m_sortedOrdinalValue s.end()); 89 std::sort(m_sortedOrdinalValues.begin(), m_sortedOrdinal Values.end());
92 } 90 }
93 m_currentOrdinal = m_forward ? m_sortedOrdinalValues[m_ordin alIteration - 1] : m_sortedOrdinalValues[m_sortedOrdinalValues.size() - m_ordina lIteration]; 91 m_currentOrdinal = m_forward ? m_sortedOrdinalValues[m_ordin alIteration - 1] : m_sortedOrdinalValues[m_sortedOrdinalValues.size() - m_ordina lIteration];
94 } 92 }
95 93
96 m_currentChild = m_forward ? m_box->firstChildBox() : m_box->las tChildBox(); 94 m_currentChild = m_forward ? m_box->firstChildBox() : m_box->las tChildBox();
97 } else 95 } else
98 m_currentChild = m_forward ? m_currentChild->nextSiblingBox() : m_currentChild->previousSiblingBox(); 96 m_currentChild = m_forward ? m_currentChild->nextSiblingBox() : m_currentChild->previousSiblingBox();
99 97
100 if (m_currentChild && notFirstOrdinalValue()) 98 if (m_currentChild && notFirstOrdinalValue())
101 m_ordinalValues.add(m_currentChild->style()->boxOrdinalGroup()); 99 m_ordinalValues.add(m_currentChild->style()->boxOrdinalGroup());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 192
195 void RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minL ogicalWidth, LayoutUnit& maxLogicalWidth) const 193 void RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minL ogicalWidth, LayoutUnit& maxLogicalWidth) const
196 { 194 {
197 if (hasMultipleLines() || isVertical()) { 195 if (hasMultipleLines() || isVertical()) {
198 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) { 196 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) {
199 if (childDoesNotAffectWidthOrFlexing(child)) 197 if (childDoesNotAffectWidthOrFlexing(child))
200 continue; 198 continue;
201 199
202 LayoutUnit margin = marginWidthForChild(child); 200 LayoutUnit margin = marginWidthForChild(child);
203 LayoutUnit width = child->minPreferredLogicalWidth() + margin; 201 LayoutUnit width = child->minPreferredLogicalWidth() + margin;
204 minLogicalWidth = max(width, minLogicalWidth); 202 minLogicalWidth = std::max(width, minLogicalWidth);
205 203
206 width = child->maxPreferredLogicalWidth() + margin; 204 width = child->maxPreferredLogicalWidth() + margin;
207 maxLogicalWidth = max(width, maxLogicalWidth); 205 maxLogicalWidth = std::max(width, maxLogicalWidth);
208 } 206 }
209 } else { 207 } else {
210 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) { 208 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) {
211 if (childDoesNotAffectWidthOrFlexing(child)) 209 if (childDoesNotAffectWidthOrFlexing(child))
212 continue; 210 continue;
213 211
214 LayoutUnit margin = marginWidthForChild(child); 212 LayoutUnit margin = marginWidthForChild(child);
215 minLogicalWidth += child->minPreferredLogicalWidth() + margin; 213 minLogicalWidth += child->minPreferredLogicalWidth() + margin;
216 maxLogicalWidth += child->maxPreferredLogicalWidth() + margin; 214 maxLogicalWidth += child->maxPreferredLogicalWidth() + margin;
217 } 215 }
218 } 216 }
219 217
220 maxLogicalWidth = max(minLogicalWidth, maxLogicalWidth); 218 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
221 219
222 LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth(); 220 LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth();
223 maxLogicalWidth += scrollbarWidth; 221 maxLogicalWidth += scrollbarWidth;
224 minLogicalWidth += scrollbarWidth; 222 minLogicalWidth += scrollbarWidth;
225 } 223 }
226 224
227 void RenderDeprecatedFlexibleBox::computePreferredLogicalWidths() 225 void RenderDeprecatedFlexibleBox::computePreferredLogicalWidths()
228 { 226 {
229 ASSERT(preferredLogicalWidthsDirty()); 227 ASSERT(preferredLogicalWidthsDirty());
230 228
231 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0; 229 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0;
232 RenderStyle* styleToUse = style(); 230 RenderStyle* styleToUse = style();
233 231
234 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0) 232 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0)
235 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value()); 233 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value());
236 else 234 else
237 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 235 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
238 236
239 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) { 237 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) {
240 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); 238 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
241 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); 239 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
242 } 240 }
243 241
244 if (styleToUse->maxWidth().isFixed()) { 242 if (styleToUse->maxWidth().isFixed()) {
245 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); 243 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
246 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); 244 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
247 } 245 }
248 246
249 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); 247 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth();
250 m_minPreferredLogicalWidth += borderAndPadding; 248 m_minPreferredLogicalWidth += borderAndPadding;
251 m_maxPreferredLogicalWidth += borderAndPadding; 249 m_maxPreferredLogicalWidth += borderAndPadding;
252 250
253 clearPreferredLogicalWidthsDirty(); 251 clearPreferredLogicalWidthsDirty();
254 } 252 }
255 253
256 void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren) 254 void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren)
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 387
390 // Update our height and overflow height. 388 // Update our height and overflow height.
391 if (style()->boxAlign() == BBASELINE) { 389 if (style()->boxAlign() == BBASELINE) {
392 LayoutUnit ascent = child->firstLineBoxBaseline(); 390 LayoutUnit ascent = child->firstLineBoxBaseline();
393 if (ascent == -1) 391 if (ascent == -1)
394 ascent = child->height() + child->marginBottom(); 392 ascent = child->height() + child->marginBottom();
395 ascent += child->marginTop(); 393 ascent += child->marginTop();
396 LayoutUnit descent = (child->height() + child->marginHeight()) - ascent; 394 LayoutUnit descent = (child->height() + child->marginHeight()) - ascent;
397 395
398 // Update our maximum ascent. 396 // Update our maximum ascent.
399 maxAscent = max(maxAscent, ascent); 397 maxAscent = std::max(maxAscent, ascent);
400 398
401 // Update our maximum descent. 399 // Update our maximum descent.
402 maxDescent = max(maxDescent, descent); 400 maxDescent = std::max(maxDescent, descent);
403 401
404 // Now update our height. 402 // Now update our height.
405 setHeight(max(yPos + maxAscent + maxDescent, height())); 403 setHeight(std::max(yPos + maxAscent + maxDescent, height()));
404 } else {
405 setHeight(std::max(height(), yPos + child->height() + child->mar ginHeight()));
406 } 406 }
407 else
408 setHeight(max(height(), yPos + child->height() + child->marginHe ight()));
409 } 407 }
410 408
411 if (!iterator.first() && hasLineIfEmpty()) 409 if (!iterator.first() && hasLineIfEmpty())
412 setHeight(height() + lineHeight(true, style()->isHorizontalWritingMo de() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)); 410 setHeight(height() + lineHeight(true, style()->isHorizontalWritingMo de() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
413 411
414 setHeight(height() + toAdd); 412 setHeight(height() + toAdd);
415 413
416 oldHeight = height(); 414 oldHeight = height();
417 updateLogicalHeight(); 415 updateLogicalHeight();
418 416
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 if (!child->needsLayout()) 453 if (!child->needsLayout())
456 child->markForPaginationRelayoutIfNeeded(layoutScope); 454 child->markForPaginationRelayoutIfNeeded(layoutScope);
457 455
458 child->layoutIfNeeded(); 456 child->layoutIfNeeded();
459 457
460 // We can place the child now, using our value of box-align. 458 // We can place the child now, using our value of box-align.
461 xPos += child->marginLeft(); 459 xPos += child->marginLeft();
462 LayoutUnit childY = yPos; 460 LayoutUnit childY = yPos;
463 switch (style()->boxAlign()) { 461 switch (style()->boxAlign()) {
464 case BCENTER: 462 case BCENTER:
465 childY += child->marginTop() + max<LayoutUnit>(0, (contentHe ight() - (child->height() + child->marginHeight())) / 2); 463 childY += child->marginTop() + std::max<LayoutUnit>(0, (cont entHeight() - (child->height() + child->marginHeight())) / 2);
466 break; 464 break;
467 case BBASELINE: { 465 case BBASELINE: {
468 LayoutUnit ascent = child->firstLineBoxBaseline(); 466 LayoutUnit ascent = child->firstLineBoxBaseline();
469 if (ascent == -1) 467 if (ascent == -1)
470 ascent = child->height() + child->marginBottom(); 468 ascent = child->height() + child->marginBottom();
471 ascent += child->marginTop(); 469 ascent += child->marginTop();
472 childY += child->marginTop() + (maxAscent - ascent); 470 childY += child->marginTop() + (maxAscent - ascent);
473 break; 471 break;
474 } 472 }
475 case BEND: 473 case BEND:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 float totalFlex = 0.0f; 511 float totalFlex = 0.0f;
514 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) { 512 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) {
515 if (allowedChildFlex(child, expanding, i)) 513 if (allowedChildFlex(child, expanding, i))
516 totalFlex += child->style()->boxFlex(); 514 totalFlex += child->style()->boxFlex();
517 } 515 }
518 LayoutUnit spaceAvailableThisPass = groupRemainingSpace; 516 LayoutUnit spaceAvailableThisPass = groupRemainingSpace;
519 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) { 517 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) {
520 LayoutUnit allowedFlex = allowedChildFlex(child, expandi ng, i); 518 LayoutUnit allowedFlex = allowedChildFlex(child, expandi ng, i);
521 if (allowedFlex) { 519 if (allowedFlex) {
522 LayoutUnit projectedFlex = (allowedFlex == LayoutUni t::max()) ? allowedFlex : LayoutUnit(allowedFlex * (totalFlex / child->style()-> boxFlex())); 520 LayoutUnit projectedFlex = (allowedFlex == LayoutUni t::max()) ? allowedFlex : LayoutUnit(allowedFlex * (totalFlex / child->style()-> boxFlex()));
523 spaceAvailableThisPass = expanding ? min(spaceAvaila bleThisPass, projectedFlex) : max(spaceAvailableThisPass, projectedFlex); 521 spaceAvailableThisPass = expanding ? std::min(spaceA vailableThisPass, projectedFlex) : std::max(spaceAvailableThisPass, projectedFle x);
524 } 522 }
525 } 523 }
526 524
527 // The flex groups may not have any flexible objects this ti me around. 525 // The flex groups may not have any flexible objects this ti me around.
528 if (!spaceAvailableThisPass || totalFlex == 0.0f) { 526 if (!spaceAvailableThisPass || totalFlex == 0.0f) {
529 // If we just couldn't grow/shrink any more, then it's t ime to transition to the next flex group. 527 // If we just couldn't grow/shrink any more, then it's t ime to transition to the next flex group.
530 groupRemainingSpace = 0; 528 groupRemainingSpace = 0;
531 continue; 529 continue;
532 } 530 }
533 531
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 child->markForPaginationRelayoutIfNeeded(layoutScope); 692 child->markForPaginationRelayoutIfNeeded(layoutScope);
695 693
696 // Now do a layout. 694 // Now do a layout.
697 child->layoutIfNeeded(); 695 child->layoutIfNeeded();
698 696
699 // We can place the child now, using our value of box-align. 697 // We can place the child now, using our value of box-align.
700 LayoutUnit childX = borderLeft() + paddingLeft(); 698 LayoutUnit childX = borderLeft() + paddingLeft();
701 switch (style()->boxAlign()) { 699 switch (style()->boxAlign()) {
702 case BCENTER: 700 case BCENTER:
703 case BBASELINE: // Baseline just maps to center for vertical box es 701 case BBASELINE: // Baseline just maps to center for vertical box es
704 childX += child->marginLeft() + max<LayoutUnit>(0, (contentW idth() - (child->width() + child->marginWidth())) / 2); 702 childX += child->marginLeft() + std::max<LayoutUnit>(0, (con tentWidth() - (child->width() + child->marginWidth())) / 2);
705 break; 703 break;
706 case BEND: 704 case BEND:
707 if (!style()->isLeftToRightDirection()) 705 if (!style()->isLeftToRightDirection())
708 childX += child->marginLeft(); 706 childX += child->marginLeft();
709 else 707 else
710 childX += contentWidth() - child->marginRight() - child- >width(); 708 childX += contentWidth() - child->marginRight() - child- >width();
711 break; 709 break;
712 default: // BSTART/BSTRETCH 710 default: // BSTART/BSTRETCH
713 if (style()->isLeftToRightDirection()) 711 if (style()->isLeftToRightDirection())
714 childX += child->marginLeft(); 712 childX += child->marginLeft();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 float totalFlex = 0.0f; 765 float totalFlex = 0.0f;
768 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) { 766 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) {
769 if (allowedChildFlex(child, expanding, i)) 767 if (allowedChildFlex(child, expanding, i))
770 totalFlex += child->style()->boxFlex(); 768 totalFlex += child->style()->boxFlex();
771 } 769 }
772 LayoutUnit spaceAvailableThisPass = groupRemainingSpace; 770 LayoutUnit spaceAvailableThisPass = groupRemainingSpace;
773 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) { 771 for (RenderBox* child = iterator.first(); child; child = ite rator.next()) {
774 LayoutUnit allowedFlex = allowedChildFlex(child, expandi ng, i); 772 LayoutUnit allowedFlex = allowedChildFlex(child, expandi ng, i);
775 if (allowedFlex) { 773 if (allowedFlex) {
776 LayoutUnit projectedFlex = (allowedFlex == LayoutUni t::max()) ? allowedFlex : static_cast<LayoutUnit>(allowedFlex * (totalFlex / chi ld->style()->boxFlex())); 774 LayoutUnit projectedFlex = (allowedFlex == LayoutUni t::max()) ? allowedFlex : static_cast<LayoutUnit>(allowedFlex * (totalFlex / chi ld->style()->boxFlex()));
777 spaceAvailableThisPass = expanding ? min(spaceAvaila bleThisPass, projectedFlex) : max(spaceAvailableThisPass, projectedFlex); 775 spaceAvailableThisPass = expanding ? std::min(spaceA vailableThisPass, projectedFlex) : std::max(spaceAvailableThisPass, projectedFle x);
778 } 776 }
779 } 777 }
780 778
781 // The flex groups may not have any flexible objects this ti me around. 779 // The flex groups may not have any flexible objects this ti me around.
782 if (!spaceAvailableThisPass || totalFlex == 0.0f) { 780 if (!spaceAvailableThisPass || totalFlex == 0.0f) {
783 // If we just couldn't grow/shrink any more, then it's t ime to transition to the next flex group. 781 // If we just couldn't grow/shrink any more, then it's t ime to transition to the next flex group.
784 groupRemainingSpace = 0; 782 groupRemainingSpace = 0;
785 continue; 783 continue;
786 } 784 }
787 785
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 child->setChildNeedsLayout(MarkOnlyThis); 891 child->setChildNeedsLayout(MarkOnlyThis);
894 892
895 // Dirty all the positioned objects. 893 // Dirty all the positioned objects.
896 if (child->isRenderBlock()) { 894 if (child->isRenderBlock()) {
897 toRenderBlock(child)->markPositionedObjectsForLayout(); 895 toRenderBlock(child)->markPositionedObjectsForLayout();
898 toRenderBlock(child)->clearTruncation(); 896 toRenderBlock(child)->clearTruncation();
899 } 897 }
900 } 898 }
901 child->layoutIfNeeded(); 899 child->layoutIfNeeded();
902 if (child->style()->height().isAuto() && child->isRenderBlock()) 900 if (child->style()->height().isAuto() && child->isRenderBlock())
903 maxLineCount = max(maxLineCount, toRenderBlock(child)->lineCount()); 901 maxLineCount = std::max(maxLineCount, toRenderBlock(child)->lineCoun t());
904 } 902 }
905 903
906 // Get the number of lines and then alter all block flow children with auto height to use the 904 // Get the number of lines and then alter all block flow children with auto height to use the
907 // specified height. We always try to leave room for at least one line. 905 // specified height. We always try to leave room for at least one line.
908 LineClampValue lineClamp = style()->lineClamp(); 906 LineClampValue lineClamp = style()->lineClamp();
909 int numVisibleLines = lineClamp.isPercentage() ? max(1, (maxLineCount + 1) * lineClamp.value() / 100) : lineClamp.value(); 907 int numVisibleLines = lineClamp.isPercentage() ? std::max(1, (maxLineCount + 1) * lineClamp.value() / 100) : lineClamp.value();
910 if (numVisibleLines >= maxLineCount) 908 if (numVisibleLines >= maxLineCount)
911 return; 909 return;
912 910
913 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { 911 for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
914 if (childDoesNotAffectWidthOrFlexing(child) || !child->style()->height() .isAuto() || !child->isRenderBlock()) 912 if (childDoesNotAffectWidthOrFlexing(child) || !child->style()->height() .isAuto() || !child->isRenderBlock())
915 continue; 913 continue;
916 914
917 RenderBlock* blockChild = toRenderBlock(child); 915 RenderBlock* blockChild = toRenderBlock(child);
918 int lineCount = blockChild->lineCount(); 916 int lineCount = blockChild->lineCount();
919 if (lineCount <= numVisibleLines) 917 if (lineCount <= numVisibleLines)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 LayoutUnit maxWidth = LayoutUnit::max(); 1024 LayoutUnit maxWidth = LayoutUnit::max();
1027 LayoutUnit width = contentWidthForChild(child); 1025 LayoutUnit width = contentWidthForChild(child);
1028 if (!child->style()->maxWidth().isUndefined() && child->style()->max Width().isFixed()) 1026 if (!child->style()->maxWidth().isUndefined() && child->style()->max Width().isFixed())
1029 maxWidth = child->style()->maxWidth().value(); 1027 maxWidth = child->style()->maxWidth().value();
1030 else if (child->style()->maxWidth().type() == Intrinsic) 1028 else if (child->style()->maxWidth().type() == Intrinsic)
1031 maxWidth = child->maxPreferredLogicalWidth(); 1029 maxWidth = child->maxPreferredLogicalWidth();
1032 else if (child->style()->maxWidth().type() == MinIntrinsic) 1030 else if (child->style()->maxWidth().type() == MinIntrinsic)
1033 maxWidth = child->minPreferredLogicalWidth(); 1031 maxWidth = child->minPreferredLogicalWidth();
1034 if (maxWidth == LayoutUnit::max()) 1032 if (maxWidth == LayoutUnit::max())
1035 return maxWidth; 1033 return maxWidth;
1036 return max<LayoutUnit>(0, maxWidth - width); 1034 return std::max<LayoutUnit>(0, maxWidth - width);
1037 } else { 1035 } else {
1038 // FIXME: For now just handle fixed values. 1036 // FIXME: For now just handle fixed values.
1039 LayoutUnit maxHeight = LayoutUnit::max(); 1037 LayoutUnit maxHeight = LayoutUnit::max();
1040 LayoutUnit height = contentHeightForChild(child); 1038 LayoutUnit height = contentHeightForChild(child);
1041 if (!child->style()->maxHeight().isUndefined() && child->style()->ma xHeight().isFixed()) 1039 if (!child->style()->maxHeight().isUndefined() && child->style()->ma xHeight().isFixed())
1042 maxHeight = child->style()->maxHeight().value(); 1040 maxHeight = child->style()->maxHeight().value();
1043 if (maxHeight == LayoutUnit::max()) 1041 if (maxHeight == LayoutUnit::max())
1044 return maxHeight; 1042 return maxHeight;
1045 return max<LayoutUnit>(0, maxHeight - height); 1043 return std::max<LayoutUnit>(0, maxHeight - height);
1046 } 1044 }
1047 } 1045 }
1048 1046
1049 // FIXME: For now just handle fixed values. 1047 // FIXME: For now just handle fixed values.
1050 if (isHorizontal()) { 1048 if (isHorizontal()) {
1051 LayoutUnit minWidth = child->minPreferredLogicalWidth(); 1049 LayoutUnit minWidth = child->minPreferredLogicalWidth();
1052 LayoutUnit width = contentWidthForChild(child); 1050 LayoutUnit width = contentWidthForChild(child);
1053 if (child->style()->minWidth().isFixed()) 1051 if (child->style()->minWidth().isFixed())
1054 minWidth = child->style()->minWidth().value(); 1052 minWidth = child->style()->minWidth().value();
1055 else if (child->style()->minWidth().type() == Intrinsic) 1053 else if (child->style()->minWidth().type() == Intrinsic)
1056 minWidth = child->maxPreferredLogicalWidth(); 1054 minWidth = child->maxPreferredLogicalWidth();
1057 else if (child->style()->minWidth().type() == MinIntrinsic) 1055 else if (child->style()->minWidth().type() == MinIntrinsic)
1058 minWidth = child->minPreferredLogicalWidth(); 1056 minWidth = child->minPreferredLogicalWidth();
1059 else if (child->style()->minWidth().type() == Auto) 1057 else if (child->style()->minWidth().type() == Auto)
1060 minWidth = 0; 1058 minWidth = 0;
1061 1059
1062 LayoutUnit allowedShrinkage = min<LayoutUnit>(0, minWidth - width); 1060 LayoutUnit allowedShrinkage = std::min<LayoutUnit>(0, minWidth - width);
1063 return allowedShrinkage; 1061 return allowedShrinkage;
1064 } else { 1062 } else {
1065 Length minHeight = child->style()->minHeight(); 1063 Length minHeight = child->style()->minHeight();
1066 if (minHeight.isFixed() || minHeight.isAuto()) { 1064 if (minHeight.isFixed() || minHeight.isAuto()) {
1067 LayoutUnit minHeight = child->style()->minHeight().value(); 1065 LayoutUnit minHeight = child->style()->minHeight().value();
1068 LayoutUnit height = contentHeightForChild(child); 1066 LayoutUnit height = contentHeightForChild(child);
1069 LayoutUnit allowedShrinkage = min<LayoutUnit>(0, minHeight - height) ; 1067 LayoutUnit allowedShrinkage = std::min<LayoutUnit>(0, minHeight - he ight);
1070 return allowedShrinkage; 1068 return allowedShrinkage;
1071 } 1069 }
1072 } 1070 }
1073 1071
1074 return 0; 1072 return 0;
1075 } 1073 }
1076 1074
1077 const char* RenderDeprecatedFlexibleBox::renderName() const 1075 const char* RenderDeprecatedFlexibleBox::renderName() const
1078 { 1076 {
1079 if (isFloating()) 1077 if (isFloating())
1080 return "RenderDeprecatedFlexibleBox (floating)"; 1078 return "RenderDeprecatedFlexibleBox (floating)";
1081 if (isOutOfFlowPositioned()) 1079 if (isOutOfFlowPositioned())
1082 return "RenderDeprecatedFlexibleBox (positioned)"; 1080 return "RenderDeprecatedFlexibleBox (positioned)";
1083 // FIXME: Temporary hack while the new generated content system is being imp lemented. 1081 // FIXME: Temporary hack while the new generated content system is being imp lemented.
1084 if (isPseudoElement()) 1082 if (isPseudoElement())
1085 return "RenderDeprecatedFlexibleBox (generated)"; 1083 return "RenderDeprecatedFlexibleBox (generated)";
1086 if (isAnonymous()) 1084 if (isAnonymous())
1087 return "RenderDeprecatedFlexibleBox (generated)"; 1085 return "RenderDeprecatedFlexibleBox (generated)";
1088 if (isRelPositioned()) 1086 if (isRelPositioned())
1089 return "RenderDeprecatedFlexibleBox (relative positioned)"; 1087 return "RenderDeprecatedFlexibleBox (relative positioned)";
1090 return "RenderDeprecatedFlexibleBox"; 1088 return "RenderDeprecatedFlexibleBox";
1091 } 1089 }
1092 1090
1093 } // namespace WebCore 1091 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBoxModelObject.cpp ('k') | Source/core/rendering/RenderFileUploadControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698