Bug 182745 - <audio> and <video> controls render strangely when rotated
Summary: <audio> and <video> controls render strangely when rotated
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac macOS 10.13
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2018-02-13 14:02 PST by Ryan Rempel
Modified: 2024-01-09 10:07 PST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Rempel 2018-02-13 14:02:03 PST
In Safari 11, and WebKit nightly r228428, it appears that the <audio> and <video> tags render their controls in an oddly offset position if a CSS rotation has been applied. Here's an example document HTML document:

<html>
    <head></head>
    <body>
        <div style="margin-left: 200px; margin-top: 20px">
            <div style="transform: rotate(45deg); transform-origin: top left; background-color: blue; height: 30px; width: 30px;"></div>
        </div>
        <div style="margin-left: 200px; margin-top: 50px">
            <audio controls="true" style="transform: rotate(45deg); transform-origin: top left; background-color: red;" />
        </div>
        <div style="margin-left: 200px; margin-top: 300px">
            <video controls="true" style="transform: rotate(45deg); transform-origin: top left; background-color: green;" />
        </div>
    </body>
</html>

I've made a jsfiddle here: https://jsfiddle.net/bxkq1fym/1/

If I view this in Chrome vs. WebKit, the placement of the background-color agrees. However, in WebKit, the controls for <audio> and <video> are strangely offset, depending on the angle of rotation. 

Here's how it looks -- what I would expect to see is that the audio control is located with the red background ... in fact, you shouldn't even see the red background, as the audio control should be on top of it:

https://drive.google.com/file/d/1zODqtwuhl905gltZpiK4_MpZizIewWe3/view

Here's how it looks in Chrome (and how I would expect it to look):

https://drive.google.com/file/d/1oEGOlfJY0xdMg3-3DJpfX6mW2eJ8qSth/view
Comment 1 Radar WebKit Bug Importer 2018-02-13 15:37:37 PST
<rdar://problem/37516619>
Comment 2 Ryan Rempel 2018-02-14 11:31:13 PST
In my real app, the `transform` style isn't applied to the <audio> tag itself, but instead to one of its ancestors. However, I created a simplified example here which applies the `transform` style to the <audio> tag itself.

The layout problem is the same in both cases. Just wanted to mention that, in case anything turns on exactly which node gets the `transform` style.
Comment 3 Ahmad Saleem 2024-01-09 10:07:30 PST
It is still reproducible in Safari 17.2.1. Adding 'BrowserCompat' tag.

https://jsfiddle.net/bxkq1fym/1/show