Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f706c72da85c5041afe03dbff2968fd9a2d82171
https://github.com/WebKit/WebKit/commit/f706c72da85c5041afe03dbff2968fd9a2d82171
Author: Ahmad Saleem <[email protected]>
Date: 2026-06-23 (Tue, 23 Jun 2026)
Changed paths:
A
LayoutTests/media/modern-media-controls/css/transformed-media-controls-update-expected.txt
A
LayoutTests/media/modern-media-controls/css/transformed-media-controls-update.html
M Source/WebCore/Modules/modern-media-controls/media/media-controller.js
M Source/WebCore/rendering/RenderMedia.cpp
Log Message:
-----------
<audio> and <video> controls render strangely when rotated
https://bugs.webkit.org/show_bug.cgi?id=182745
rdar://37516619
Reviewed by Jer Noble.
The _updateControlsSize() method in MediaController used getBoundingClientRect()
with an inverse transform to compute untransformed control dimensions. This is
mathematically incorrect for rotations: getBoundingClientRect() returns the
axis-aligned bounding box of the rotated element, and inverse-transforming
that box's corners produces inflated dimensions (e.g. 450px instead of 300px
for a 300x150 element rotated 45 degrees).
Replace the complex inverse-transform approach with offsetWidth/offsetHeight,
which directly return the untransformed layout dimensions regardless of any
CSS transform applied.
Additionally, notify the media controls when the CSS transform property changes
by calling layoutSizeChanged() from RenderMedia::styleDidChange(), so the
controls are resized when a transform is dynamically applied or changed.
* Source/WebCore/Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype._updateControlsSize):
* Source/WebCore/rendering/RenderMedia.cpp:
(WebCore::RenderMedia::styleDidChange):
*
LayoutTests/media/modern-media-controls/css/transformed-media-controls-update-expected.txt:
Added.
*
LayoutTests/media/modern-media-controls/css/transformed-media-controls-update.html:
Added.
Canonical link: https://commits.webkit.org/315718@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications