OLD | NEW |
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 Loading... |
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, bool isAncestorO
fFullscreenElement) | 413 void Fullscreen::didEnterFullScreenForElement(Element* element) |
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. | |
438 if (m_fullScreenElement != document()->documentElement()) | 435 if (m_fullScreenElement != document()->documentElement()) |
439 LayoutFullScreen::wrapLayoutObject(layoutObject, layoutObject ? layoutOb
ject->parent() : 0, document()); | 436 LayoutFullScreen::wrapLayoutObject(layoutObject, layoutObject ? layoutOb
ject->parent() : 0, document()); |
440 | 437 |
441 if (isAncestorOfFullscreenElement) { | |
442 DCHECK(m_fullScreenElement->isFrameOwnerElement()); | |
443 DCHECK(toHTMLFrameOwnerElement(m_fullScreenElement)->contentFrame()->isR
emoteFrame()); | |
444 m_fullScreenElement->setContainsFullScreenElement(true); | |
445 } | |
446 | |
447 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(true); | 438 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(true); |
448 | |
449 document()->styleEngine().ensureFullscreenUAStyle(); | 439 document()->styleEngine().ensureFullscreenUAStyle(); |
450 m_fullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); | 440 m_fullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); |
451 | 441 |
452 // FIXME: This should not call updateLayoutTree. | 442 // FIXME: This should not call updateLayoutTree. |
453 document()->updateLayoutTree(); | 443 document()->updateLayoutTree(); |
454 | 444 |
455 m_fullScreenElement->didBecomeFullscreenElement(); | 445 m_fullScreenElement->didBecomeFullscreenElement(); |
456 | 446 |
457 if (document()->frame()) | 447 if (document()->frame()) |
458 document()->frame()->eventHandler().scheduleHoverStateUpdate(); | 448 document()->frame()->eventHandler().scheduleHoverStateUpdate(); |
459 | 449 |
460 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); | 450 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); |
461 } | 451 } |
462 | 452 |
463 void Fullscreen::didExitFullScreenForElement(bool isAncestorOfFullscreenElement) | 453 void Fullscreen::didExitFullScreenForElement(Element*) |
464 { | 454 { |
465 if (!m_fullScreenElement) | 455 if (!m_fullScreenElement) |
466 return; | 456 return; |
467 | 457 |
468 if (!document()->isActive()) | 458 if (!document()->isActive()) |
469 return; | 459 return; |
470 | 460 |
471 m_fullScreenElement->willStopBeingFullscreenElement(); | 461 m_fullScreenElement->willStopBeingFullscreenElement(); |
472 | 462 |
473 if (isAncestorOfFullscreenElement) | |
474 m_fullScreenElement->setContainsFullScreenElement(false); | |
475 | |
476 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(false); | 463 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(false); |
477 | 464 |
478 if (m_fullScreenLayoutObject) | 465 if (m_fullScreenLayoutObject) |
479 LayoutFullScreenItem(m_fullScreenLayoutObject).unwrapLayoutObject(); | 466 LayoutFullScreenItem(m_fullScreenLayoutObject).unwrapLayoutObject(); |
480 | 467 |
481 document()->styleEngine().ensureFullscreenUAStyle(); | 468 document()->styleEngine().ensureFullscreenUAStyle(); |
482 m_fullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); | 469 m_fullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); |
483 m_fullScreenElement = nullptr; | 470 m_fullScreenElement = nullptr; |
484 | 471 |
485 if (document()->frame()) | 472 if (document()->frame()) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 DEFINE_TRACE(Fullscreen) | 599 DEFINE_TRACE(Fullscreen) |
613 { | 600 { |
614 visitor->trace(m_fullScreenElement); | 601 visitor->trace(m_fullScreenElement); |
615 visitor->trace(m_fullScreenElementStack); | 602 visitor->trace(m_fullScreenElementStack); |
616 visitor->trace(m_eventQueue); | 603 visitor->trace(m_eventQueue); |
617 Supplement<Document>::trace(visitor); | 604 Supplement<Document>::trace(visitor); |
618 ContextLifecycleObserver::trace(visitor); | 605 ContextLifecycleObserver::trace(visitor); |
619 } | 606 } |
620 | 607 |
621 } // namespace blink | 608 } // namespace blink |
OLD | NEW |