Commit 7048fc86 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[cleanup] Remove box-pack/box-align from LayoutDeprecatedFlexibleBox 2/4

Per: https://www.chromestatus.com/feature/5680142707851264

In M85 we switched -webkit-line-clamp over to LayoutNG which had the
(indended) side-effect of removing support for:
 -webkit-box-flex
 -webkit-box-ordinal-group
 -webkit-box-align
 -webkit-box-pack
 -webkit-box-direction

When used with -webkit-line-clamp.

This patch removes the -webkit-box-align, and -webkit-box-pack from
LayoutDeprecatedFlexibleBox

Bug: 305376
Change-Id: I24a86ae3db854c80e6fa9a5a768bb6594ad253d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2375732
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801946}
parent 6f6ce9ce
...@@ -245,16 +245,10 @@ void LayoutDeprecatedFlexibleBox::UpdateBlockLayout(bool relayout_children) { ...@@ -245,16 +245,10 @@ void LayoutDeprecatedFlexibleBox::UpdateBlockLayout(bool relayout_children) {
UseCounter::Count(GetDocument(), WebFeature::kWebkitBoxLayout); UseCounter::Count(GetDocument(), WebFeature::kWebkitBoxLayout);
if (StyleRef().BoxAlign() != ComputedStyleInitialValues::InitialBoxAlign())
UseCounter::Count(GetDocument(), WebFeature::kWebkitBoxAlignNotInitial);
if (StyleRef().BoxDirection() != if (StyleRef().BoxDirection() !=
ComputedStyleInitialValues::InitialBoxDirection()) ComputedStyleInitialValues::InitialBoxDirection())
UseCounter::Count(GetDocument(), WebFeature::kWebkitBoxDirectionNotInitial); UseCounter::Count(GetDocument(), WebFeature::kWebkitBoxDirectionNotInitial);
if (StyleRef().BoxPack() != ComputedStyleInitialValues::InitialBoxPack())
UseCounter::Count(GetDocument(), WebFeature::kWebkitBoxPackNotInitial);
if (!FirstChildBox()) { if (!FirstChildBox()) {
UseCounter::Count(GetDocument(), WebFeature::kWebkitBoxNoChildren); UseCounter::Count(GetDocument(), WebFeature::kWebkitBoxNoChildren);
} else if (!FirstChildBox()->NextSiblingBox()) { } else if (!FirstChildBox()->NextSiblingBox()) {
...@@ -396,37 +390,14 @@ void LayoutDeprecatedFlexibleBox::LayoutVerticalBox(bool relayout_children) { ...@@ -396,37 +390,14 @@ void LayoutDeprecatedFlexibleBox::LayoutVerticalBox(bool relayout_children) {
// Now do a layout. // Now do a layout.
child->LayoutIfNeeded(); child->LayoutIfNeeded();
// We can place the child now, using our value of box-align. // Place the child.
LayoutUnit child_x = BorderLeft() + PaddingLeft(); LayoutUnit child_x = BorderLeft() + PaddingLeft();
switch (StyleRef().BoxAlign()) { if (StyleRef().IsLeftToRightDirection()) {
case EBoxAlignment::kCenter: child_x += child->MarginLeft();
case EBoxAlignment::kBaseline: // Baseline just maps to center for } else {
// vertical boxes child_x +=
child_x += child->MarginLeft() + ContentWidth() - child->MarginRight() - child->Size().Width();
((ContentWidth() -
(child->Size().Width() + child->MarginWidth())) /
2)
.ClampNegativeToZero();
break;
case EBoxAlignment::kEnd:
if (!StyleRef().IsLeftToRightDirection()) {
child_x += child->MarginLeft();
} else {
child_x +=
ContentWidth() - child->MarginRight() - child->Size().Width();
}
break;
default: // BSTART/BSTRETCH
if (StyleRef().IsLeftToRightDirection()) {
child_x += child->MarginLeft();
} else {
child_x +=
ContentWidth() - child->MarginRight() - child->Size().Width();
}
break;
} }
// Place the child.
PlaceChild(child, LayoutPoint(child_x, Size().Height())); PlaceChild(child, LayoutPoint(child_x, Size().Height()));
SetHeight(Size().Height() + child->Size().Height() + SetHeight(Size().Height() + child->Size().Height() +
child->MarginBottom()); child->MarginBottom());
...@@ -553,63 +524,6 @@ void LayoutDeprecatedFlexibleBox::LayoutVerticalBox(bool relayout_children) { ...@@ -553,63 +524,6 @@ void LayoutDeprecatedFlexibleBox::LayoutVerticalBox(bool relayout_children) {
} }
} while (have_flex); } while (have_flex);
if (StyleRef().BoxPack() != EBoxPack::kStart && remaining_space > 0) {
// Children must be repositioned.
LayoutUnit offset;
if (StyleRef().BoxPack() == EBoxPack::kJustify) {
UseCounter::Count(GetDocument(),
WebFeature::kWebkitBoxPackJustifyDoesSomething);
// Determine the total number of children.
int total_children = 0;
for (LayoutBox* child = FirstChildBox(); child;
child = child->NextSiblingBox()) {
if (child->IsOutOfFlowPositioned())
continue;
++total_children;
}
// Iterate over the children and space them out according to the
// justification level.
if (total_children > 1) {
--total_children;
bool first_child = true;
for (LayoutBox* child = FirstChildBox(); child;
child = child->NextSiblingBox()) {
if (child->IsOutOfFlowPositioned())
continue;
if (first_child) {
first_child = false;
continue;
}
offset += remaining_space / total_children;
remaining_space -= (remaining_space / total_children);
--total_children;
PlaceChild(child,
child->Location() + LayoutSize(LayoutUnit(), offset));
}
}
} else {
if (StyleRef().BoxPack() == EBoxPack::kCenter) {
UseCounter::Count(GetDocument(),
WebFeature::kWebkitBoxPackCenterDoesSomething);
offset += remaining_space / 2;
} else { // END
UseCounter::Count(GetDocument(),
WebFeature::kWebkitBoxPackEndDoesSomething);
offset += remaining_space;
}
for (LayoutBox* child = FirstChildBox(); child;
child = child->NextSiblingBox()) {
if (child->IsOutOfFlowPositioned())
continue;
PlaceChild(child, child->Location() + LayoutSize(LayoutUnit(), offset));
}
}
}
// So that the computeLogicalHeight in layoutBlock() knows to relayout // So that the computeLogicalHeight in layoutBlock() knows to relayout
// positioned objects because of a height change, we revert our height back // positioned objects because of a height change, we revert our height back
// to the intrinsic height before returning. // to the intrinsic height before returning.
......
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