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

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

Issue 1914643005: Add support for entering/exiting HTML fullscreen from OOPIFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: parentCrossingFrameBoundaries -> nextLocalAncestorElement and updated WasResized comment Created 4 years, 7 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 403
404 bool Fullscreen::fullscreenEnabled(Document& document) 404 bool Fullscreen::fullscreenEnabled(Document& document)
405 { 405 {
406 // 4. The fullscreenEnabled attribute must return true if the context object has its 406 // 4. The fullscreenEnabled attribute must return true if the context object has its
407 // fullscreen enabled flag set and fullscreen is supported, and false oth erwise. 407 // fullscreen enabled flag set and fullscreen is supported, and false oth erwise.
408 408
409 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set. 409 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set.
410 return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(do cument); 410 return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(do cument);
411 } 411 }
412 412
413 void Fullscreen::didEnterFullScreenForElement(Element* element) 413 void Fullscreen::didEnterFullScreenForElement(Element* element, bool isAncestorO fFullscreenElement)
414 { 414 {
415 DCHECK(element); 415 DCHECK(element);
416 if (!document()->isActive()) 416 if (!document()->isActive())
417 return; 417 return;
418 418
419 if (m_fullScreenLayoutObject) 419 if (m_fullScreenLayoutObject)
420 m_fullScreenLayoutObject->unwrapLayoutObject(); 420 m_fullScreenLayoutObject->unwrapLayoutObject();
421 421
422 m_fullScreenElement = element; 422 m_fullScreenElement = element;
423 423
424 // Create a placeholder block for a the full-screen element, to keep the pag e from reflowing 424 // Create a placeholder block for a the full-screen element, to keep the pag e from reflowing
425 // when the element is removed from the normal flow. Only do this for a Layo utBox, as only 425 // when the element is removed from the normal flow. Only do this for a Layo utBox, as only
426 // a box will have a frameRect. The placeholder will be created in setFullSc reenLayoutObject() 426 // a box will have a frameRect. The placeholder will be created in setFullSc reenLayoutObject()
427 // during layout. 427 // during layout.
428 LayoutObject* layoutObject = m_fullScreenElement->layoutObject(); 428 LayoutObject* layoutObject = m_fullScreenElement->layoutObject();
429 bool shouldCreatePlaceholder = layoutObject && layoutObject->isBox(); 429 bool shouldCreatePlaceholder = layoutObject && layoutObject->isBox();
430 if (shouldCreatePlaceholder) { 430 if (shouldCreatePlaceholder) {
431 m_savedPlaceholderFrameRect = toLayoutBox(layoutObject)->frameRect(); 431 m_savedPlaceholderFrameRect = toLayoutBox(layoutObject)->frameRect();
432 m_savedPlaceholderComputedStyle = ComputedStyle::clone(layoutObject->sty leRef()); 432 m_savedPlaceholderComputedStyle = ComputedStyle::clone(layoutObject->sty leRef());
433 } 433 }
434 434
435 // TODO(alexmos): When |isAncestorOfFullscreenElement| is true, some of
436 // this layout work has already been done in another process, so it should
437 // not be necessary to repeat it here.
435 if (m_fullScreenElement != document()->documentElement()) 438 if (m_fullScreenElement != document()->documentElement())
436 LayoutFullScreen::wrapLayoutObject(layoutObject, layoutObject ? layoutOb ject->parent() : 0, document()); 439 LayoutFullScreen::wrapLayoutObject(layoutObject, layoutObject ? layoutOb ject->parent() : 0, document());
437 440
441 if (isAncestorOfFullscreenElement) {
442 DCHECK(m_fullScreenElement->isFrameOwnerElement());
443 DCHECK(toHTMLFrameOwnerElement(m_fullScreenElement)->contentFrame()->isR emoteFrame());
444 m_fullScreenElement->setContainsFullScreenElement(true);
445 }
446
438 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(true); 447 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(true);
448
439 document()->styleEngine().ensureFullscreenUAStyle(); 449 document()->styleEngine().ensureFullscreenUAStyle();
440 m_fullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); 450 m_fullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen);
441 451
442 // FIXME: This should not call updateLayoutTree. 452 // FIXME: This should not call updateLayoutTree.
443 document()->updateLayoutTree(); 453 document()->updateLayoutTree();
444 454
445 m_fullScreenElement->didBecomeFullscreenElement(); 455 m_fullScreenElement->didBecomeFullscreenElement();
446 456
447 if (document()->frame()) 457 if (document()->frame())
448 document()->frame()->eventHandler().scheduleHoverStateUpdate(); 458 document()->frame()->eventHandler().scheduleHoverStateUpdate();
449 459
450 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); 460 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE);
451 } 461 }
452 462
453 void Fullscreen::didExitFullScreenForElement(Element*) 463 void Fullscreen::didExitFullScreenForElement(bool isAncestorOfFullscreenElement)
454 { 464 {
455 if (!m_fullScreenElement) 465 if (!m_fullScreenElement)
456 return; 466 return;
457 467
458 if (!document()->isActive()) 468 if (!document()->isActive())
459 return; 469 return;
460 470
461 m_fullScreenElement->willStopBeingFullscreenElement(); 471 m_fullScreenElement->willStopBeingFullscreenElement();
462 472
473 if (isAncestorOfFullscreenElement)
474 m_fullScreenElement->setContainsFullScreenElement(false);
475
463 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); 476 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false);
464 477
465 if (m_fullScreenLayoutObject) 478 if (m_fullScreenLayoutObject)
466 LayoutFullScreenItem(m_fullScreenLayoutObject).unwrapLayoutObject(); 479 LayoutFullScreenItem(m_fullScreenLayoutObject).unwrapLayoutObject();
467 480
468 document()->styleEngine().ensureFullscreenUAStyle(); 481 document()->styleEngine().ensureFullscreenUAStyle();
469 m_fullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); 482 m_fullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen);
470 m_fullScreenElement = nullptr; 483 m_fullScreenElement = nullptr;
471 484
472 if (document()->frame()) 485 if (document()->frame())
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 DEFINE_TRACE(Fullscreen) 612 DEFINE_TRACE(Fullscreen)
600 { 613 {
601 visitor->trace(m_fullScreenElement); 614 visitor->trace(m_fullScreenElement);
602 visitor->trace(m_fullScreenElementStack); 615 visitor->trace(m_fullScreenElementStack);
603 visitor->trace(m_eventQueue); 616 visitor->trace(m_eventQueue);
604 Supplement<Document>::trace(visitor); 617 Supplement<Document>::trace(visitor);
605 ContextLifecycleObserver::trace(visitor); 618 ContextLifecycleObserver::trace(visitor);
606 } 619 }
607 620
608 } // namespace blink 621 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698