зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 9040424c0cb8 (bug 1700539) for wpt crashes. CLOSED TREE
This commit is contained in:
Родитель
4f9ae2ef76
Коммит
519ef52f2d
|
@ -150,12 +150,14 @@ impl ScaleOffset {
|
|||
// To check that we have a pure scale / translation:
|
||||
// Every field must match an identity matrix, except:
|
||||
// - Any value present in tx,ty
|
||||
// - Any value present in sx,sy
|
||||
// - Any non-neg value present in sx,sy (avoid negative for reflection/rotation)
|
||||
|
||||
if m.m12.abs() > NEARLY_ZERO ||
|
||||
if m.m11 < 0.0 ||
|
||||
m.m12.abs() > NEARLY_ZERO ||
|
||||
m.m13.abs() > NEARLY_ZERO ||
|
||||
m.m14.abs() > NEARLY_ZERO ||
|
||||
m.m21.abs() > NEARLY_ZERO ||
|
||||
m.m22 < 0.0 ||
|
||||
m.m23.abs() > NEARLY_ZERO ||
|
||||
m.m24.abs() > NEARLY_ZERO ||
|
||||
m.m31.abs() > NEARLY_ZERO ||
|
||||
|
@ -228,56 +230,28 @@ impl ScaleOffset {
|
|||
}
|
||||
|
||||
pub fn map_rect<F, T>(&self, rect: &Rect<f32, F>) -> Rect<f32, T> {
|
||||
let x0 = rect.origin.x * self.scale.x + self.offset.x;
|
||||
let y0 = rect.origin.y * self.scale.y + self.offset.y;
|
||||
|
||||
// TODO(gw): The logic below can return an unexpected result if the supplied
|
||||
// rect is invalid (has size < 0). Since Gecko currently supplied
|
||||
// invalid rects in some cases, adding a max(0) here ensures that
|
||||
// mapping an invalid rect retains the property that rect.is_empty()
|
||||
// will return true (the mapped rect output will have size 0 instead
|
||||
// of a negative size). In future we could catch / assert / fix
|
||||
// these invalid rects earlier, and assert here instead.
|
||||
|
||||
let x1 = x0 + rect.size.width.max(0.0) * self.scale.x;
|
||||
let y1 = y0 + rect.size.height.max(0.0) * self.scale.y;
|
||||
|
||||
Rect::new(
|
||||
Point2D::new(
|
||||
x0.min(x1),
|
||||
y0.min(y1),
|
||||
rect.origin.x * self.scale.x + self.offset.x,
|
||||
rect.origin.y * self.scale.y + self.offset.y,
|
||||
),
|
||||
Size2D::new(
|
||||
(x0 - x1).abs(),
|
||||
(y0 - y1).abs(),
|
||||
),
|
||||
rect.size.width * self.scale.x,
|
||||
rect.size.height * self.scale.y,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
pub fn unmap_rect<F, T>(&self, rect: &Rect<f32, F>) -> Rect<f32, T> {
|
||||
let x0 = (rect.origin.x - self.offset.x) / self.scale.x;
|
||||
let y0 = (rect.origin.y - self.offset.y) / self.scale.y;
|
||||
|
||||
// TODO(gw): The logic below can return an unexpected result if the supplied
|
||||
// rect is invalid (has size < 0). Since Gecko currently supplied
|
||||
// invalid rects in some cases, adding a max(0) here ensures that
|
||||
// mapping an invalid rect retains the property that rect.is_empty()
|
||||
// will return true (the mapped rect output will have size 0 instead
|
||||
// of a negative size). In future we could catch / assert / fix
|
||||
// these invalid rects earlier, and assert here instead.
|
||||
|
||||
let x1 = x0 + rect.size.width.max(0.0) / self.scale.x;
|
||||
let y1 = y0 + rect.size.height.max(0.0) / self.scale.y;
|
||||
|
||||
Rect::new(
|
||||
Point2D::new(
|
||||
x0.min(x1),
|
||||
y0.min(y1),
|
||||
(rect.origin.x - self.offset.x) / self.scale.x,
|
||||
(rect.origin.y - self.offset.y) / self.scale.y,
|
||||
),
|
||||
Size2D::new(
|
||||
(x0 - x1).abs(),
|
||||
(y0 - y1).abs(),
|
||||
),
|
||||
rect.size.width / self.scale.x,
|
||||
rect.size.height / self.scale.y,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -707,35 +681,6 @@ pub mod test {
|
|||
assert!(xref.approx_eq(&xf));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn negative_scale_map_unmap() {
|
||||
let xref = LayoutTransform::scale(1.0, -1.0, 1.0)
|
||||
.pre_translate(LayoutVector3D::new(124.0, 38.0, 0.0));
|
||||
let so = ScaleOffset::from_transform(&xref).unwrap();
|
||||
let local_rect = LayoutRect::new(
|
||||
LayoutPoint::new(50.0, -100.0),
|
||||
LayoutSize::new(200.0, 400.0),
|
||||
);
|
||||
|
||||
let mapped_rect: LayoutRect = so.map_rect(&local_rect);
|
||||
let xf_rect = project_rect(
|
||||
&xref,
|
||||
&local_rect,
|
||||
&LayoutRect::max_rect(),
|
||||
).unwrap();
|
||||
|
||||
assert!(mapped_rect.origin.x.approx_eq(&xf_rect.origin.x));
|
||||
assert!(mapped_rect.origin.y.approx_eq(&xf_rect.origin.y));
|
||||
assert!(mapped_rect.size.width.approx_eq(&xf_rect.size.width));
|
||||
assert!(mapped_rect.size.height.approx_eq(&xf_rect.size.height));
|
||||
|
||||
let unmapped_rect: LayoutRect = so.unmap_rect(&mapped_rect);
|
||||
assert!(unmapped_rect.origin.x.approx_eq(&local_rect.origin.x));
|
||||
assert!(unmapped_rect.origin.y.approx_eq(&local_rect.origin.y));
|
||||
assert!(unmapped_rect.size.width.approx_eq(&local_rect.size.width));
|
||||
assert!(unmapped_rect.size.height.approx_eq(&local_rect.size.height));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scale_offset_convert() {
|
||||
let xref = LayoutTransform::translation(130.0, 200.0, 0.0);
|
||||
|
|
Двоичные данные
gfx/wr/wrench/reftests/boxshadow/scale.png
Двоичные данные
gfx/wr/wrench/reftests/boxshadow/scale.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 13 KiB После Ширина: | Высота: | Размер: 13 KiB |
|
@ -29,7 +29,7 @@ fuzzy(0-2,0-440) == boxshadow-skiprect.html boxshadow-skiprect-ref.html
|
|||
fuzzy(0-3,0-500) fuzzy-if(d2d,0-2,0-1080) == boxshadow-border-radius-int.html boxshadow-border-radius-int-ref.html
|
||||
== boxshadow-inset-neg-spread.html about:blank
|
||||
== boxshadow-inset-neg-spread2.html boxshadow-inset-neg-spread2-ref.html
|
||||
fuzzy(0-26,0-3610) fuzzy-if(d2d,0-26,0-5910) fuzzy-if(webrender,0-6,400-4500) == boxshadow-rotated.html boxshadow-rotated-ref.html # Bug 1211264
|
||||
fuzzy(0-26,0-3610) fuzzy-if(d2d,0-26,0-5910) fuzzy-if(webrender,4-7,4013-4573) == boxshadow-rotated.html boxshadow-rotated-ref.html # Bug 1211264
|
||||
== boxshadow-inset-large-border-radius.html boxshadow-inset-large-border-radius-ref.html
|
||||
|
||||
# fuzzy due to blur going inside, but as long as it's essentially black instead of a light gray its ok.
|
||||
|
|
|
@ -23,7 +23,7 @@ fuzzy-if(cocoaWidget,0-135,0-56) == dir-6a.html dir-6a-ref.html
|
|||
== css-spacing-1.html css-spacing-1-ref.html
|
||||
pref(mathml.disabled,true) == disabled-scriptlevel-1.html disabled-scriptlevel-1-ref.html
|
||||
pref(mathml.disabled,true) == disabled-scriptlevel-1.xhtml disabled-scriptlevel-1-ref.xhtml
|
||||
random-if(smallScreen&&Android) fuzzy(0-255,0-200) fuzzy-if(geckoview&&webrender,201-216,200-250) fuzzy-if(webrender&&winWidget,114-255,245-361) fuzzy-if(webrender&&OSX,79-153,240-250) == mirror-op-1.html mirror-op-1-ref.html
|
||||
random-if(smallScreen&&Android) fuzzy(0-255,0-200) fuzzy-if(geckoview&&webrender,201-216,312-316) fuzzy-if(webrender&&winWidget,114-255,245-361) fuzzy-if(webrender&&OSX,79-153,307-314) == mirror-op-1.html mirror-op-1-ref.html
|
||||
!= mirror-op-2.html mirror-op-2-ref.html
|
||||
!= mirror-op-3.html mirror-op-3-ref.html
|
||||
!= mirror-op-4.html mirror-op-4-ref.html
|
||||
|
|
|
@ -79,7 +79,7 @@ fuzzy-if(Android,0-192,0-82) == multiple-x-holes-rtl.svg multiple-x-holes-rtl-re
|
|||
|
||||
fails-if(geckoview) == multiple-chunks-bidi.svg multiple-chunks-bidi-ref.svg # Bug 1558513 for GV
|
||||
fails-if(geckoview) == multiple-chunks-different-anchor-bidi.svg multiple-chunks-different-anchor-bidi-ref.svg # Bug 1558513 for GV
|
||||
fuzzy-if(Android,0-128,0-170) == multiple-chunks-different-anchor-rtl.svg multiple-chunks-different-anchor-rtl-ref.svg
|
||||
fuzzy-if(Android,0-128,0-130) == multiple-chunks-different-anchor-rtl.svg multiple-chunks-different-anchor-rtl-ref.svg
|
||||
== multiple-chunks-different-anchor.svg multiple-chunks-different-anchor-ref.svg
|
||||
fuzzy-if(Android,0-242,0-81) == multiple-chunks-directions-and-anchor.svg multiple-chunks-directions-and-anchor-ref.svg
|
||||
== multiple-chunks-directions-and-anchor-dx.svg multiple-chunks-directions-and-anchor-dx-ref.svg
|
||||
|
|
|
@ -151,8 +151,8 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1188061-2-nsChangeHint_U
|
|||
# tests involving sideways-lr mode
|
||||
random-if(gtkWidget) == 1193519-sideways-lr-1.html 1193519-sideways-lr-1-ref.html
|
||||
random-if(gtkWidget) == 1193519-sideways-lr-2.html 1193519-sideways-lr-2-ref.html
|
||||
fuzzy-if(winWidget,0-3,0-84) == 1193519-sideways-lr-3.html 1193519-sideways-lr-3-ref.html
|
||||
fuzzy-if(winWidget,0-3,0-112) fails-if(Android) random-if(gtkWidget) == 1193519-sideways-lr-4.html 1193519-sideways-lr-4-ref.html # see bug 1366692. Rounding error with WR enabled, and on Android.
|
||||
fuzzy-if(winWidget,0-3,0-84) fails-if(webrender&&winWidget&&!swgl) == 1193519-sideways-lr-3.html 1193519-sideways-lr-3-ref.html
|
||||
fuzzy-if(winWidget,0-3,0-112) fails-if(webrender&&!swgl&&!cocoaWidget) fails-if(Android) random-if(gtkWidget) == 1193519-sideways-lr-4.html 1193519-sideways-lr-4-ref.html # see bug 1366692. Rounding error with WR enabled, and on Android.
|
||||
fuzzy-if(gtkWidget,0-255,0-12) fuzzy-if(cocoaWidget,0-65,0-69) fuzzy-if(geckoview&&webrender,0-255,0-13) == 1193519-sideways-lr-decoration-1.html 1193519-sideways-lr-decoration-1-ref.html
|
||||
|
||||
== 1196887-1-computed-display-inline-block.html 1196887-1-computed-display-inline-block-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче