Chromium Code Reviews| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 | 402 |
| 403 bool Fullscreen::fullscreenEnabled(Document& document) | 403 bool Fullscreen::fullscreenEnabled(Document& document) |
| 404 { | 404 { |
| 405 // 4. The fullscreenEnabled attribute must return true if the context object has its | 405 // 4. The fullscreenEnabled attribute must return true if the context object has its |
| 406 // fullscreen enabled flag set and fullscreen is supported, and false oth erwise. | 406 // fullscreen enabled flag set and fullscreen is supported, and false oth erwise. |
| 407 | 407 |
| 408 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set. | 408 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set. |
| 409 return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(do cument); | 409 return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(do cument); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void Fullscreen::willEnterFullScreenForElement(Element* element) | 412 void Fullscreen::didEnterFullScreenForElement(Element* element) |
| 413 { | 413 { |
| 414 ASSERT(element); | 414 ASSERT(element); |
| 415 if (!document()->isActive()) | 415 if (!document()->isActive()) |
| 416 return; | 416 return; |
| 417 | 417 |
| 418 if (m_fullScreenRenderer) | 418 if (m_fullScreenRenderer) |
| 419 m_fullScreenRenderer->unwrapRenderer(); | 419 m_fullScreenRenderer->unwrapRenderer(); |
| 420 | 420 |
| 421 m_fullScreenElement = element; | 421 m_fullScreenElement = element; |
| 422 | 422 |
| 423 // Create a placeholder block for a the full-screen element, to keep the pag e from reflowing | 423 // Create a placeholder block for a the full-screen element, to keep the pag e from reflowing |
| 424 // when the element is removed from the normal flow. Only do this for a Rend erBox, as only | 424 // when the element is removed from the normal flow. Only do this for a Rend erBox, as only |
| 425 // a box will have a frameRect. The placeholder will be created in setFullSc reenRenderer() | 425 // a box will have a frameRect. The placeholder will be created in setFullSc reenRenderer() |
| 426 // during layout. | 426 // during layout. |
| 427 RenderObject* renderer = m_fullScreenElement->renderer(); | 427 RenderObject* renderer = m_fullScreenElement->renderer(); |
| 428 bool shouldCreatePlaceholder = renderer && renderer->isBox(); | 428 bool shouldCreatePlaceholder = renderer && renderer->isBox(); |
| 429 if (shouldCreatePlaceholder) { | 429 if (shouldCreatePlaceholder) { |
| 430 m_savedPlaceholderFrameRect = toRenderBox(renderer)->frameRect(); | 430 m_savedPlaceholderFrameRect = toRenderBox(renderer)->frameRect(); |
| 431 m_savedPlaceholderRenderStyle = RenderStyle::clone(renderer->style()); | 431 m_savedPlaceholderRenderStyle = RenderStyle::clone(renderer->style()); |
| 432 } | 432 } |
| 433 | 433 |
| 434 if (m_fullScreenElement != document()->documentElement()) | 434 if (m_fullScreenElement != document()->documentElement()) |
| 435 RenderFullScreen::wrapRenderer(renderer, renderer ? renderer->parent() : 0, document()); | 435 RenderFullScreen::wrapRenderer(renderer, renderer ? renderer->parent() : 0, document()); |
| 436 | 436 |
| 437 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(true); | 437 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(true); |
| 438 | 438 |
| 439 // FIXME: This should not call updateStyleIfNeeded. | 439 // FIXME: This should not call updateStyleIfNeeded. |
| 440 document()->setNeedsStyleRecalc(SubtreeStyleChange); | 440 document()->setNeedsStyleRecalc(SubtreeStyleChange); |
| 441 document()->updateRenderTreeIfNeeded(); | 441 document()->updateRenderTreeIfNeeded(); |
| 442 } | |
| 443 | |
| 444 void Fullscreen::didEnterFullScreenForElement(Element*) | |
| 445 { | |
| 446 if (!m_fullScreenElement) | |
| 447 return; | |
| 448 | |
| 449 if (!document()->isActive()) | |
| 450 return; | |
| 451 | 442 |
| 452 m_fullScreenElement->didBecomeFullscreenElement(); | 443 m_fullScreenElement->didBecomeFullscreenElement(); |
| 453 | 444 |
| 454 m_eventQueueTimer.startOneShot(0, FROM_HERE); | 445 m_eventQueueTimer.startOneShot(0, FROM_HERE); |
| 455 } | 446 } |
| 456 | 447 |
| 457 void Fullscreen::willExitFullScreenForElement(Element*) | 448 void Fullscreen::didExitFullScreenForElement(Element*) |
|
falken
2014/08/25 05:07:54
Should we remove the unused parameter?
philipj_slow
2014/08/25 08:06:30
Definitely, but I thought it might be cleaner to d
| |
| 458 { | 449 { |
| 459 if (!m_fullScreenElement) | 450 if (!m_fullScreenElement) |
| 460 return; | 451 return; |
| 461 | 452 |
| 462 if (!document()->isActive()) | 453 if (!document()->isActive()) |
| 463 return; | 454 return; |
| 464 | 455 |
| 465 m_fullScreenElement->willStopBeingFullscreenElement(); | 456 m_fullScreenElement->willStopBeingFullscreenElement(); |
| 466 } | |
| 467 | |
| 468 void Fullscreen::didExitFullScreenForElement(Element*) | |
| 469 { | |
| 470 if (!m_fullScreenElement) | |
| 471 return; | |
| 472 | |
| 473 if (!document()->isActive()) | |
| 474 return; | |
| 475 | 457 |
| 476 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); | 458 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); |
| 477 | 459 |
| 478 m_areKeysEnabledInFullScreen = false; | 460 m_areKeysEnabledInFullScreen = false; |
| 479 | 461 |
| 480 if (m_fullScreenRenderer) | 462 if (m_fullScreenRenderer) |
| 481 m_fullScreenRenderer->unwrapRenderer(); | 463 m_fullScreenRenderer->unwrapRenderer(); |
| 482 | 464 |
| 483 m_fullScreenElement = nullptr; | 465 m_fullScreenElement = nullptr; |
| 484 document()->setNeedsStyleRecalc(SubtreeStyleChange); | 466 document()->setNeedsStyleRecalc(SubtreeStyleChange); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 614 void Fullscreen::trace(Visitor* visitor) | 596 void Fullscreen::trace(Visitor* visitor) |
| 615 { | 597 { |
| 616 visitor->trace(m_fullScreenElement); | 598 visitor->trace(m_fullScreenElement); |
| 617 visitor->trace(m_fullScreenElementStack); | 599 visitor->trace(m_fullScreenElementStack); |
| 618 visitor->trace(m_fullScreenRenderer); | 600 visitor->trace(m_fullScreenRenderer); |
| 619 visitor->trace(m_eventQueue); | 601 visitor->trace(m_eventQueue); |
| 620 DocumentSupplement::trace(visitor); | 602 DocumentSupplement::trace(visitor); |
| 621 } | 603 } |
| 622 | 604 |
| 623 } // namespace blink | 605 } // namespace blink |
| OLD | NEW |