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

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

Issue 351213002: Change RenderObject::style(bool) to accept an enum instead (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Renamed enum to OwnOrFirstLineStyle, rebased and got rid of duplicate state on the stack in RootInl… Created 6 years, 5 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 | « Source/core/rendering/RenderFlexibleBox.h ('k') | Source/core/rendering/RenderInline.h » ('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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth(); 128 LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth();
129 maxLogicalWidth += scrollbarWidth; 129 maxLogicalWidth += scrollbarWidth;
130 minLogicalWidth += scrollbarWidth; 130 minLogicalWidth += scrollbarWidth;
131 } 131 }
132 132
133 static int synthesizedBaselineFromContentBox(const RenderBox* box, LineDirection Mode direction) 133 static int synthesizedBaselineFromContentBox(const RenderBox* box, LineDirection Mode direction)
134 { 134 {
135 return direction == HorizontalLine ? box->borderTop() + box->paddingTop() + box->contentHeight() : box->borderRight() + box->paddingRight() + box->contentWi dth(); 135 return direction == HorizontalLine ? box->borderTop() + box->paddingTop() + box->contentHeight() : box->borderRight() + box->paddingRight() + box->contentWi dth();
136 } 136 }
137 137
138 int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode di rection, LinePositionMode mode) const 138 int RenderFlexibleBox::baselinePosition(FontBaseline, OwnOrFirstLineStyle, LineD irectionMode direction, LinePositionMode mode) const
139 { 139 {
140 ASSERT(mode == PositionOnContainingLine); 140 ASSERT(mode == PositionOnContainingLine);
141 int baseline = firstLineBoxBaseline(); 141 int baseline = firstLineBoxBaseline();
142 if (baseline == -1) 142 if (baseline == -1)
143 baseline = synthesizedBaselineFromContentBox(this, direction); 143 baseline = synthesizedBaselineFromContentBox(this, direction);
144 144
145 return beforeMarginInLineDirection(direction) + baseline; 145 return beforeMarginInLineDirection(direction) + baseline;
146 } 146 }
147 147
148 int RenderFlexibleBox::firstLineBoxBaseline() const 148 int RenderFlexibleBox::firstLineBoxBaseline() const
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 658 }
659 659
660 layoutAndPlaceChildren(crossAxisOffset, orderedChildren, childSizes, ava ilableFreeSpace, relayoutChildren, lineContexts, hasInfiniteLineLength); 660 layoutAndPlaceChildren(crossAxisOffset, orderedChildren, childSizes, ava ilableFreeSpace, relayoutChildren, lineContexts, hasInfiniteLineLength);
661 } 661 }
662 if (hasLineIfEmpty()) { 662 if (hasLineIfEmpty()) {
663 // Even if computeNextFlexLine returns true, the flexbox might not have 663 // Even if computeNextFlexLine returns true, the flexbox might not have
664 // a line because all our children might be out of flow positioned. 664 // a line because all our children might be out of flow positioned.
665 // Instead of just checking if we have a line, make sure the flexbox 665 // Instead of just checking if we have a line, make sure the flexbox
666 // has at least a line's worth of height to cover this case. 666 // has at least a line's worth of height to cover this case.
667 LayoutUnit minHeight = borderAndPaddingLogicalHeight() 667 LayoutUnit minHeight = borderAndPaddingLogicalHeight()
668 + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : Vert icalLine, PositionOfInteriorLineBoxes) 668 + lineHeight(FirstLineStyle, isHorizontalWritingMode() ? HorizontalL ine : VerticalLine, PositionOfInteriorLineBoxes)
669 + scrollbarLogicalHeight(); 669 + scrollbarLogicalHeight();
670 if (height() < minHeight) 670 if (height() < minHeight)
671 setLogicalHeight(minHeight); 671 setLogicalHeight(minHeight);
672 } 672 }
673 673
674 updateLogicalHeight(); 674 updateLogicalHeight();
675 repositionLogicalHeightDependentFlexItems(lineContexts); 675 repositionLogicalHeightDependentFlexItems(lineContexts);
676 } 676 }
677 677
678 LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi st& children, LayoutUnit& availableFreeSpace) 678 LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi st& children, LayoutUnit& availableFreeSpace)
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 ASSERT(child); 1397 ASSERT(child);
1398 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1398 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1399 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1399 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1400 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1400 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1401 adjustAlignmentForChild(child, newOffset - originalOffset); 1401 adjustAlignmentForChild(child, newOffset - originalOffset);
1402 } 1402 }
1403 } 1403 }
1404 } 1404 }
1405 1405
1406 } 1406 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderFlexibleBox.h ('k') | Source/core/rendering/RenderInline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698