Closed Bug 1568684 Opened 5 years ago Closed 5 years ago

URL bar looks bad with WebRender on

Categories

(Core :: Graphics: WebRender, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla70
Tracking Status
firefox70 --- verified

People

(Reporter: jrmuizel, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

Attached image no-wr.png

The rounded corners look bad and the box is thicker at the bottom. See screenshots.
I see this with device pixel ratio = 1.5

Attached image wr.png
Blocks: wr-69
Priority: -- → P2

It would be good to get a reduced test case of this.

See Also: → 1555977

I'm seeing this problem when using a devicePixelRatio of 1.5

I've been debugging this a bunch. It looks like layout is giving us unrounded border widths (1.5px) and that's causing bad.

Layout seems to do this because of set_border_top_width is using a value of 60 for mTwipsPerPixel

https://searchfox.org/mozilla-central/rev/1dfd70469212ef2785d41827c5532c571c784227/servo/components/style/properties/gecko.mako.rs#530

while the bordering rendering code is using a value of 40.

mTwipsPerPixel is getting 60 from https://searchfox.org/mozilla-central/rev/1dfd70469212ef2785d41827c5532c571c784227/layout/style/nsStyleStruct.cpp#326 because it has no prescontext.

This differing values of appunits seems bad. Emilio?

Flags: needinfo?(emilio)

Hmm, the initial style should be invalidated once we get a pres shell... I'll take a look.

I also think we should do the snapping later generally, but that's a more general problem...

So when I poke at the border rendering code I get 40 app units, which is the expected thing afaict, right?

In nsCSSBorderRenderer::CreateWebRenderCommands for that border (the one in #about-config-search):

(rr) p aItem->Frame()->StyleBorder()->mTwipsPerPixel
$9 = 40
(rr) p aItem->Frame()->StyleBorder()->mComputedBorder
$10 = {<mozilla::gfx::BaseMargin<int, nsMargin>> = {top = 40, right = 40, bottom = 40, left = 40}, <No data fields>}

Is there something I'm missing? As far as I can tell all that is expected (there are 40 app units per device pixel at with layout.css.devPixelsPerPx=1.5).

Where are you seeing the wrong mTwipsPerPx? It is expected that we start with 60 initially if there's no pres context, but as soon as we get one we end up here, which eventually gets here which recomputes the style.

Can repro, sorry:

18:09 <emilio> jrmuizel: oh, nvm, I see... The urlbar goes wrong and gets fixed when resized
18:09 <emilio> jrmuizel: the searchbar in about:config remains wrongly snapped regardless
18:10 <emilio> jrmuizel: (and that's what I was debugging, since I don't know how to read bug titles ;_;)
Assignee: nobody → emilio
Flags: needinfo?(emilio)

The test unfortunately passes without the patch because for HTML documents we go
through DoUpdateCharSet which ends up through RebuildAllStyleData. So I think
this bug is not web-observable.

I'll file a bug to try to optimize parts of that away, since I think that we can
be doing a bit of wasteful work there for somewhat common cases...

Blocks: 1569718

Could this somehow fix bug 1489463?

Pretty unlikely.

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/21c18dee8d84 Initial style needs to be invalidated even if we haven't had stylesheets earlier. r=heycam
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Hello,

I want to verify if this bug is fixed in Fx 70.b10 but it seems i would need a reduced test case or maybe I'm missing something because as far as I can see the only way to have a device pixel ratio of 1.5 is to do it in RDM by making a custom device with that pixel ratio. But my problem is that the search bar in about:config is not accessible in RDM mode. I would be grateful for any help!

Flags: needinfo?(emilio)

You can set layout.css.devPixelsPerPx to 1.5 instead (and probably needs a browser restart after changing it, or opening a new window to see the bug on bad builds).

Flags: needinfo?(emilio)

Thank you Emilio for the help!

So on Fx 70b10 with webrender on and a devicePixelRatio of 1.5 the bottom part of the search bar has a small white line/a space 1 pixel wide.

Flags: needinfo?(emilio)

That is the search bar in about:config. This bug is about the url bar.

Flags: needinfo?(emilio)

Hello,

Sorry about that, I got confused by the screenshot as both the search bar and the url bar looked pretty bad in the screenshot. I can verify that this issue is fixed on Fx 70.0b13.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: