Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
<audio> element counter-scaling causes overlapping media elements whe…
…n page scale is < 1

https://bugs.webkit.org/show_bug.cgi?id=255428
rdar://105846526

Reviewed by Tim Horton.

We counter scale <audio> controls on iOS, which causes them to
escape their element bounds if the user zooms out. Add a setting
to disable this behaviour.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: Add a
    new setting AudioControlsScaleWithPageZoom to mirror the generic
    Media setting.
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor): Add
    a test that escapes before setting the value.

Canonical link: https://commits.webkit.org/262952@main
  • Loading branch information
grorg committed Apr 14, 2023
1 parent 54dda99 commit 8f3ab17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
Expand Up @@ -648,6 +648,24 @@ AttachmentWideLayoutEnabled:
WebCore:
default: false

AudioControlsScaleWithPageZoom:
type: bool
status: embedder
category: media
defaultValue:
WebKitLegacy:
"HAVE(UIKIT_WEBKIT_INTERNALS)": true
"PLATFORM(IOS_FAMILY)": false
default: true
WebKit:
"HAVE(UIKIT_WEBKIT_INTERNALS)": true
"PLATFORM(IOS_FAMILY)": false
default: true
WebCore:
"HAVE(UIKIT_WEBKIT_INTERNALS)": true
"PLATFORM(IOS_FAMILY)": false
default: true

AudioDescriptionsEnabled:
type: bool
status: preview
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/html/HTMLMediaElement.cpp
Expand Up @@ -59,6 +59,7 @@
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "FullscreenManager.h"
#include "HTMLAudioElement.h"
#include "HTMLParserIdioms.h"
#include "HTMLSourceElement.h"
#include "HTMLTrackElement.h"
Expand Down Expand Up @@ -8007,7 +8008,6 @@ bool HTMLMediaElement::ensureMediaControls()
if (callData.type == JSC::CallData::Type::None)
return false;


auto controllerValue = JSC::call(&lexicalGlobalObject, function, callData, &globalObject, argList);
RETURN_IF_EXCEPTION(scope, reportExceptionAndReturnFalse());

Expand Down Expand Up @@ -8050,7 +8050,7 @@ void HTMLMediaElement::setMediaControlsDependOnPageScaleFactor(bool dependsOnPag
{
INFO_LOG(LOGIDENTIFIER, dependsOnPageScale);

if (document().settings().mediaControlsScaleWithPageZoom()) {
if (document().settings().mediaControlsScaleWithPageZoom() || (is<HTMLAudioElement>(*this) && document().settings().audioControlsScaleWithPageZoom())) {
INFO_LOG(LOGIDENTIFIER, "forced to false by Settings value");
m_mediaControlsDependOnPageScaleFactor = false;
return;
Expand Down

0 comments on commit 8f3ab17

Please sign in to comment.