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

Unified Diff: sky/engine/core/rendering/RenderFlexibleBox.cpp

Issue 707233006: Remove scrollbar width/height computations from layout. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: sky/engine/core/rendering/RenderFlexibleBox.cpp
diff --git a/sky/engine/core/rendering/RenderFlexibleBox.cpp b/sky/engine/core/rendering/RenderFlexibleBox.cpp
index 75617b9024c36402b54ec16d0ebc97bf26091fd9..b71ae3bceae85af93a8a4f537b930410aaabe627 100644
--- a/sky/engine/core/rendering/RenderFlexibleBox.cpp
+++ b/sky/engine/core/rendering/RenderFlexibleBox.cpp
@@ -119,10 +119,6 @@ void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt
}
maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
-
- LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth();
- maxLogicalWidth += scrollbarWidth;
- minLogicalWidth += scrollbarWidth;
}
static int synthesizedBaselineFromContentBox(const RenderBox* box, LineDirectionMode direction)
@@ -230,7 +226,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren)
relayoutChildren = true;
LayoutUnit previousHeight = logicalHeight();
- setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight());
+ setLogicalHeight(borderAndPaddingLogicalHeight());
{
LayoutState state(*this, locationOffset());
@@ -395,7 +391,7 @@ LayoutUnit RenderFlexibleBox::mainAxisContentExtent(LayoutUnit contentLogicalHei
{
if (isColumnFlow()) {
LogicalExtentComputedValues computedValues;
- LayoutUnit borderPaddingAndScrollbar = borderAndPaddingLogicalHeight() + scrollbarLogicalHeight();
+ LayoutUnit borderPaddingAndScrollbar = borderAndPaddingLogicalHeight();
LayoutUnit borderBoxLogicalHeight = contentLogicalHeight + borderPaddingAndScrollbar;
computeLogicalHeight(borderBoxLogicalHeight, logicalTop(), computedValues);
if (computedValues.m_extent == LayoutUnit::max())
@@ -413,7 +409,7 @@ LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, Si
// We don't have to check for "auto" here - computeContentLogicalHeight will just return -1 for that case anyway.
if (size.isIntrinsic())
child->layoutIfNeeded();
- return child->computeContentLogicalHeight(size, child->logicalHeight() - child->borderAndPaddingLogicalHeight()) + child->scrollbarLogicalHeight();
+ return child->computeContentLogicalHeight(size, child->logicalHeight() - child->borderAndPaddingLogicalHeight());
}
return child->computeLogicalWidthUsing(sizeType, size, contentLogicalWidth(), this) - child->borderAndPaddingLogicalWidth();
}
@@ -495,16 +491,6 @@ LayoutUnit RenderFlexibleBox::crossAxisMarginExtentForChild(RenderBox* child) co
return isHorizontalFlow() ? child->marginHeight() : child->marginWidth();
}
-LayoutUnit RenderFlexibleBox::crossAxisScrollbarExtent() const
-{
- return isHorizontalFlow() ? horizontalScrollbarHeight() : verticalScrollbarWidth();
-}
-
-LayoutUnit RenderFlexibleBox::crossAxisScrollbarExtentForChild(RenderBox* child) const
-{
- return isHorizontalFlow() ? child->horizontalScrollbarHeight() : child->verticalScrollbarWidth();
-}
-
LayoutPoint RenderFlexibleBox::flowAwareLocationForChild(RenderBox* child) const
{
return isHorizontalFlow() ? child->location() : child->location().transposedPoint();
@@ -593,8 +579,7 @@ void RenderFlexibleBox::layoutFlexItems(bool relayoutChildren)
// Instead of just checking if we have a line, make sure the flexbox
// has at least a line's worth of height to cover this case.
LayoutUnit minHeight = borderAndPaddingLogicalHeight()
- + lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes)
- + scrollbarLogicalHeight();
+ + lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes);
if (height() < minHeight)
setLogicalHeight(minHeight);
}
@@ -992,8 +977,6 @@ void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, availableFreeSpace);
LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart();
mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, style()->justifyContent(), numberOfChildrenForJustifyContent);
- if (style()->flexDirection() == FlowRowReverse)
- mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
LayoutUnit totalMainExtent = mainAxisExtent();
LayoutUnit maxAscent = 0, maxDescent = 0; // Used when align-items: baseline.
@@ -1036,10 +1019,10 @@ void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
childCrossAxisMarginBoxExtent = maxAscent + maxDescent;
} else {
- childCrossAxisMarginBoxExtent = crossAxisIntrinsicExtentForChild(child) + crossAxisMarginExtentForChild(child) + crossAxisScrollbarExtentForChild(child);
+ childCrossAxisMarginBoxExtent = crossAxisIntrinsicExtentForChild(child) + crossAxisMarginExtentForChild(child);
}
if (!isColumnFlow())
- setLogicalHeight(std::max(logicalHeight(), crossAxisOffset + flowAwareBorderAfter() + flowAwarePaddingAfter() + childCrossAxisMarginBoxExtent + crossAxisScrollbarExtent()));
+ setLogicalHeight(std::max(logicalHeight(), crossAxisOffset + flowAwareBorderAfter() + flowAwarePaddingAfter() + childCrossAxisMarginBoxExtent));
maxChildCrossAxisExtent = std::max(maxChildCrossAxisExtent, childCrossAxisMarginBoxExtent);
mainAxisOffset += flowAwareMarginStartForChild(child);
@@ -1060,7 +1043,7 @@ void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
}
if (isColumnFlow())
- setLogicalHeight(mainAxisOffset + flowAwareBorderEnd() + flowAwarePaddingEnd() + scrollbarLogicalHeight());
+ setLogicalHeight(mainAxisOffset + flowAwareBorderEnd() + flowAwarePaddingEnd());
if (style()->flexDirection() == FlowColumnReverse) {
// We have to do an extra pass for column-reverse to reposition the flex items since the start depends
@@ -1083,7 +1066,6 @@ void RenderFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(children);
LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwarePaddingEnd();
mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, style()->justifyContent(), numberOfChildrenForJustifyContent);
- mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
size_t seenInFlowPositionedChildren = 0;
for (size_t i = 0; i < children.size(); ++i) {
« no previous file with comments | « sky/engine/core/rendering/RenderFlexibleBox.h ('k') | sky/engine/core/rendering/RenderLayerScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698