Commit 93afc9e1 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Remove LayoutMenuList::ComputeLogicalHeight()

Similar to crrev.com/742068, this CL moves the code of
LayoutMenuList::ComputeLogicalHeight() to LayoutBox in order to make
LayoutNG transition easier.

This CL has no behavior changes.

Bug: 1040828
Change-Id: Ia338d7edf01bf513bc653dc26510862433beee9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2065191
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742985}
parent 38d0733d
......@@ -154,6 +154,16 @@ LayoutUnit ListBoxItemHeight(const HTMLSelectElement& select,
return max_height;
}
LayoutUnit MenuListIntrinsicBlockSize(const HTMLSelectElement& select,
const LayoutBox& box) {
if (!box.StyleRef().HasEffectiveAppearance())
return kIndefiniteSize;
const SimpleFontData* font_data = box.StyleRef().GetFont().PrimaryFont();
DCHECK(font_data);
return (font_data ? font_data->GetFontMetrics().Height() : 0) +
select.InnerElement().GetLayoutBox()->BorderAndPaddingLogicalHeight();
}
} // anonymous namespace
BoxLayoutExtraInput::BoxLayoutExtraInput(LayoutBox& box) : box(box) {
......@@ -862,10 +872,13 @@ LayoutUnit LayoutBox::DefaultIntrinsicContentBlockSize() const {
// get here.
DCHECK(!HasOverrideIntrinsicContentLogicalHeight());
auto* select = DynamicTo<HTMLSelectElement>(GetNode());
if (select && !select->UsesMenuList()) {
return ListBoxItemHeight(*select, *this) * select->ListBoxSize() -
ScrollbarLogicalHeight();
if (const auto* select = DynamicTo<HTMLSelectElement>(GetNode())) {
if (select->UsesMenuList()) {
return MenuListIntrinsicBlockSize(*select, *this);
} else {
return ListBoxItemHeight(*select, *this) * select->ListBoxSize() -
ScrollbarLogicalHeight();
}
}
return kIndefiniteSize;
}
......
......@@ -53,10 +53,6 @@ HTMLSelectElement* LayoutMenuList::SelectElement() const {
return To<HTMLSelectElement>(GetNode());
}
LayoutBlock* LayoutMenuList::InnerBlock() const {
return To<LayoutBlock>(SelectElement()->InnerElement().GetLayoutObject());
}
int LayoutMenuList::MeasureOptionsWidth() const {
if (ShouldApplySizeContainment())
return 0;
......@@ -102,19 +98,4 @@ void LayoutMenuList::ComputeIntrinsicLogicalWidths(
min_logical_width = LayoutUnit();
}
void LayoutMenuList::ComputeLogicalHeight(
LayoutUnit logical_height,
LayoutUnit logical_top,
LogicalExtentComputedValues& computed_values) const {
if (StyleRef().HasEffectiveAppearance()) {
const SimpleFontData* font_data = StyleRef().GetFont().PrimaryFont();
DCHECK(font_data);
const LayoutUnit inner_block_height =
(font_data ? font_data->GetFontMetrics().Height() : 0) +
InnerBlock()->BorderAndPaddingHeight();
logical_height = inner_block_height + BorderAndPaddingHeight();
}
LayoutBox::ComputeLogicalHeight(logical_height, logical_top, computed_values);
}
} // namespace blink
......@@ -53,11 +53,6 @@ class CORE_EXPORT LayoutMenuList final : public LayoutFlexibleBox {
void ComputeIntrinsicLogicalWidths(
LayoutUnit& min_logical_width,
LayoutUnit& max_logical_width) const override;
void ComputeLogicalHeight(LayoutUnit logical_height,
LayoutUnit logical_top,
LogicalExtentComputedValues&) const override;
LayoutBlock* InnerBlock() const;
int MeasureOptionsWidth() const;
};
......
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