Bug 1305732 - part1 : don't show the box with zero width or height. r=heycam

Setting cue's position would also affect cue box's size which would be determined by cue's position alignment as well. If the cue box's width or height is zero, it means that this box should not be display on the screen and we should clear cue's display state as well.

Differential Revision: https://phabricator.services.mozilla.com/D35693

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alastor Wu 2019-07-03 23:07:43 +00:00
parent d705204f7f
commit 540674f2db

View File

@ -923,6 +923,10 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "DEBUG_LOG",
const cue = styleBox.cue;
const isWritingDirectionHorizontal = cue.vertical == "";
let box = new BoxPosition(styleBox);
if (!box.width || !box.height) {
LOG(`No way to adjust a box with zero width or height.`);
return;
}
// Spec 7.2.10, adjust the positions of boxes according to the appropriate
// steps from the following list. Also, we use offsetHeight/offsetWidth here
@ -1266,6 +1270,10 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "DEBUG_LOG",
LOG(`cue ${i}, ` + cueBox.getBoxInfoInChars());
} else {
LOG(`can not find a proper position to place cue ${i}`);
// Clear the display state and clear the reset flag in the cue as well,
// which controls whether the task for updating the cue display is
// dispatched.
cue.displayState = null;
rootOfCues.removeChild(styleBox.div);
}
}