Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 2325663002: Make Fullscreen::requestFullscreen and exitFullscreen static (Closed)
Patch Set: doc->document, for loop Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 if (m_fullScreenLayoutObject) 215 if (m_fullScreenLayoutObject)
216 m_fullScreenLayoutObject->destroy(); 216 m_fullScreenLayoutObject->destroy();
217 217
218 m_currentFullScreenElement = nullptr; 218 m_currentFullScreenElement = nullptr;
219 m_fullscreenElementStack.clear(); 219 m_fullscreenElementStack.clear();
220 } 220 }
221 221
222 void Fullscreen::requestFullscreen(Element& element, RequestType requestType, bo ol forCrossProcessDescendant) 222 void Fullscreen::requestFullscreen(Element& element, RequestType requestType, bo ol forCrossProcessDescendant)
223 { 223 {
224 Document& document = element.document();
225
224 // Use counters only need to be incremented in the process of the actual 226 // Use counters only need to be incremented in the process of the actual
225 // fullscreen element. 227 // fullscreen element.
226 if (!forCrossProcessDescendant) { 228 if (!forCrossProcessDescendant) {
227 if (document()->isSecureContext()) { 229 if (document.isSecureContext()) {
228 UseCounter::count(document(), UseCounter::FullscreenSecureOrigin); 230 UseCounter::count(document, UseCounter::FullscreenSecureOrigin);
229 } else { 231 } else {
230 UseCounter::count(document(), UseCounter::FullscreenInsecureOrigin); 232 UseCounter::count(document, UseCounter::FullscreenInsecureOrigin);
231 HostsUsingFeatures::countAnyWorld(*document(), HostsUsingFeatures::F eature::FullscreenInsecureHost); 233 HostsUsingFeatures::countAnyWorld(document, HostsUsingFeatures::Feat ure::FullscreenInsecureHost);
232 } 234 }
233 } 235 }
234 236
235 // Ignore this request if the document is not in a live frame. 237 // Ignore this request if the document is not in a live frame.
236 if (!document()->isActive()) 238 if (!document.isActive())
237 return; 239 return;
238 240
239 // If |element| is on top of |doc|'s fullscreen element stack, terminate the se substeps. 241 // If |element| is on top of |doc|'s fullscreen element stack, terminate the se substeps.
240 if (&element == fullscreenElement()) 242 if (&element == fullscreenElementFrom(document))
241 return; 243 return;
242 244
243 do { 245 do {
244 // 1. If any of the following conditions are true, terminate these steps and queue a task to fire 246 // 1. If any of the following conditions are true, terminate these steps and queue a task to fire
245 // an event named fullscreenerror with its bubbles attribute set to true on the context object's 247 // an event named fullscreenerror with its bubbles attribute set to true on the context object's
246 // node document: 248 // node document:
247 249
248 // The fullscreen element ready check returns false. 250 // The fullscreen element ready check returns false.
249 if (!fullscreenElementReady(element)) 251 if (!fullscreenElementReady(element))
250 break; 252 break;
251 253
252 // Fullscreen is not supported. 254 // Fullscreen is not supported.
253 if (!fullscreenIsSupported(element.document())) 255 if (!fullscreenIsSupported(document))
254 break; 256 break;
255 257
256 // This algorithm is not allowed to request fullscreen. 258 // This algorithm is not allowed to request fullscreen.
257 // An algorithm is allowed to request fullscreen if one of the following 259 // An algorithm is allowed to request fullscreen if one of the following
258 // is true: 260 // is true:
259 // - the algorithm is triggered by a user activation. 261 // - the algorithm is triggered by a user activation.
260 // - the algorithm is triggered by a user generated orientation change. 262 // - the algorithm is triggered by a user generated orientation change.
261 // 263 //
262 // If |forCrossProcessDescendant| is true, requestFullscreen 264 // If |forCrossProcessDescendant| is true, requestFullscreen
263 // was already called on a descendant element in another process, and 265 // was already called on a descendant element in another process, and
264 // getting here means that it already passed the user gesture check. 266 // getting here means that it already passed the user gesture check.
265 if (!UserGestureIndicator::utilizeUserGesture() && !ScopedOrientationCha ngeIndicator::processingOrientationChange() && !forCrossProcessDescendant) { 267 if (!UserGestureIndicator::utilizeUserGesture() && !ScopedOrientationCha ngeIndicator::processingOrientationChange() && !forCrossProcessDescendant) {
266 String message = ExceptionMessages::failedToExecute("requestFullscre en", 268 String message = ExceptionMessages::failedToExecute("requestFullscre en",
267 "Element", "API can only be initiated by a user gesture."); 269 "Element", "API can only be initiated by a user gesture.");
268 document()->addConsoleMessage( 270 document.addConsoleMessage(
269 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, mes sage)); 271 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, mes sage));
270 break; 272 break;
271 } 273 }
272 274
273 // 2. Let doc be element's node document. (i.e. "this") 275 // 2. Let doc be element's node document. (i.e. "this")
274 Document* currentDoc = document();
275 276
276 // 3. Let docs be all doc's ancestor browsing context's documents (if an y) and doc. 277 // 3. Let docs be all doc's ancestor browsing context's documents (if an y) and doc.
277 // 278 //
278 // For OOPIF scenarios, |docs| will only contain documents for local 279 // For OOPIF scenarios, |docs| will only contain documents for local
279 // ancestors, and remote ancestors will be processed in their 280 // ancestors, and remote ancestors will be processed in their
280 // respective processes. This preserves the spec's event firing order 281 // respective processes. This preserves the spec's event firing order
281 // for local ancestors, but not for remote ancestors. However, that 282 // for local ancestors, but not for remote ancestors. However, that
282 // difference shouldn't be observable in practice: a fullscreenchange 283 // difference shouldn't be observable in practice: a fullscreenchange
283 // event handler would need to postMessage a frame in another renderer 284 // event handler would need to postMessage a frame in another renderer
284 // process, where the message should be queued up and processed after 285 // process, where the message should be queued up and processed after
285 // the IPC that dispatches fullscreenchange. 286 // the IPC that dispatches fullscreenchange.
286 HeapDeque<Member<Document>> docs; 287 HeapDeque<Member<Document>> docs;
287 288
288 docs.prepend(currentDoc); 289 docs.prepend(&document);
289 for (Frame* frame = currentDoc->frame()->tree().parent(); frame; frame = frame->tree().parent()) { 290 for (Frame* frame = document.frame()->tree().parent(); frame; frame = fr ame->tree().parent()) {
290 if (frame->isLocalFrame()) 291 if (frame->isLocalFrame())
291 docs.prepend(toLocalFrame(frame)->document()); 292 docs.prepend(toLocalFrame(frame)->document());
292 } 293 }
293 294
294 // 4. For each document in docs, run these substeps: 295 // 4. For each document in docs, run these substeps:
295 HeapDeque<Member<Document>>::iterator current = docs.begin(), following = docs.begin(); 296 HeapDeque<Member<Document>>::iterator current = docs.begin(), following = docs.begin();
296 297
297 do { 298 do {
298 ++following; 299 ++following;
299 300
300 // 1. Let following document be the document after document in docs, or null if there is no 301 // 1. Let following document be the document after document in docs, or null if there is no
301 // such document. 302 // such document.
302 Document* currentDoc = *current; 303 Document* currentDoc = *current;
303 Document* followingDoc = following != docs.end() ? *following : null ptr; 304 Document* followingDoc = following != docs.end() ? *following : null ptr;
304 305
305 // 2. If following document is null, push context object on document 's fullscreen element 306 // 2. If following document is null, push context object on document 's fullscreen element
306 // stack, and queue a task to fire an event named fullscreenchange w ith its bubbles attribute 307 // stack, and queue a task to fire an event named fullscreenchange w ith its bubbles attribute
307 // set to true on the document. 308 // set to true on the document.
308 if (!followingDoc) { 309 if (!followingDoc) {
309 from(*currentDoc).pushFullscreenElementStack(element, requestTyp e); 310 from(*currentDoc).pushFullscreenElementStack(element, requestTyp e);
310 enqueueChangeEvent(*currentDoc, requestType); 311 from(document).enqueueChangeEvent(*currentDoc, requestType);
311 continue; 312 continue;
312 } 313 }
313 314
314 // 3. Otherwise, if document's fullscreen element stack is either em pty or its top element 315 // 3. Otherwise, if document's fullscreen element stack is either em pty or its top element
315 // is not following document's browsing context container, 316 // is not following document's browsing context container,
316 Element* topElement = fullscreenElementFrom(*currentDoc); 317 Element* topElement = fullscreenElementFrom(*currentDoc);
317 HTMLFrameOwnerElement* followingOwner = findContainerForDescendant(* currentDoc, *followingDoc); 318 HTMLFrameOwnerElement* followingOwner = findContainerForDescendant(* currentDoc, *followingDoc);
318 if (!topElement || topElement != followingOwner) { 319 if (!topElement || topElement != followingOwner) {
319 // ...push following document's browsing context container on do cument's fullscreen element 320 // ...push following document's browsing context container on do cument's fullscreen element
320 // stack, and queue a task to fire an event named fullscreenchan ge with its bubbles attribute 321 // stack, and queue a task to fire an event named fullscreenchan ge with its bubbles attribute
321 // set to true on document. 322 // set to true on document.
322 from(*currentDoc).pushFullscreenElementStack(*followingOwner, re questType); 323 from(*currentDoc).pushFullscreenElementStack(*followingOwner, re questType);
323 enqueueChangeEvent(*currentDoc, requestType); 324 from(document).enqueueChangeEvent(*currentDoc, requestType);
324 continue; 325 continue;
325 } 326 }
326 327
327 // 4. Otherwise, do nothing for this document. It stays the same. 328 // 4. Otherwise, do nothing for this document. It stays the same.
328 } while (++current != docs.end()); 329 } while (++current != docs.end());
329 330
330 m_forCrossProcessDescendant = forCrossProcessDescendant; 331 from(document).m_forCrossProcessDescendant = forCrossProcessDescendant;
331 332
332 // 5. Return, and run the remaining steps asynchronously. 333 // 5. Return, and run the remaining steps asynchronously.
333 // 6. Optionally, perform some animation. 334 // 6. Optionally, perform some animation.
334 document()->frameHost()->chromeClient().enterFullscreenForElement(&eleme nt); 335 document.frameHost()->chromeClient().enterFullscreenForElement(&element) ;
335 336
336 // 7. Optionally, display a message indicating how the user can exit dis playing the context object fullscreen. 337 // 7. Optionally, display a message indicating how the user can exit dis playing the context object fullscreen.
337 return; 338 return;
338 } while (false); 339 } while (false);
339 340
340 enqueueErrorEvent(element, requestType); 341 from(document).enqueueErrorEvent(element, requestType);
341 } 342 }
342 343
343 void Fullscreen::fullyExitFullscreen(Document& document) 344 void Fullscreen::fullyExitFullscreen(Document& document)
344 { 345 {
345 // To fully exit fullscreen, run these steps: 346 // To fully exit fullscreen, run these steps:
346 347
347 // 1. Let |doc| be the top-level browsing context's document. 348 // 1. Let |doc| be the top-level browsing context's document.
348 // 349 //
349 // Since the top-level browsing context's document might be unavailable in 350 // Since the top-level browsing context's document might be unavailable in
350 // OOPIF scenarios (i.e., when the top frame is remote), this actually uses 351 // OOPIF scenarios (i.e., when the top frame is remote), this actually uses
351 // the Document of the topmost local ancestor frame. Without OOPIF, this 352 // the Document of the topmost local ancestor frame. Without OOPIF, this
352 // will be the top frame's document. With OOPIF, each renderer process for 353 // will be the top frame's document. With OOPIF, each renderer process for
353 // the current page will separately call fullyExitFullscreen to cover all 354 // the current page will separately call fullyExitFullscreen to cover all
354 // local frames in each process. 355 // local frames in each process.
355 Document& doc = topmostLocalAncestor(document); 356 Document& doc = topmostLocalAncestor(document);
356 357
357 // 2. If |doc|'s fullscreen element stack is empty, terminate these steps. 358 // 2. If |doc|'s fullscreen element stack is empty, terminate these steps.
358 if (!fullscreenElementFrom(doc)) 359 if (!fullscreenElementFrom(doc))
359 return; 360 return;
360 361
361 // 3. Remove elements from |doc|'s fullscreen element stack until only the t op element is left. 362 // 3. Remove elements from |doc|'s fullscreen element stack until only the t op element is left.
362 size_t stackSize = from(doc).m_fullscreenElementStack.size(); 363 size_t stackSize = from(doc).m_fullscreenElementStack.size();
363 from(doc).m_fullscreenElementStack.remove(0, stackSize - 1); 364 from(doc).m_fullscreenElementStack.remove(0, stackSize - 1);
364 DCHECK_EQ(from(doc).m_fullscreenElementStack.size(), 1u); 365 DCHECK_EQ(from(doc).m_fullscreenElementStack.size(), 1u);
365 366
366 // 4. Act as if the exitFullscreen() method was invoked on |doc|. 367 // 4. Act as if the exitFullscreen() method was invoked on |doc|.
367 from(doc).exitFullscreen(); 368 exitFullscreen(doc);
368 } 369 }
369 370
370 void Fullscreen::exitFullscreen() 371 void Fullscreen::exitFullscreen(Document& document)
371 { 372 {
372 // The exitFullscreen() method must run these steps: 373 // The exitFullscreen() method must run these steps:
373 374
374 // 1. Let doc be the context object. (i.e. "this") 375 // 1. Let doc be the context object. (i.e. "this")
375 Document* currentDoc = document(); 376 if (!document.isActive())
376 if (!currentDoc->isActive())
377 return; 377 return;
378 378
379 // 2. If doc's fullscreen element stack is empty, terminate these steps. 379 // 2. If doc's fullscreen element stack is empty, terminate these steps.
380 if (m_fullscreenElementStack.isEmpty()) 380 if (!fullscreenElementFrom(document))
381 return; 381 return;
382 382
383 // 3. Let descendants be all the doc's descendant browsing context's documen ts with a non-empty fullscreen 383 // 3. Let descendants be all the doc's descendant browsing context's documen ts with a non-empty fullscreen
384 // element stack (if any), ordered so that the child of the doc is last and the document furthest 384 // element stack (if any), ordered so that the child of the doc is last and the document furthest
385 // away from the doc is first. 385 // away from the doc is first.
386 HeapDeque<Member<Document>> descendants; 386 HeapDeque<Member<Document>> descendants;
387 for (Frame* descendant = document()->frame() ? document()->frame()->tree().t raverseNext() : 0; descendant; descendant = descendant->tree().traverseNext()) { 387 for (Frame* descendant = document.frame() ? document.frame()->tree().travers eNext() : nullptr; descendant; descendant = descendant->tree().traverseNext()) {
388 if (!descendant->isLocalFrame()) 388 if (!descendant->isLocalFrame())
389 continue; 389 continue;
390 DCHECK(toLocalFrame(descendant)->document()); 390 DCHECK(toLocalFrame(descendant)->document());
391 if (fullscreenElementFrom(*toLocalFrame(descendant)->document())) 391 if (fullscreenElementFrom(*toLocalFrame(descendant)->document()))
392 descendants.prepend(toLocalFrame(descendant)->document()); 392 descendants.prepend(toLocalFrame(descendant)->document());
393 } 393 }
394 394
395 // 4. For each descendant in descendants, empty descendant's fullscreen elem ent stack, and queue a 395 // 4. For each descendant in descendants, empty descendant's fullscreen elem ent stack, and queue a
396 // task to fire an event named fullscreenchange with its bubbles attribute s et to true on descendant. 396 // task to fire an event named fullscreenchange with its bubbles attribute s et to true on descendant.
397 for (auto& descendant : descendants) { 397 for (auto& descendant : descendants) {
398 DCHECK(descendant); 398 DCHECK(descendant);
399 RequestType requestType = from(*descendant).m_fullscreenElementStack.las t().second; 399 RequestType requestType = from(*descendant).m_fullscreenElementStack.las t().second;
400 from(*descendant).clearFullscreenElementStack(); 400 from(*descendant).clearFullscreenElementStack();
401 enqueueChangeEvent(*descendant, requestType); 401 from(document).enqueueChangeEvent(*descendant, requestType);
402 } 402 }
403 403
404 // 5. While doc is not null, run these substeps: 404 // 5. While doc is not null, run these substeps:
405 Element* newTop = 0; 405 Element* newTop = nullptr;
406 while (currentDoc) { 406 for (Document* currentDoc = &document; currentDoc;) {
407 RequestType requestType = from(*currentDoc).m_fullscreenElementStack.las t().second; 407 RequestType requestType = from(*currentDoc).m_fullscreenElementStack.las t().second;
408 408
409 // 1. Pop the top element of doc's fullscreen element stack. 409 // 1. Pop the top element of doc's fullscreen element stack.
410 from(*currentDoc).popFullscreenElementStack(); 410 from(*currentDoc).popFullscreenElementStack();
411 411
412 // If doc's fullscreen element stack is non-empty and the element now at the top is either 412 // If doc's fullscreen element stack is non-empty and the element now at the top is either
413 // not in a document or its node document is not doc, repeat this sub step. 413 // not in a document or its node document is not doc, repeat this sub step.
414 newTop = fullscreenElementFrom(*currentDoc); 414 newTop = fullscreenElementFrom(*currentDoc);
415 if (newTop && (!newTop->isConnected() || newTop->document() != currentDo c)) 415 if (newTop && (!newTop->isConnected() || newTop->document() != currentDo c))
416 continue; 416 continue;
417 417
418 // 2. Queue a task to fire an event named fullscreenchange with its bubb les attribute set to true 418 // 2. Queue a task to fire an event named fullscreenchange with its bubb les attribute set to true
419 // on doc. 419 // on doc.
420 enqueueChangeEvent(*currentDoc, requestType); 420 from(document).enqueueChangeEvent(*currentDoc, requestType);
421 421
422 // 3. If doc's fullscreen element stack is empty and doc's browsing cont ext has a browsing context 422 // 3. If doc's fullscreen element stack is empty and doc's browsing cont ext has a browsing context
423 // container, set doc to that browsing context container's node document . 423 // container, set doc to that browsing context container's node document .
424 // 424 //
425 // OOPIF: If browsing context container's document is in another 425 // OOPIF: If browsing context container's document is in another
426 // process, keep moving up the ancestor chain and looking for a 426 // process, keep moving up the ancestor chain and looking for a
427 // browsing context container with a local document. 427 // browsing context container with a local document.
428 // TODO(alexmos): Deal with nested fullscreen cases, see 428 // TODO(alexmos): Deal with nested fullscreen cases, see
429 // https://crbug.com/617369. 429 // https://crbug.com/617369.
430 if (!newTop) { 430 if (!newTop) {
431 Frame* frame = currentDoc->frame()->tree().parent(); 431 Frame* frame = currentDoc->frame()->tree().parent();
432 while (frame && frame->isRemoteFrame()) 432 while (frame && frame->isRemoteFrame())
433 frame = frame->tree().parent(); 433 frame = frame->tree().parent();
434 if (frame) { 434 if (frame) {
435 currentDoc = toLocalFrame(frame)->document(); 435 currentDoc = toLocalFrame(frame)->document();
436 continue; 436 continue;
437 } 437 }
438 } 438 }
439 439
440 // 4. Otherwise, set doc to null. 440 // 4. Otherwise, set doc to null.
441 currentDoc = 0; 441 currentDoc = nullptr;
442 } 442 }
443 443
444 // 6. Return, and run the remaining steps asynchronously. 444 // 6. Return, and run the remaining steps asynchronously.
445 // 7. Optionally, perform some animation. 445 // 7. Optionally, perform some animation.
446 446
447 FrameHost* host = document()->frameHost(); 447 FrameHost* host = document.frameHost();
448 448
449 // Speculative fix for engaget.com/videos per crbug.com/336239. 449 // Speculative fix for engaget.com/videos per crbug.com/336239.
450 // FIXME: This check is wrong. We DCHECK(document->isActive()) above 450 // FIXME: This check is wrong. We DCHECK(document->isActive()) above
451 // so this should be redundant and should be removed! 451 // so this should be redundant and should be removed!
452 if (!host) 452 if (!host)
453 return; 453 return;
454 454
455 // Only exit out of full screen window mode if there are no remaining elemen ts in the 455 // Only exit out of full screen window mode if there are no remaining elemen ts in the
456 // full screen stack. 456 // full screen stack.
457 if (!newTop) { 457 if (!newTop) {
458 // FIXME: if the frame exiting fullscreen is not the frame that entered 458 // FIXME: if the frame exiting fullscreen is not the frame that entered
459 // fullscreen (but a parent frame for example), 459 // fullscreen (but a parent frame for example),
460 // m_currentFullScreenElement might be null. We want to pass an element 460 // m_currentFullScreenElement might be null. We want to pass an element
461 // that is part of the document so we will pass the documentElement in 461 // that is part of the document so we will pass the documentElement in
462 // that case. This should be fix by exiting fullscreen for a frame 462 // that case. This should be fix by exiting fullscreen for a frame
463 // instead of an element, see https://crbug.com/441259 463 // instead of an element, see https://crbug.com/441259
464 Element* currentFullScreenElement = currentFullScreenElementFrom(documen t);
464 host->chromeClient().exitFullscreenForElement( 465 host->chromeClient().exitFullscreenForElement(
465 m_currentFullScreenElement ? m_currentFullScreenElement.get() : docu ment()->documentElement()); 466 currentFullScreenElement ? currentFullScreenElement : document.docum entElement());
466 return; 467 return;
467 } 468 }
468 469
469 // Otherwise, notify the chrome of the new full screen element. 470 // Otherwise, notify the chrome of the new full screen element.
470 host->chromeClient().enterFullscreenForElement(newTop); 471 host->chromeClient().enterFullscreenForElement(newTop);
471 } 472 }
472 473
473 bool Fullscreen::fullscreenEnabled(Document& document) 474 bool Fullscreen::fullscreenEnabled(Document& document)
474 { 475 {
475 // 4. The fullscreenEnabled attribute must return true if the context object has its 476 // 4. The fullscreenEnabled attribute must return true if the context object has its
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } 646 }
646 647
647 void Fullscreen::elementRemoved(Element& oldNode) 648 void Fullscreen::elementRemoved(Element& oldNode)
648 { 649 {
649 // Whenever the removing steps run with an |oldNode| and |oldNode| is in its node document's 650 // Whenever the removing steps run with an |oldNode| and |oldNode| is in its node document's
650 // fullscreen element stack, run these steps: 651 // fullscreen element stack, run these steps:
651 652
652 // 1. If |oldNode| is at the top of its node document's fullscreen element s tack, act as if the 653 // 1. If |oldNode| is at the top of its node document's fullscreen element s tack, act as if the
653 // exitFullscreen() method was invoked on that document. 654 // exitFullscreen() method was invoked on that document.
654 if (fullscreenElement() == &oldNode) { 655 if (fullscreenElement() == &oldNode) {
655 exitFullscreen(); 656 exitFullscreen(oldNode.document());
656 return; 657 return;
657 } 658 }
658 659
659 // 2. Otherwise, remove |oldNode| from its node document's fullscreen elemen t stack. 660 // 2. Otherwise, remove |oldNode| from its node document's fullscreen elemen t stack.
660 for (size_t i = 0; i < m_fullscreenElementStack.size(); ++i) { 661 for (size_t i = 0; i < m_fullscreenElementStack.size(); ++i) {
661 if (m_fullscreenElementStack[i].first.get() == &oldNode) { 662 if (m_fullscreenElementStack[i].first.get() == &oldNode) {
662 m_fullscreenElementStack.remove(i); 663 m_fullscreenElementStack.remove(i);
663 return; 664 return;
664 } 665 }
665 } 666 }
(...skipping 22 matching lines...) Expand all
688 DEFINE_TRACE(Fullscreen) 689 DEFINE_TRACE(Fullscreen)
689 { 690 {
690 visitor->trace(m_currentFullScreenElement); 691 visitor->trace(m_currentFullScreenElement);
691 visitor->trace(m_fullscreenElementStack); 692 visitor->trace(m_fullscreenElementStack);
692 visitor->trace(m_eventQueue); 693 visitor->trace(m_eventQueue);
693 Supplement<Document>::trace(visitor); 694 Supplement<Document>::trace(visitor);
694 ContextLifecycleObserver::trace(visitor); 695 ContextLifecycleObserver::trace(visitor);
695 } 696 }
696 697
697 } // namespace blink 698 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Fullscreen.h ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698