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

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

Issue 752723004: Use references in RenderBlock and RenderBlockFlow methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cover RenderBlockFlow class as well Created 6 years 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 | « Source/core/rendering/RenderFieldset.cpp ('k') | Source/core/rendering/RenderGrid.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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt h, LayoutUnit& maxLogicalWidth) const 97 void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt h, LayoutUnit& maxLogicalWidth) const
98 { 98 {
99 // FIXME: We're ignoring flex-basis here and we shouldn't. We can't start ho noring it though until 99 // FIXME: We're ignoring flex-basis here and we shouldn't. We can't start ho noring it though until
100 // the flex shorthand stops setting it to 0. 100 // the flex shorthand stops setting it to 0.
101 // See https://bugs.webkit.org/show_bug.cgi?id=116117 and http://crbug.com/2 40765. 101 // See https://bugs.webkit.org/show_bug.cgi?id=116117 and http://crbug.com/2 40765.
102 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { 102 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
103 if (child->isOutOfFlowPositioned()) 103 if (child->isOutOfFlowPositioned())
104 continue; 104 continue;
105 105
106 LayoutUnit margin = marginIntrinsicLogicalWidthForChild(child); 106 LayoutUnit margin = marginIntrinsicLogicalWidthForChild(*child);
107 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHo rizontalWritingMode(); 107 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHo rizontalWritingMode();
108 LayoutUnit minPreferredLogicalWidth = hasOrthogonalWritingMode ? child-> logicalHeight() : child->minPreferredLogicalWidth(); 108 LayoutUnit minPreferredLogicalWidth = hasOrthogonalWritingMode ? child-> logicalHeight() : child->minPreferredLogicalWidth();
109 LayoutUnit maxPreferredLogicalWidth = hasOrthogonalWritingMode ? child-> logicalHeight() : child->maxPreferredLogicalWidth(); 109 LayoutUnit maxPreferredLogicalWidth = hasOrthogonalWritingMode ? child-> logicalHeight() : child->maxPreferredLogicalWidth();
110 minPreferredLogicalWidth += margin; 110 minPreferredLogicalWidth += margin;
111 maxPreferredLogicalWidth += margin; 111 maxPreferredLogicalWidth += margin;
112 if (!isColumnFlow()) { 112 if (!isColumnFlow()) {
113 maxLogicalWidth += maxPreferredLogicalWidth; 113 maxLogicalWidth += maxPreferredLogicalWidth;
114 if (isMultiline()) { 114 if (isMultiline()) {
115 // For multiline, the min preferred width is if you put a break between each item. 115 // For multiline, the min preferred width is if you put a break between each item.
116 minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalW idth); 116 minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalW idth);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // direction:rtl + flex-direction:column means the cross-axis direction is f lipped. 289 // direction:rtl + flex-direction:column means the cross-axis direction is f lipped.
290 flipForRightToLeftColumn(); 290 flipForRightToLeftColumn();
291 } 291 }
292 292
293 LayoutUnit RenderFlexibleBox::clientLogicalBottomAfterRepositioning() 293 LayoutUnit RenderFlexibleBox::clientLogicalBottomAfterRepositioning()
294 { 294 {
295 LayoutUnit maxChildLogicalBottom = 0; 295 LayoutUnit maxChildLogicalBottom = 0;
296 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { 296 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
297 if (child->isOutOfFlowPositioned()) 297 if (child->isOutOfFlowPositioned())
298 continue; 298 continue;
299 LayoutUnit childLogicalBottom = logicalTopForChild(child) + logicalHeigh tForChild(child) + marginAfterForChild(child); 299 LayoutUnit childLogicalBottom = logicalTopForChild(*child) + logicalHeig htForChild(*child) + marginAfterForChild(*child);
300 maxChildLogicalBottom = std::max(maxChildLogicalBottom, childLogicalBott om); 300 maxChildLogicalBottom = std::max(maxChildLogicalBottom, childLogicalBott om);
301 } 301 }
302 return std::max(clientLogicalBottom(), maxChildLogicalBottom + paddingAfter( )); 302 return std::max(clientLogicalBottom(), maxChildLogicalBottom + paddingAfter( ));
303 } 303 }
304 304
305 bool RenderFlexibleBox::hasOrthogonalFlow(RenderBox& child) const 305 bool RenderFlexibleBox::hasOrthogonalFlow(RenderBox& child) const
306 { 306 {
307 // FIXME: If the child is a flexbox, then we need to check isHorizontalFlow. 307 // FIXME: If the child is a flexbox, then we need to check isHorizontalFlow.
308 return isHorizontalFlow() != child.isHorizontalWritingMode(); 308 return isHorizontalFlow() != child.isHorizontalWritingMode();
309 } 309 }
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPadding ExtentForChild(*child); 1085 LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPadding ExtentForChild(*child);
1086 setOverrideMainAxisSizeForChild(*child, childPreferredSize); 1086 setOverrideMainAxisSizeForChild(*child, childPreferredSize);
1087 if (childPreferredSize != mainAxisExtentForChild(*child)) { 1087 if (childPreferredSize != mainAxisExtentForChild(*child)) {
1088 child->setChildNeedsLayout(MarkOnlyThis); 1088 child->setChildNeedsLayout(MarkOnlyThis);
1089 } else { 1089 } else {
1090 // To avoid double applying margin changes in updateAutoMarginsInCro ssAxis, we reset the margins here. 1090 // To avoid double applying margin changes in updateAutoMarginsInCro ssAxis, we reset the margins here.
1091 resetAutoMarginsAndLogicalTopInCrossAxis(*child); 1091 resetAutoMarginsAndLogicalTopInCrossAxis(*child);
1092 } 1092 }
1093 // We may have already forced relayout for orthogonal flowing children i n preferredMainAxisContentExtentForChild. 1093 // We may have already forced relayout for orthogonal flowing children i n preferredMainAxisContentExtentForChild.
1094 bool forceChildRelayout = relayoutChildren && !childPreferredMainAxisCon tentExtentRequiresLayout(*child, hasInfiniteLineLength); 1094 bool forceChildRelayout = relayoutChildren && !childPreferredMainAxisCon tentExtentRequiresLayout(*child, hasInfiniteLineLength);
1095 updateBlockChildDirtyBitsBeforeLayout(forceChildRelayout, child); 1095 updateBlockChildDirtyBitsBeforeLayout(forceChildRelayout, *child);
1096 child->layoutIfNeeded(); 1096 child->layoutIfNeeded();
1097 1097
1098 updateAutoMarginsInMainAxis(*child, autoMarginOffset); 1098 updateAutoMarginsInMainAxis(*child, autoMarginOffset);
1099 1099
1100 LayoutUnit childCrossAxisMarginBoxExtent; 1100 LayoutUnit childCrossAxisMarginBoxExtent;
1101 if (alignmentForChild(*child) == ItemPositionBaseline && !hasAutoMargins InCrossAxis(*child)) { 1101 if (alignmentForChild(*child) == ItemPositionBaseline && !hasAutoMargins InCrossAxis(*child)) {
1102 LayoutUnit ascent = marginBoxAscentForChild(*child); 1102 LayoutUnit ascent = marginBoxAscentForChild(*child);
1103 LayoutUnit descent = (crossAxisMarginExtentForChild(*child) + crossA xisExtentForChild(*child)) - ascent; 1103 LayoutUnit descent = (crossAxisMarginExtentForChild(*child) + crossA xisExtentForChild(*child)) - ascent;
1104 1104
1105 maxAscent = std::max(maxAscent, ascent); 1105 maxAscent = std::max(maxAscent, ascent);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 ASSERT(child); 1398 ASSERT(child);
1399 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1399 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1400 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1400 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1401 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1401 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1402 adjustAlignmentForChild(*child, newOffset - originalOffset); 1402 adjustAlignmentForChild(*child, newOffset - originalOffset);
1403 } 1403 }
1404 } 1404 }
1405 } 1405 }
1406 1406
1407 } 1407 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderFieldset.cpp ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698