зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1444185 - More consistently round around fallback data. r=mstange
To avoid trimming pixels at the top / left. This makes it closer to non-WR[1], and fixes both the checkboxes getting cut off and the master password field. [1]: non-WR at least at 124 scaling on a hiDPI display is still perfect, though I saw nin symmetric borders at other resolutions, so we might be able to improve here further. Differential Revision: https://phabricator.services.mozilla.com/D7251 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4b6737ba40
Коммит
9aeb8183fd
|
@ -1709,7 +1709,6 @@ PaintByLayer(nsDisplayItem* aItem,
|
|||
static bool
|
||||
PaintItemByDrawTarget(nsDisplayItem* aItem,
|
||||
gfx::DrawTarget* aDT,
|
||||
const LayerRect& aImageRect,
|
||||
const LayoutDevicePoint& aOffset,
|
||||
nsDisplayListBuilder* aDisplayListBuilder,
|
||||
const RefPtr<BasicLayerManager>& aManager,
|
||||
|
@ -1719,7 +1718,8 @@ PaintItemByDrawTarget(nsDisplayItem* aItem,
|
|||
MOZ_ASSERT(aDT);
|
||||
|
||||
bool isInvalidated = false;
|
||||
aDT->ClearRect(aImageRect.ToUnknownRect());
|
||||
// XXX Why is this ClearRect() needed?
|
||||
aDT->ClearRect(Rect(aDT->GetRect()));
|
||||
RefPtr<gfxContext> context = gfxContext::CreateOrNull(aDT);
|
||||
MOZ_ASSERT(context);
|
||||
|
||||
|
@ -1764,14 +1764,14 @@ PaintItemByDrawTarget(nsDisplayItem* aItem,
|
|||
// which isn't very useful.
|
||||
if (aHighlight) {
|
||||
aDT->SetTransform(gfx::Matrix());
|
||||
aDT->FillRect(gfx::Rect(0, 0, aImageRect.Width(), aImageRect.Height()), gfx::ColorPattern(aHighlight.value()));
|
||||
aDT->FillRect(Rect(aDT->GetRect()), gfx::ColorPattern(aHighlight.value()));
|
||||
}
|
||||
if (aItem->Frame()->PresContext()->GetPaintFlashing() && isInvalidated) {
|
||||
aDT->SetTransform(gfx::Matrix());
|
||||
float r = float(rand()) / RAND_MAX;
|
||||
float g = float(rand()) / RAND_MAX;
|
||||
float b = float(rand()) / RAND_MAX;
|
||||
aDT->FillRect(gfx::Rect(0, 0, aImageRect.Width(), aImageRect.Height()), gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
|
||||
aDT->FillRect(Rect(aDT->GetRect()), gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1819,7 +1819,10 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
|
|||
aItem->ComputeVisibility(aDisplayListBuilder, &visibleRegion);
|
||||
|
||||
const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
|
||||
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(paintBounds, appUnitsPerDevPixel);
|
||||
auto bounds = LayoutDeviceRect::FromAppUnits(paintBounds, appUnitsPerDevPixel);
|
||||
if (bounds.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gfx::Size scale = aSc.GetInheritedScale();
|
||||
gfx::Size oldScale = fallbackData->GetScale();
|
||||
|
@ -1830,31 +1833,18 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
|
|||
bool differentScale = gfx::FuzzyEqual(scale.width, oldScale.width, 1e-6f) &&
|
||||
gfx::FuzzyEqual(scale.height, oldScale.height, 1e-6f);
|
||||
|
||||
// XXX not sure if paintSize should be in layer or layoutdevice pixels, it
|
||||
// has some sort of scaling applied.
|
||||
LayerIntSize paintSize = RoundedToInt(LayerSize(bounds.Width() * scale.width, bounds.Height() * scale.height));
|
||||
if (paintSize.width == 0 || paintSize.height == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
LayoutDeviceToLayerScale2D layerScale(scale.width, scale.height);
|
||||
auto scaledBounds = bounds * layerScale;
|
||||
auto dtRect = RoundedOut(scaledBounds);
|
||||
auto dtSize = dtRect.Size();
|
||||
|
||||
// Some display item may draw exceed the paintSize, we need prepare a larger
|
||||
// draw target to contain the result.
|
||||
auto scaledBounds = bounds * LayoutDeviceToLayerScale(1);
|
||||
scaledBounds.Scale(scale.width, scale.height);
|
||||
LayerIntSize dtSize = RoundedToInt(scaledBounds).Size();
|
||||
aImageRect = dtRect / layerScale;
|
||||
|
||||
// TODO Rounding a rect to integers and then taking the size gives a different behavior than
|
||||
// just rounding the size of the rect to integers. This can cause a crash, but fixing the
|
||||
// difference causes some test failures so this is a quick fix
|
||||
if (dtSize.width <= 0 || dtSize.height <= 0) {
|
||||
return nullptr;
|
||||
}
|
||||
auto offset = aImageRect.TopLeft();
|
||||
|
||||
nsDisplayItemGeometry* geometry = fallbackData->GetGeometry();
|
||||
|
||||
bool needPaint = true;
|
||||
LayoutDeviceIntPoint offset = RoundedToInt(bounds.TopLeft());
|
||||
aImageRect = LayoutDeviceRect(offset, LayoutDeviceSize(RoundedToInt(bounds).Size()));
|
||||
LayerRect paintRect = LayerRect(LayerPoint(0, 0), LayerSize(paintSize));
|
||||
nsDisplayItemGeometry* geometry = fallbackData->GetGeometry();
|
||||
|
||||
// nsDisplayFilters is rendered via BasicLayerManager which means the invalidate
|
||||
// region is unknown until we traverse the displaylist contained by it.
|
||||
|
@ -1918,9 +1908,9 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
|
|||
if (!fallbackData->mBasicLayerManager) {
|
||||
fallbackData->mBasicLayerManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
|
||||
}
|
||||
bool isInvalidated = PaintItemByDrawTarget(aItem, dt, paintRect, offset, aDisplayListBuilder,
|
||||
bool isInvalidated = PaintItemByDrawTarget(aItem, dt, offset, aDisplayListBuilder,
|
||||
fallbackData->mBasicLayerManager, scale, highlight);
|
||||
recorder->FlushItem(IntRect(0, 0, paintSize.width, paintSize.height));
|
||||
recorder->FlushItem(IntRect({ 0, 0 }, dtSize.ToUnknownSize()));
|
||||
TakeExternalSurfaces(recorder, fallbackData->mExternalSurfaces, mManager, aResources);
|
||||
recorder->Finish();
|
||||
|
||||
|
@ -1956,7 +1946,7 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
|
|||
if (!fallbackData->mBasicLayerManager) {
|
||||
fallbackData->mBasicLayerManager = new BasicLayerManager(mManager->GetWidget());
|
||||
}
|
||||
isInvalidated = PaintItemByDrawTarget(aItem, dt, paintRect, offset,
|
||||
isInvalidated = PaintItemByDrawTarget(aItem, dt, offset,
|
||||
aDisplayListBuilder,
|
||||
fallbackData->mBasicLayerManager, scale,
|
||||
highlight);
|
||||
|
@ -2014,7 +2004,7 @@ WebRenderCommandBuilder::BuildWrMaskImage(nsDisplayItem* aItem,
|
|||
|
||||
wr::WrImageMask imageMask;
|
||||
imageMask.image = fallbackData->GetKey().value();
|
||||
imageMask.rect = wr::ToRoundedLayoutRect(aBounds);
|
||||
imageMask.rect = wr::ToRoundedLayoutRect(imageRect);
|
||||
imageMask.repeat = false;
|
||||
return Some(imageMask);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ fuzzy-if(winWidget,0-1,0-1) == multicolor-image-2.html multicolor-image-2-ref.ht
|
|||
== transparent-image-1.html transparent-image-1-ref.html
|
||||
!= repeat-image-1.html repeat-image-1-ref.html
|
||||
fuzzy-if(webrender,15-15,975-986) == 470250-1.html 470250-1-ref.html
|
||||
fuzzy-if(webrender,15-15,975-986) == 470250-2.html 470250-2-ref.html
|
||||
fuzzy-if(webrender,15-233,975-1073) == 470250-2.html 470250-2-ref.html
|
||||
!= different-h-v-1.html different-h-v-ref.html
|
||||
!= different-h-v-2.html different-h-v-ref.html
|
||||
!= different-h-v-1.html different-h-v-2.html
|
||||
|
|
|
@ -1420,8 +1420,8 @@ fuzzy-if(Android,0-5,0-1656) fuzzy-if(skiaContent,0-1,0-1200) == 512410.html 512
|
|||
== 512631-1.html 512631-1-ref.html
|
||||
== 513153-1a.html 513153-1-ref.html
|
||||
== 513153-1b.html 513153-1-ref.html
|
||||
== 513153-2a.html 513153-2-ref.html
|
||||
fuzzy-if(webrender&&cocoaWidget,5-5,106-106) == 513153-2b.html 513153-2-ref.html
|
||||
fuzzy-if(webrender&&winWidget,82-82,76-76) == 513153-2a.html 513153-2-ref.html
|
||||
fuzzy-if(webrender&&cocoaWidget,34-34,103-103) == 513153-2b.html 513153-2-ref.html
|
||||
== 513318-1.xul 513318-1-ref.xul
|
||||
fails-if(Android&&(!asyncPan)) != 513318-2.xul 513318-2-ref.xul
|
||||
== 514917-1.html 514917-1-ref.html
|
||||
|
|
|
@ -14,13 +14,13 @@ fuzzy-if(skiaContent,0-1,0-40) == to-range-from-other-type-unthemed-1.html to-ra
|
|||
|
||||
# dynamic value changes:
|
||||
fuzzy-if(skiaContent,0-1,0-40) == value-prop-unthemed.html 75pct-unthemed-common-ref.html
|
||||
== value-prop.html 75pct-common-ref.html
|
||||
fuzzy-if(webrender&>kWidget,96-96,163-163) == value-prop.html 75pct-common-ref.html
|
||||
fuzzy-if(skiaContent,0-1,0-40) == valueAsNumber-prop-unthemed.html 75pct-unthemed-common-ref.html
|
||||
== valueAsNumber-prop.html 75pct-common-ref.html
|
||||
fuzzy-if(webrender&>kWidget,96-96,163-163) == valueAsNumber-prop.html 75pct-common-ref.html
|
||||
fuzzy-if(skiaContent,0-1,0-40) == stepDown-unthemed.html 75pct-unthemed-common-ref.html
|
||||
== stepDown.html 75pct-common-ref.html
|
||||
fuzzy-if(webrender&>kWidget,96-96,163-163) == stepDown.html 75pct-common-ref.html
|
||||
fuzzy-if(skiaContent,0-1,0-40) == stepUp-unthemed.html 75pct-unthemed-common-ref.html
|
||||
== stepUp.html 75pct-common-ref.html
|
||||
fuzzy-if(webrender&>kWidget,96-96,163-163) == stepUp.html 75pct-common-ref.html
|
||||
== max-prop.html 100pct-common-ref.html
|
||||
== reset-value.html reset-value-ref.html
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ test-pref(font.minimum-size.x-math,40) == default-font.html default-font-ref.htm
|
|||
!= radicalbar-1a.html about:blank
|
||||
!= radicalbar-1b.html about:blank
|
||||
!= radicalbar-1c.html about:blank
|
||||
fails-if(webrender&>kWidget) != radicalbar-1d.html about:blank
|
||||
!= radicalbar-1d.html about:blank
|
||||
!= radicalbar-2.html about:blank
|
||||
!= radicalbar-2a.html about:blank
|
||||
!= radicalbar-2b.html about:blank
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
fuzzy-if(Android,0-16,0-244) fuzzy-if(webrender,0-47,0-6) == marker-basic.html marker-basic-ref.html # Bug 1128229
|
||||
== marker-string.html marker-string-ref.html
|
||||
skip-if(Android) fuzzy-if(webrender,0-47,0-18) == bidi-simple.html bidi-simple-ref.html # Fails on Android due to anti-aliasing
|
||||
skip-if(!gtkWidget) fuzzy-if(gtkWidget,0-2,0-289) == bidi-simple-scrolled.html bidi-simple-scrolled-ref.html # Fails on Windows and OSX due to anti-aliasing
|
||||
skip-if(!gtkWidget) fuzzy-if(gtkWidget,0-124,0-289) == bidi-simple-scrolled.html bidi-simple-scrolled-ref.html # Fails on Windows and OSX due to anti-aliasing
|
||||
fuzzy-if(Android,0-24,0-4000) fuzzy-if(cocoaWidget,0-1,0-40) fuzzy-if(asyncPan&&!layersGPUAccelerated,0-149,0-1836) == scroll-rounding.html scroll-rounding-ref.html # bug 760264
|
||||
fuzzy(0-16,0-454) fails-if(gtkWidget) fuzzy-if(webrender&&!gtkWidget,50-85,459-499) skip-if(OSX&&!isDebugBuild&&verify) == anonymous-block.html anonymous-block-ref.html # gtkWidget:bug 1309103, fuzzy: subpixel aa
|
||||
fuzzy-if(webrender,0-47,0-3) == false-marker-overlap.html false-marker-overlap-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче