[tbb-commits] [tor-browser] 288/311: Bug 1761460 - Fix local space clip rects on snapped surfaces with reflections r=gfx-reviewers, nical a=dmeehan

gitolite role git at cupani.torproject.org
Tue Apr 26 15:31:28 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit 58db37321fea05e081773c0ff2afd56900a6e2ad
Author: Glenn Watson <git at intuitionlibrary.com>
AuthorDate: Wed Mar 30 08:42:56 2022 +0000

    Bug 1761460 - Fix local space clip rects on snapped surfaces with reflections r=gfx-reviewers,nical a=dmeehan
    
    In these cases the combined local clip rect may be in reflected
    local space. Map them to true raster space and then unmap them
    back to the new local space to correct this.
    
    Differential Revision: https://phabricator.services.mozilla.com/D142430
---
 gfx/tests/reftest/1761460-ref.html | 20 ++++++++++++++++++++
 gfx/tests/reftest/1761460.html     | 21 +++++++++++++++++++++
 gfx/tests/reftest/reftest.list     |  1 +
 gfx/wr/webrender/src/batch.rs      |  9 ++++++++-
 4 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/gfx/tests/reftest/1761460-ref.html b/gfx/tests/reftest/1761460-ref.html
new file mode 100644
index 0000000000000..e487b961d19cf
--- /dev/null
+++ b/gfx/tests/reftest/1761460-ref.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<style>
+.card {
+  box-sizing: border-box;
+  height: 400px;
+  width: 300px;
+  overflow: clip;
+  border-radius: 4px;
+}
+.card-heading-image {
+  width: 900px;
+  height: 300px;
+  background: red;
+  border-top-left-radius: 4px;
+  border-top-right-radius: 4px;
+}
+</style>
+<div class="card">
+  <div class="card-heading-image"></div>
+</div>
diff --git a/gfx/tests/reftest/1761460.html b/gfx/tests/reftest/1761460.html
new file mode 100644
index 0000000000000..d0a498f2462a1
--- /dev/null
+++ b/gfx/tests/reftest/1761460.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<style>
+.card {
+  box-sizing: border-box;
+  height: 400px;
+  width: 300px;
+  overflow: clip;
+  border-radius: 4px;
+}
+.card-heading-image {
+  width: 900px;
+  height: 300px;
+  background: red;
+  transform: scaleX(-1);
+  border-top-left-radius: 4px;
+  border-top-right-radius: 4px;
+}
+</style>
+<div class="card">
+  <div class="card-heading-image"></div>
+</div>
diff --git a/gfx/tests/reftest/reftest.list b/gfx/tests/reftest/reftest.list
index 4b2286f5f71bf..85ac8dfdcc920 100644
--- a/gfx/tests/reftest/reftest.list
+++ b/gfx/tests/reftest/reftest.list
@@ -33,3 +33,4 @@ fuzzy(64-99,512-523) == 1696439-1.html 1696439-1-ref.html
 random-if(gtkWidget) == 1722689-1.html 1722689-1-ref.html
 fuzzy-if(useDrawSnapshot,255-255,5-5) == 1724901-1.html 1724901-1-ref.html
 pref(image.downscale-during-decode.enabled,true) skip-if(Android) fuzzy-if(useDrawSnapshot&&browserIsFission,203-203,193600-193600) HTTP == 1724901-2.html 1724901-2-ref.html
+1761460.html 1761460-ref.html
diff --git a/gfx/wr/webrender/src/batch.rs b/gfx/wr/webrender/src/batch.rs
index 36f4a545cda75..bf4b306cae438 100644
--- a/gfx/wr/webrender/src/batch.rs
+++ b/gfx/wr/webrender/src/batch.rs
@@ -1560,6 +1560,7 @@ impl BatchBuilder {
                         let brush_flags = BrushFlags::PERSPECTIVE_INTERPOLATION;
 
                         let surface = &ctx.surfaces[raster_config.surface_index.0];
+                        let mut local_clip_rect = prim_info.combined_local_clip_rect;
 
                         // If we are drawing with snapping enabled, form a simple transform that just applies
                         // the scale / translation from the raster transform. Otherwise, in edge cases where the
@@ -1586,12 +1587,18 @@ impl BatchBuilder {
                             let ty = raster_rect.min.y - sy * prim_rect.min.y;
 
                             let transform = ScaleOffset::new(sx, sy, tx, ty);
+
+                            let raster_clip_rect = map_local_to_raster
+                                .map(&prim_info.combined_local_clip_rect)
+                                .unwrap();
+                            local_clip_rect = transform.unmap_rect(&raster_clip_rect);
+
                             transforms.get_custom(transform.to_transform())
                         };
 
                         let prim_header = PrimitiveHeader {
                             local_rect: prim_rect,
-                            local_clip_rect: prim_info.combined_local_clip_rect,
+                            local_clip_rect,
                             specific_prim_address: prim_cache_address,
                             transform_id,
                         };

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list