Opened 3 years ago

Last modified 2 years ago

#17665 in-progress bug

WebKit: Text disappears and bad content clipping with opacity<1 and transform:rotate

Reported by: thebuck Owned by: madmax
Priority: high Milestone: Unscheduled
Component: Servers/app_server Version: R1/Development
Keywords: Cc: nephele
Blocked By: Blocking:
Platform: All

Description (last modified by thebuck)

This bug has been split out from #12511 at nephele's request.

When a HTML element is styled with e.g. opacity: 0.99; transform: rotate(110deg), text within is completely invisible. The element is additionally clipped at a vertical line on the right which goes through the element's transformed top right corner (i.e. nothing to the right of that corner (plus a little offset) is visible).

Clipping suspected here: GraphicsContextHaiku::clipBounds()
Example of a better implementation: TransformationMatrix::mapRect

Attachments (7)

opacity-transform.html (1.2 KB ) - added by thebuck 3 years ago.
Testcase: Hover the mouse over the skyblue element to rotate it. Un-/comment lines which have a comment in the style code to alter behaviour. I used hashes (#) to make CSS declarations invalid instead of commenting them properly out.
0001-GraphicsContextHaiku-add-tracing.patch (13.0 KB ) - added by nephele 3 years ago.
Patch to enable tracing in webkit GraphicsContextHaiku
99opacity-transform.html (588 bytes ) - added by nephele 3 years ago.
.99 opacity transform test
no-opacity-transform.html (588 bytes ) - added by nephele 3 years ago.
100 opacity transform test
Trace-opacity.txt (5.5 KB ) - added by nephele 3 years ago.
Trace with 1 opacity
Trace-no-opacity.txt (3.7 KB ) - added by nephele 3 years ago.
Trace with 1 opacity
Trace-diff.txt (1.9 KB ) - added by nephele 3 years ago.
Diff

Download all attachments as: .zip

Change History (14)

by thebuck, 3 years ago

Attachment: opacity-transform.html added

Testcase: Hover the mouse over the skyblue element to rotate it. Un-/comment lines which have a comment in the style code to alter behaviour. I used hashes (#) to make CSS declarations invalid instead of commenting them properly out.

comment:1 by thebuck, 3 years ago

Description: modified (diff)

comment:2 by nephele, 3 years ago

Cc: nephele added

by nephele, 3 years ago

Patch to enable tracing in webkit GraphicsContextHaiku

by nephele, 3 years ago

Attachment: 99opacity-transform.html added

.99 opacity transform test

by nephele, 3 years ago

Attachment: no-opacity-transform.html added

100 opacity transform test

by nephele, 3 years ago

Attachment: Trace-opacity.txt added

Trace with 1 opacity

by nephele, 3 years ago

Attachment: Trace-no-opacity.txt added

Trace with 1 opacity

by nephele, 3 years ago

Attachment: Trace-diff.txt added

Diff

comment:3 by nephele, 3 years ago

I've added Tracing to haikuwebkit to try and narrow this down, haven't looked much at the trace yet, but there seems to be a bit more going on than just transparency. Atleast it is visible that webkit does ask it to do transparency. Maybe the drawing in app_server is at fault for this case.

comment:4 by nephele, 3 years ago

(accidentally added an old trace, where it sais "beginTransparencyLayer: no values" It should say "endTransparencyLayer: no values")

comment:5 by madmax, 3 years ago

Owner: changed from pulkomandy to madmax
Status: newin-progress

comment:6 by thebuck, 2 years ago

More to the point, IntRect GraphicsContextHaiku::clipBounds() const cannot be correct for transformations other than translate/scale because it ensures visibility of only two of the four rectangle corners.

Taking a 45°-rotated square as example, it will be entirely(*) clipped away.
(*) IntRect shall keep a one pixel row or column due to its extend-only rounding scheme (not sure whether that is properly implemented, though).

Determining the (wrong) bounding rectangle of a transformed bounding rectangle produces an unnecessarily big rectangle anyway. Could the region.Frame() be called such that it takes the view transformation into account by itself?

comment:7 by madmax, 2 years ago

Component: Kits/Web KitServers/app_server

Except for trying to get the smallest bounding rectangle for a multipart region, that's fixed in master haikuwebkit. The problem with this ticket (transformed opacity layers) lies, at least in great part, in app_server, spread between alphamasks, pictures and drawing state handling.

Note: See TracTickets for help on using tickets.