Commit 19406324 authored by Seokho Song's avatar Seokho Song Committed by Chromium LUCI CQ

_fixWindowSize function should be called if children size changed

When the children appended, the height of <select> popup must be changed.

Therefore, Add a condition for calling the function.

Bug: 753001
Change-Id: If20fae2d1d578839ef3b6d6405c8400198968464
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2603763Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Seokho Song <0xdevssh@gmail.com>
Cr-Commit-Position: refs/heads/master@{#843096}
parent 5fd6bebc
...@@ -90,6 +90,7 @@ ListPicker.prototype._handleWindowMessage = function(event) { ...@@ -90,6 +90,7 @@ ListPicker.prototype._handleWindowMessage = function(event) {
if (window.updateData.type === 'update') { if (window.updateData.type === 'update') {
this._config.baseStyle = window.updateData.baseStyle; this._config.baseStyle = window.updateData.baseStyle;
this._config.children = window.updateData.children; this._config.children = window.updateData.children;
const prev_children_count = this._selectElement.children.length;
this._update(); this._update();
if (this._config.anchorRectInScreen.x !== if (this._config.anchorRectInScreen.x !==
window.updateData.anchorRectInScreen.x || window.updateData.anchorRectInScreen.x ||
...@@ -98,9 +99,10 @@ ListPicker.prototype._handleWindowMessage = function(event) { ...@@ -98,9 +99,10 @@ ListPicker.prototype._handleWindowMessage = function(event) {
this._config.anchorRectInScreen.width !== this._config.anchorRectInScreen.width !==
window.updateData.anchorRectInScreen.width || window.updateData.anchorRectInScreen.width ||
this._config.anchorRectInScreen.height !== this._config.anchorRectInScreen.height !==
window.updateData.anchorRectInScreen.height) { window.updateData.anchorRectInScreen.height ||
this._config.anchorRectInScreen = window.updateData.anchorRectInScreen; prev_children_count !== window.updateData.children.length) {
this._fixWindowSize(); this._config.anchorRectInScreen = window.updateData.anchorRectInScreen;
this._fixWindowSize();
} }
} }
delete window.updateData; delete window.updateData;
......
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/ahem.js"></script>
<script src="../resources/picker-common.js"></script>
<style>
select:focus {
outline-width: 0;
}
select {
width: 200px;
font: 10px Ahem;
appearance: none;
background-color: white;
}
</style>
</head>
<body>
<select id='menu'>
<option>test</option>
<option>test</option>
</select>
<script>
var menu = document.getElementById('menu')
if (window.testRunner) {
testRunner.waitUntilDone();
openPickerAppearanceOnly(menu, () => testRunner.notifyDone());
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/ahem.js"></script>
<script src="../resources/picker-common.js"></script>
<style>
select:focus {
outline-width: 0;
}
select {
width: 200px;
font: 10px Ahem;
appearance: none;
background-color: white;
}
</style>
</head>
<body>
<select id='menu'>
<option>test</option>
</select>
<script>
var menu = document.getElementById('menu')
if (window.testRunner) {
testRunner.waitUntilDone();
openPickerAppearanceOnly(menu, () => {
requestAnimationFrame(() => {
var option = document.createElement("option");
option.text = "test";
option.value = "test";
menu.append(option);
testRunner.notifyDone();
});
});
}
</script>
</body>
</html>
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