-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context Menu shows Exit Full Screen instead of Exit Viewer #29798
Context Menu shows Exit Full Screen instead of Exit Viewer #29798
Conversation
EWS run on previous version of this PR (hash 9b94885) |
9b94885
to
aba38a6
Compare
EWS run on previous version of this PR (hash aba38a6) |
@@ -3,7 +3,7 @@ | |||
archiveVersion = 1; | |||
classes = { | |||
}; | |||
objectVersion = 54; | |||
objectVersion = 55; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ok?
@@ -175,6 +175,9 @@ | |||
/* Allow button title in speech recognition prompt */ | |||
"Allow (speechrecognition)" = "Allow"; | |||
|
|||
/* Allow */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these ok to add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't being added, just moved. The script sorts alphabetically.
Though we should preserve the existing comment for this string, which was Display USDZ file
.
auto* mediaElement(this->mediaElement()); | ||
auto* videoElement = dynamicDowncast<HTMLVideoElement>(*mediaElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these should be RefPtr's maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a lot of examples in this file of raw pointers being used (for example, HitTestResult::toggleEnhancedFullscreenForVideo()). I am not sure if this is for a particular reason, or if it would still be best practice to use RefPtr's. @pxlcoder do you have thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All new code should use RefPtr
s. We are slowly working towards adopting smart pointers everywhere (which is why others in this file have not yet been updated).
if (videoElement->webkitPresentationMode() == HTMLVideoElement::VideoPresentationMode::InWindow) | ||
videoElement->webkitSetPresentationMode(HTMLVideoElement::VideoPresentationMode::Inline); | ||
else | ||
videoElement->webkitSetPresentationMode(HTMLVideoElement::VideoPresentationMode::InWindow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (videoElement->webkitPresentationMode() == HTMLVideoElement::VideoPresentationMode::InWindow) | |
videoElement->webkitSetPresentationMode(HTMLVideoElement::VideoPresentationMode::Inline); | |
else | |
videoElement->webkitSetPresentationMode(HTMLVideoElement::VideoPresentationMode::InWindow); | |
auto newMode = videoElement->webkitPresentationMode() == HTMLVideoElement::VideoPresentationMode::InWindow ? HTMLVideoElement::VideoPresentationMode::Inline : HTMLVideoElement::VideoPresentationMode::InWindow; | |
videoElement->webkitSetPresentationMode(newMode); |
@@ -175,6 +175,9 @@ | |||
/* Allow button title in speech recognition prompt */ | |||
"Allow (speechrecognition)" = "Allow"; | |||
|
|||
/* Allow */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't being added, just moved. The script sorts alphabetically.
Though we should preserve the existing comment for this string, which was Display USDZ file
.
@@ -1096,6 +1102,9 @@ | |||
/* Title for Open in External Application Link action button */ | |||
"Open in β%@β" = "Open in β%@β"; | |||
|
|||
/* Open this 3D model? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably preserve the original comment, which was Open 3D object in a new window?
.
@@ -286,12 +289,12 @@ | |||
/* Button title in Device Orientation Permission API prompt */ | |||
"Cancel (device motion and orientation access)" = "Cancel"; | |||
|
|||
/* Cancel */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about preserving the original comment. Cancel USDZ file
.
aba38a6
to
590540c
Compare
EWS run on previous version of this PR (hash 590540c) |
{ | ||
#if PLATFORM(MAC) && ENABLE(VIDEO) && ENABLE(VIDEO_PRESENTATION_MODE) | ||
RefPtr mediaElement(this->mediaElement()); | ||
RefPtr videoElement = dynamicDowncast<HTMLVideoElement>(*mediaElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is unsafe is mediaElement
is ever null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think dynamicDowncast returns a nullptr if mediaElement is null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to do:
RefPtr videoElement = dynamicDowncast<HTMLVideoElement>(mediaElement);
I.e., without the *
dereference.
590540c
to
5ab3302
Compare
EWS run on previous version of this PR (hash 5ab3302) |
{ | ||
#if PLATFORM(MAC) && ENABLE(VIDEO) && ENABLE(VIDEO_PRESENTATION_MODE) | ||
RefPtr mediaElement(this->mediaElement()); | ||
RefPtr videoElement = dynamicDowncast<HTMLVideoElement>(*mediaElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to do:
RefPtr videoElement = dynamicDowncast<HTMLVideoElement>(mediaElement);
I.e., without the *
dereference.
5ab3302
to
61d3bc9
Compare
EWS run on current version of this PR (hash 61d3bc9) |
RefPtr mediaElement(this->mediaElement()); | ||
RefPtr videoElement = dynamicDowncast<HTMLVideoElement>(mediaElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits: Early returns are always ok, so this could bail after the first RefPtr
. Also, this could be written either as a simple assignment, or with the modern, curly-brace initializer:
RefPtr mediaElement { this->mediaElement() };
if (!mediaElement)
return;
RefPtr videoElement = dynamicDowncast<HTMLVideoElement>(mediaElement);
But this would null-check mediaElement
twice, so you could add back in the dereference to mediaElement
inside dynamicDowncast()
. Just a suggestion though.
https://bugs.webkit.org/show_bug.cgi?id=275460 rdar://126300924 Reviewed by Jer Noble. This patch adds a context menu item to video elements that enters and exits Viewer mode. This patch also removes the toggle fullscreen context menu item when the video is in Viewer mode. * Source/WebCore/en.lproj/Localizable.strings: * Source/WebCore/page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): (WebCore::ContextMenuController::populate): (WebCore::ContextMenuController::checkOrEnableIfNeeded const): * Source/WebCore/platform/ContextMenuItem.cpp: (WebCore::isValidContextMenuAction): * Source/WebCore/platform/ContextMenuItem.h: * Source/WebCore/platform/LocalizedStrings.h: * Source/WebCore/platform/cocoa/LocalizedStringsCocoa.mm: (WebCore::contextMenuItemTagEnterVideoViewer): (WebCore::contextMenuItemTagExitVideoViewer): * Source/WebCore/rendering/HitTestResult.cpp: (WebCore::HitTestResult::mediaIsInVideoViewer const): (WebCore::HitTestResult::toggleVideoViewer const): * Source/WebCore/rendering/HitTestResult.h: * Source/WebKit/Shared/API/c/WKContextMenuItemTypes.h: * Source/WebKit/Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): * Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm: * Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h: * Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): * Source/WebKitLegacy/mac/WebView/WebHTMLView.mm: (toAction): (toTag): * Source/WebKitLegacy/mac/WebView/WebUIDelegatePrivate.h: Canonical link: https://commits.webkit.org/280128@main
61d3bc9
to
de1667d
Compare
Committed 280128@main (de1667d): https://commits.webkit.org/280128@main Reviewed commits have been landed. Closing PR #29798 and removing active labels. |
de1667d
61d3bc9