Bug 1922983. Avoid useless QI in nsDocShell::Get/SetWindowDraggingAllowed on every paint in content process. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D224671
This commit is contained in:
Timothy Nikkel
2024-10-07 10:27:11 +00:00
parent f504456106
commit c3d7871769

View File

@@ -2164,8 +2164,9 @@ nsresult nsDocShell::Now(DOMHighResTimeStamp* aWhen) {
NS_IMETHODIMP
nsDocShell::SetWindowDraggingAllowed(bool aValue) {
RefPtr<nsDocShell> parent = GetInProcessParentDocshell();
if (!aValue && mItemType == typeChrome && !parent) {
RefPtr<nsDocShell> parent;
if (!aValue && mItemType == typeChrome &&
!(parent = GetInProcessParentDocshell())) {
// Window dragging is always allowed for top level
// chrome docshells.
return NS_ERROR_FAILURE;
@@ -2179,8 +2180,8 @@ nsDocShell::GetWindowDraggingAllowed(bool* aValue) {
// window dragging regions in CSS (-moz-window-drag:drag)
// can be slow. Default behavior is to only allow it for
// chrome top level windows.
RefPtr<nsDocShell> parent = GetInProcessParentDocshell();
if (mItemType == typeChrome && !parent) {
RefPtr<nsDocShell> parent;
if (mItemType == typeChrome && !(parent = GetInProcessParentDocshell())) {
// Top level chrome window
*aValue = true;
} else {