зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1918454 - Prevent divide by zero when inverting effective zoom. r=firefox-style-system-reviewers,layout-reviewers,boris
See comment. Differential Revision: https://phabricator.services.mozilla.com/D222090
This commit is contained in:
Родитель
f9137675d2
Коммит
9cd09c2624
|
@ -2726,7 +2726,10 @@ impl<'a> StyleBuilder<'a> {
|
|||
pub fn resolved_specified_zoom(&self) -> computed::Zoom {
|
||||
let zoom = self.specified_zoom();
|
||||
if zoom.is_document() {
|
||||
self.inherited_effective_zoom().inverted()
|
||||
// If our inherited effective zoom has derived to zero, there's not much we can do.
|
||||
// This value is not exposed to content anyways (it's used for scrollbars and to avoid
|
||||
// zoom affecting canvas).
|
||||
self.inherited_effective_zoom().inverted().unwrap_or(computed::Zoom::ONE)
|
||||
} else {
|
||||
zoom
|
||||
}
|
||||
|
|
|
@ -365,8 +365,11 @@ impl Zoom {
|
|||
|
||||
/// Returns the inverse of our value.
|
||||
#[inline]
|
||||
pub fn inverted(&self) -> Self {
|
||||
Self(Self::ONE.0 / self.0)
|
||||
pub fn inverted(&self) -> Option<Self> {
|
||||
if self.0.value == 0 {
|
||||
return None;
|
||||
}
|
||||
Some(Self(Self::ONE.0 / self.0))
|
||||
}
|
||||
|
||||
/// Returns the value as a float.
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<style>
|
||||
*:nth-of-type(1) {
|
||||
zoom: 5%;
|
||||
}
|
||||
</style>
|
||||
<textarea>
|
Загрузка…
Ссылка в новой задаче