Bug 1578355 - Part 1: Move user-activation code from EventStateManager to UserActivation; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D45168
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "nsFocusManager.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/dom/MutationEventBinding.h"
|
||||
#include "mozilla/dom/UserActivation.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
#include "imgLoader.h"
|
||||
#include "Image.h"
|
||||
@@ -316,7 +317,7 @@ nsresult HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
if (aName == nsGkAtoms::src && aNameSpaceID == kNameSpaceID_None && !aValue) {
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
||||
// SetAttr handles setting src since it needs to catch img.src =
|
||||
// img.src, so we only need to handle the unset case
|
||||
@@ -332,7 +333,7 @@ nsresult HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
} else if (aName == nsGkAtoms::srcset && aNameSpaceID == kNameSpaceID_None) {
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
||||
mSrcsetTriggeringPrincipal = aMaybeScriptedPrincipal;
|
||||
|
||||
@@ -340,7 +341,7 @@ nsresult HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
} else if (aName == nsGkAtoms::sizes && aNameSpaceID == kNameSpaceID_None) {
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
||||
PictureSourceSizesChanged(this, attrVal.String(), aNotify);
|
||||
} else if (aName == nsGkAtoms::decoding &&
|
||||
@@ -383,7 +384,7 @@ void HTMLImageElement::AfterMaybeChangeAttr(
|
||||
if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::src) {
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
||||
mSrcTriggeringPrincipal = nsContentUtils::GetAttrTriggeringPrincipal(
|
||||
this, aValue.String(), aMaybeScriptedPrincipal);
|
||||
@@ -446,7 +447,7 @@ void HTMLImageElement::AfterMaybeChangeAttr(
|
||||
if (forceReload) {
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
||||
if (InResponsiveMode()) {
|
||||
// per spec, full selection runs when this changes, even though
|
||||
@@ -518,7 +519,7 @@ nsresult HTMLImageElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
||||
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
||||
// Run selection algorithm when an img element is inserted into a document
|
||||
// in order to react to changes in the environment. See note of
|
||||
@@ -534,7 +535,7 @@ nsresult HTMLImageElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
||||
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
||||
// We still act synchronously for the non-responsive case (Bug
|
||||
// 1076583), but still need to delay if it is unsafe to run
|
||||
@@ -722,7 +723,7 @@ nsresult HTMLImageElement::CopyInnerTo(HTMLImageElement* aDest) {
|
||||
aDest->OwnerDoc()->ShouldLoadImages()) {
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
||||
nsContentUtils::AddScriptRunner(NewRunnableMethod<bool>(
|
||||
"dom::HTMLImageElement::MaybeLoadImage", aDest,
|
||||
|
||||
Reference in New Issue
Block a user