Commit 6d25e920 authored by cbiesinger's avatar cbiesinger Committed by Commit bot

[layoutng] Slightly simplify some code

This is my review comment from https://codereview.chromium.org/2616093004/

R=atotic@chromium.org
BUG=635619

Review-Url: https://codereview.chromium.org/2628983002
Cr-Commit-Position: refs/heads/master@{#443045}
parent 6c5aed8c
...@@ -54,28 +54,27 @@ NGConstraintSpace* NGConstraintSpace::CreateFromLayoutObject( ...@@ -54,28 +54,27 @@ NGConstraintSpace* NGConstraintSpace::CreateFromLayoutObject(
} }
NGLogicalSize percentage_size = {available_logical_width, NGLogicalSize percentage_size = {available_logical_width,
available_logical_height}; available_logical_height};
NGLogicalSize available_size = percentage_size;
// When we have an override size, the available_logical_{width,height} will be // When we have an override size, the available_logical_{width,height} will be
// used as the final size of the box, so it has to include border and // used as the final size of the box, so it has to include border and
// padding. // padding.
if (box.hasOverrideLogicalContentWidth()) { if (box.hasOverrideLogicalContentWidth()) {
available_logical_width = available_size.inline_size =
box.borderAndPaddingLogicalWidth() + box.overrideLogicalContentWidth(); box.borderAndPaddingLogicalWidth() + box.overrideLogicalContentWidth();
fixed_inline = true; fixed_inline = true;
} }
if (box.hasOverrideLogicalContentHeight()) { if (box.hasOverrideLogicalContentHeight()) {
available_logical_height = box.borderAndPaddingLogicalHeight() + available_size.block_size = box.borderAndPaddingLogicalHeight() +
box.overrideLogicalContentHeight(); box.overrideLogicalContentHeight();
fixed_block = true; fixed_block = true;
} }
bool is_new_fc = bool is_new_fc =
box.isLayoutBlock() && toLayoutBlock(box).createsNewFormattingContext(); box.isLayoutBlock() && toLayoutBlock(box).createsNewFormattingContext();
NGLogicalSize logical_size = {available_logical_width,
available_logical_height};
auto writing_mode = FromPlatformWritingMode(box.styleRef().getWritingMode()); auto writing_mode = FromPlatformWritingMode(box.styleRef().getWritingMode());
return NGConstraintSpaceBuilder(writing_mode) return NGConstraintSpaceBuilder(writing_mode)
.SetAvailableSize(logical_size) .SetAvailableSize(available_size)
.SetPercentageResolutionSize(percentage_size) .SetPercentageResolutionSize(percentage_size)
.SetIsInlineDirectionTriggersScrollbar( .SetIsInlineDirectionTriggersScrollbar(
box.styleRef().overflowInlineDirection() == EOverflow::Auto) box.styleRef().overflowInlineDirection() == EOverflow::Auto)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment