Bug 703079 - Always dispatch mozfullscreenchange to owning document. r=bz

This commit is contained in:
Chris Pearce 2011-11-18 16:53:33 +13:00
Родитель 1470069ba7
Коммит d886dbad5e
2 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -8428,7 +8428,7 @@ nsIDocument::SizeOf() const
}
static void
DispatchFullScreenChange(nsINode* aTarget)
DispatchFullScreenChange(nsIDocument* aTarget)
{
nsRefPtr<nsPLDOMEvent> e =
new nsPLDOMEvent(aTarget,
@ -8652,7 +8652,7 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
// element, and the full-screen-ancestor styles on ancestors of the element
// in this document.
if (SetFullScreenState(aElement, true)) {
DispatchFullScreenChange(aElement);
DispatchFullScreenChange(aElement->OwnerDoc());
}
// Propagate up the document hierarchy, setting the full-screen element as
@ -8665,7 +8665,7 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
while ((parent = child->GetParentDocument())) {
Element* element = parent->FindContentForSubDocument(child)->AsElement();
if (::SetFullScreenState(parent, element, true)) {
DispatchFullScreenChange(element);
DispatchFullScreenChange(element->OwnerDoc());
}
child = parent;
}

Просмотреть файл

@ -65,7 +65,7 @@ function fullScreenChange(event) {
switch (fullScreenChangeCount) {
case 0: {
ok(document.mozFullScreen, "Should be in full-screen mode (first time)");
is(event.target, fullScreenElement(), "Event target should be full-screen element");
is(event.target, document, "Event target should be full-screen document #1");
is(document.mozFullScreenElement, fullScreenElement(),
"Full-screen element should be div element.");
ok(document.mozFullScreenElement.mozMatchesSelector(":-moz-full-screen"),
@ -83,7 +83,7 @@ function fullScreenChange(event) {
}
case 1: {
ok(!document.mozFullScreen, "Should have left full-screen mode (first time)");
is(event.target, document, "Event target should be document when we exit via removing from doc");
is(event.target, document, "Event target should be full-screen document #2");
is(document.mozFullScreenElement, null, "Full-screen element should be null.");
iframe = document.createElement("iframe");
iframe.mozAllowFullScreen = true;
@ -93,8 +93,7 @@ function fullScreenChange(event) {
}
case 2: {
ok(document.mozFullScreen, "Should be back in full-screen mode (second time)");
is(event.target, iframe,
"Event target should be full-screen element container");
is(event.target, document, "Event target should be full-screen document #3");
is(document.mozFullScreenElement, iframe,
"Full-screen element should be iframe element.");
@ -126,8 +125,7 @@ function fullScreenChange(event) {
}
case 3: {
ok(!document.mozFullScreen, "Should be back in non-full-screen mode (second time)");
is(event.target, document,
"Event target should be full-screen element container");
is(event.target, document, "Event target should be full-screen document #4");
is(document.mozFullScreenElement, null, "Full-screen element should be null.");
document.body.removeChild(iframe);
iframe = null;
@ -155,7 +153,7 @@ function fullScreenChange(event) {
}
case 4: {
ok(document.mozFullScreen, "Should still be in full-screen mode (third time)");
is(event.target, inDocElement, "Event target should be inDocElement");
is(event.target, document, "Event target should be full-screen document #5");
ok(fullScreenErrorRun, "Should have run fullscreenerror handler from previous case.");
is(document.mozFullScreenElement, inDocElement,
"FSE should be inDocElement.");