зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1780191. Avoid making primitives smaller than one pixel active. r=nical
Webrender doesn't seem to handle them well. This of course will affect the balance of making things active, but hopefully this is a good trade off. Differential Revision: https://phabricator.services.mozilla.com/D165726
This commit is contained in:
Родитель
1d23c6c2a2
Коммит
a454d87007
|
@ -1130,7 +1130,9 @@ static ItemActivity HasActiveChildren(
|
|||
}
|
||||
|
||||
static ItemActivity AssessBounds(const StackingContextHelper& aSc,
|
||||
const nsRect& aBounds) {
|
||||
nsDisplayListBuilder* aDisplayListBuilder,
|
||||
nsDisplayItem* aItem,
|
||||
bool aHasActivePrecedingSibling) {
|
||||
// Arbitrary threshold up for adjustments. What we want to avoid here
|
||||
// is alternating between active and non active items and create a lot
|
||||
// of overlapping blobs, so we only make images active if they are
|
||||
|
@ -1139,14 +1141,28 @@ static ItemActivity AssessBounds(const StackingContextHelper& aSc,
|
|||
// concern.
|
||||
constexpr float largeish = 512;
|
||||
|
||||
float width = aBounds.width * aSc.GetInheritedScale().xScale;
|
||||
float height = aBounds.height * aSc.GetInheritedScale().yScale;
|
||||
bool snap = false;
|
||||
nsRect bounds = aItem->GetBounds(aDisplayListBuilder, &snap);
|
||||
|
||||
if (width > largeish || height > largeish) {
|
||||
return ItemActivity::Should;
|
||||
float appUnitsPerDevPixel =
|
||||
static_cast<float>(aItem->Frame()->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
float width =
|
||||
static_cast<float>(bounds.width) * aSc.GetInheritedScale().xScale;
|
||||
float height =
|
||||
static_cast<float>(bounds.height) * aSc.GetInheritedScale().yScale;
|
||||
|
||||
// Webrender doesn't handle primitives smaller than a pixel well, so
|
||||
// avoid making them active.
|
||||
if (width >= appUnitsPerDevPixel && height >= appUnitsPerDevPixel) {
|
||||
if (aHasActivePrecedingSibling || width > largeish || height > largeish) {
|
||||
return ItemActivity::Should;
|
||||
}
|
||||
|
||||
return ItemActivity::Could;
|
||||
}
|
||||
|
||||
return ItemActivity::Could;
|
||||
return ItemActivity::No;
|
||||
}
|
||||
|
||||
// This function decides whether we want to treat this item as "active", which
|
||||
|
@ -1202,11 +1218,8 @@ static ItemActivity IsItemProbablyActive(
|
|||
if (StaticPrefs::gfx_webrender_svg_images() && aUniformlyScaled &&
|
||||
svgItem->ShouldBeActive(aBuilder, aResources, aSc, aManager,
|
||||
aDisplayListBuilder)) {
|
||||
if (aHasActivePrecedingSibling) {
|
||||
return ItemActivity::Should;
|
||||
}
|
||||
bool snap = false;
|
||||
return AssessBounds(aSc, aItem->GetBounds(aDisplayListBuilder, &snap));
|
||||
return AssessBounds(aSc, aDisplayListBuilder, aItem,
|
||||
aHasActivePrecedingSibling);
|
||||
}
|
||||
|
||||
return ItemActivity::No;
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<svg width="315px" height="445px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<svg viewBox="0 0 21000 29700" id="thetarget">
|
||||
<style>
|
||||
rect {
|
||||
fill: rgb(187,187,187);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// <![CDATA[
|
||||
function insertRect(x,y,w,h) {
|
||||
const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||
rect.setAttribute("x", x.toString());
|
||||
rect.setAttribute("y", y.toString());
|
||||
rect.setAttribute("height", h.toString());
|
||||
rect.setAttribute("width", w.toString());
|
||||
document.getElementById("thetarget").appendChild(rect);
|
||||
}
|
||||
function place() {
|
||||
let baseleft = 2000;
|
||||
let basetop = 2000;
|
||||
let width = 60;
|
||||
let height = 539;
|
||||
let coldiff = 120;
|
||||
let rowdiff = 600;
|
||||
for (let row = 0; row <= 60; row++) {
|
||||
insertRect(baseleft, basetop + rowdiff*row, 34200, height);
|
||||
}
|
||||
}
|
||||
|
||||
place();
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</svg>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1019 B |
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<svg width="315px" height="445px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<svg viewBox="0 0 21000 29700" id="thetarget">
|
||||
<script>
|
||||
// <![CDATA[
|
||||
function insertRect(x,y,w,h) {
|
||||
const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||
rect.setAttribute("x", x.toString());
|
||||
rect.setAttribute("y", y.toString());
|
||||
rect.setAttribute("height", h.toString());
|
||||
rect.setAttribute("width", w.toString());
|
||||
document.getElementById("thetarget").appendChild(rect);
|
||||
}
|
||||
function place() {
|
||||
let baseleft = 2000;
|
||||
let basetop = 2000;
|
||||
let width = 18;
|
||||
let height = 539;
|
||||
let coldiff = 66;
|
||||
let rowdiff = 600;
|
||||
for (let row = 0; row <= 60; row++) {
|
||||
for (let col = 0; col <= 360; col++) {
|
||||
insertRect(baseleft + col*coldiff + row, basetop + rowdiff*row, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
place();
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
|
||||
</svg>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1.0 KiB |
|
@ -2119,6 +2119,8 @@ skip-if(Android) test-pref(ui.textScaleFactor,150) test-pref(browser.display.os-
|
|||
skip-if(Android) test-pref(ui.textScaleFactor,50) test-pref(browser.display.os-zoom-behavior,1) != 1773633.html 1773633.html
|
||||
pref(widget.disable-dark-scrollbar,false) == 1777135.html 1777135-ref.html
|
||||
test-pref(widget.non-native-theme.use-theme-accent,false) == 1778834.html 1778834-ref.html
|
||||
# do not adjust the fuzz without looking, this test was written as fuzzy on purpose (because that was the only way to make a test work)
|
||||
fuzzy(16-47,26939-44425) == 1780191-1.svg 1780191-1-ref.svg
|
||||
pref(layout.css.prefers-color-scheme.content-override,0) == 1787127.html 1787127-ref.html
|
||||
pref(layout.css.prefers-color-scheme.content-override,1) == 1787127.html 1787127-ref.html
|
||||
pref(layout.css.prefers-color-scheme.content-override,2) == 1787127.html 1787127-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче