mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1489387 - Have fullscreenerror event aligned to refresh driver tick. r=smaug
Depends on D5235 Differential Revision: https://phabricator.services.mozilla.com/D5236 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6e3feb9c6b
commit
04533463d7
@ -8555,7 +8555,8 @@ static void
|
||||
DispatchFullScreenChange(nsIDocument* aTarget)
|
||||
{
|
||||
if (nsPresContext* presContext = aTarget->GetPresContext()) {
|
||||
auto pendingEvent = MakeUnique<PendingFullscreenEvent>(aTarget);
|
||||
auto pendingEvent =
|
||||
MakeUnique<PendingFullscreenEvent>(FullscreenEventType::Change, aTarget);
|
||||
presContext->RefreshDriver()->
|
||||
ScheduleFullscreenEvent(std::move(pendingEvent));
|
||||
}
|
||||
@ -10927,12 +10928,12 @@ nsIDocument::AsyncRequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
void
|
||||
nsIDocument::DispatchFullscreenError(const char* aMessage)
|
||||
{
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("fullscreenerror"),
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
if (nsPresContext* presContext = GetPresContext()) {
|
||||
auto pendingEvent =
|
||||
MakeUnique<PendingFullscreenEvent>(FullscreenEventType::Error, this);
|
||||
presContext->RefreshDriver()->
|
||||
ScheduleFullscreenEvent(std::move(pendingEvent));
|
||||
}
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("DOM"), this,
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
|
@ -13,6 +13,12 @@ class nsIDocument;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum class FullscreenEventType
|
||||
{
|
||||
Change,
|
||||
Error,
|
||||
};
|
||||
|
||||
/*
|
||||
* Class for dispatching a fullscreen event. It should be queued and
|
||||
* invoked as part of "run the fullscreen steps" algorithm.
|
||||
@ -20,8 +26,9 @@ namespace mozilla {
|
||||
class PendingFullscreenEvent
|
||||
{
|
||||
public:
|
||||
explicit PendingFullscreenEvent(nsIDocument* aDoc)
|
||||
PendingFullscreenEvent(FullscreenEventType aType, nsIDocument* aDoc)
|
||||
: mDocument(aDoc)
|
||||
, mType(aType)
|
||||
{
|
||||
MOZ_ASSERT(aDoc);
|
||||
}
|
||||
@ -34,13 +41,23 @@ public:
|
||||
MOZ_ASSERT(!mDispatched);
|
||||
mDispatched = true;
|
||||
#endif
|
||||
nsString name;
|
||||
switch (mType) {
|
||||
case FullscreenEventType::Change:
|
||||
name = NS_LITERAL_STRING("fullscreenchange");
|
||||
break;
|
||||
case FullscreenEventType::Error:
|
||||
name = NS_LITERAL_STRING("fullscreenerror");
|
||||
break;
|
||||
}
|
||||
Unused << nsContentUtils::DispatchTrustedEvent(
|
||||
mDocument, mDocument, NS_LITERAL_STRING("fullscreenchange"),
|
||||
mDocument, mDocument, name,
|
||||
CanBubble::eYes, Cancelable::eNo, nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
FullscreenEventType mType;
|
||||
#ifdef DEBUG
|
||||
bool mDispatched = false;
|
||||
#endif
|
||||
|
@ -1,4 +0,0 @@
|
||||
[element-request-fullscreen-active-document.html]
|
||||
[Element#requestFullscreen() when the document is not the active document]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user