Commit c4b459e8 authored by Manuel Rego Casasnovas's avatar Manuel Rego Casasnovas Committed by Commit Bot

[css-contain] Fix <select> dimensions when size containment is set

In r666210 we fixed the dimensions of <select> elements
with size containment.
However the fix was not covering the case when you set
"contain: size" to an already existent <select> element.

To fix this we need to reset the options width
in LayoutMenuList::UpdateOptionsWidth().

BUG=966673
TEST=external/wpt/css/css-contain/contain-size-select-002.html

Change-Id: I162134ff050d64e9ff1d824b5747adafb9a993c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1647152Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Manuel Rego <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#666594}
parent 5e63a09e
...@@ -208,8 +208,10 @@ void LayoutMenuList::UpdateInnerBlockHeight() { ...@@ -208,8 +208,10 @@ void LayoutMenuList::UpdateInnerBlockHeight() {
} }
void LayoutMenuList::UpdateOptionsWidth() const { void LayoutMenuList::UpdateOptionsWidth() const {
if (ShouldApplySizeContainment()) if (ShouldApplySizeContainment()) {
options_width_ = 0;
return; return;
}
float max_option_width = 0; float max_option_width = 0;
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Containment Test: Size containment on select</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-size">
<link rel="match" href="reference/contain-size-select-001-ref.html">
<meta name=assert content="Check that setting 'contain: size' on a <select> elements causes it to be sized as having no contents.">
<style>
select {
color: white;
background: white;
}
</style>
<p>Test passes if it has the same output than the reference.</p>
<select id="target">
<option>AVeryLongOption</option>
<option>Another Option</option>
</select>
<script>
window.requestAnimationFrame( () => {
target.style.contain = "size";
});
</script>
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