| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (!m_canBeDragged) | 83 if (!m_canBeDragged) |
| 84 return; | 84 return; |
| 85 | 85 |
| 86 if (m_isBeingDragged) | 86 if (m_isBeingDragged) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 RenderObject* renderer = this->renderer(); | 89 RenderObject* renderer = this->renderer(); |
| 90 if (!renderer || !renderer->isBox()) | 90 if (!renderer || !renderer->isBox()) |
| 91 return; | 91 return; |
| 92 | 92 |
| 93 Frame* frame = document()->frame(); | 93 Frame* frame = document().frame(); |
| 94 if (!frame) | 94 if (!frame) |
| 95 return; | 95 return; |
| 96 | 96 |
| 97 m_lastDragEventLocation = eventLocation; | 97 m_lastDragEventLocation = eventLocation; |
| 98 | 98 |
| 99 frame->eventHandler()->setCapturingMouseEventsNode(this); | 99 frame->eventHandler()->setCapturingMouseEventsNode(this); |
| 100 | 100 |
| 101 m_isBeingDragged = true; | 101 m_isBeingDragged = true; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void MediaControlPanelElement::continueDrag(const LayoutPoint& eventLocation) | 104 void MediaControlPanelElement::continueDrag(const LayoutPoint& eventLocation) |
| 105 { | 105 { |
| 106 if (!m_isBeingDragged) | 106 if (!m_isBeingDragged) |
| 107 return; | 107 return; |
| 108 | 108 |
| 109 LayoutSize distanceDragged = eventLocation - m_lastDragEventLocation; | 109 LayoutSize distanceDragged = eventLocation - m_lastDragEventLocation; |
| 110 m_cumulativeDragOffset.move(distanceDragged); | 110 m_cumulativeDragOffset.move(distanceDragged); |
| 111 m_lastDragEventLocation = eventLocation; | 111 m_lastDragEventLocation = eventLocation; |
| 112 setPosition(m_cumulativeDragOffset); | 112 setPosition(m_cumulativeDragOffset); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void MediaControlPanelElement::endDrag() | 115 void MediaControlPanelElement::endDrag() |
| 116 { | 116 { |
| 117 if (!m_isBeingDragged) | 117 if (!m_isBeingDragged) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 m_isBeingDragged = false; | 120 m_isBeingDragged = false; |
| 121 | 121 |
| 122 Frame* frame = document()->frame(); | 122 Frame* frame = document().frame(); |
| 123 if (!frame) | 123 if (!frame) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 frame->eventHandler()->setCapturingMouseEventsNode(0); | 126 frame->eventHandler()->setCapturingMouseEventsNode(0); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void MediaControlPanelElement::startTimer() | 129 void MediaControlPanelElement::startTimer() |
| 130 { | 130 { |
| 131 stopTimer(); | 131 stopTimer(); |
| 132 | 132 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 } | 573 } |
| 574 | 574 |
| 575 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) | 575 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) |
| 576 { | 576 { |
| 577 if (event->type() == eventNames().clickEvent) { | 577 if (event->type() == eventNames().clickEvent) { |
| 578 // Only use the new full screen API if the fullScreenEnabled setting has | 578 // Only use the new full screen API if the fullScreenEnabled setting has |
| 579 // been explicitly enabled. Otherwise, use the old fullscreen API. This | 579 // been explicitly enabled. Otherwise, use the old fullscreen API. This |
| 580 // allows apps which embed a WebView to retain the existing full screen | 580 // allows apps which embed a WebView to retain the existing full screen |
| 581 // video implementation without requiring them to implement their own fu
ll | 581 // video implementation without requiring them to implement their own fu
ll |
| 582 // screen behavior. | 582 // screen behavior. |
| 583 if (document()->settings() && document()->settings()->fullScreenEnabled(
)) { | 583 if (document().settings() && document().settings()->fullScreenEnabled())
{ |
| 584 if (FullscreenElementStack::isActiveFullScreenElement(toParentMediaE
lement(this))) | 584 if (FullscreenElementStack::isActiveFullScreenElement(toParentMediaE
lement(this))) |
| 585 FullscreenElementStack::from(document())->webkitCancelFullScreen
(); | 585 FullscreenElementStack::from(&document())->webkitCancelFullScree
n(); |
| 586 else | 586 else |
| 587 FullscreenElementStack::from(document())->requestFullScreenForEl
ement(toParentMediaElement(this), 0, FullscreenElementStack::ExemptIFrameAllowFu
llScreenRequirement); | 587 FullscreenElementStack::from(&document())->requestFullScreenForE
lement(toParentMediaElement(this), 0, FullscreenElementStack::ExemptIFrameAllowF
ullScreenRequirement); |
| 588 } else | 588 } else |
| 589 mediaController()->enterFullscreen(); | 589 mediaController()->enterFullscreen(); |
| 590 event->setDefaultHandled(); | 590 event->setDefaultHandled(); |
| 591 } | 591 } |
| 592 HTMLInputElement::defaultEventHandler(event); | 592 HTMLInputElement::defaultEventHandler(event); |
| 593 } | 593 } |
| 594 | 594 |
| 595 const AtomicString& MediaControlFullscreenButtonElement::part() const | 595 const AtomicString& MediaControlFullscreenButtonElement::part() const |
| 596 { | 596 { |
| 597 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-fullscreen-bu
tton", AtomicString::ConstructFromLiteral)); | 597 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-fullscreen-bu
tton", AtomicString::ConstructFromLiteral)); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 else | 774 else |
| 775 hide(); | 775 hide(); |
| 776 } | 776 } |
| 777 | 777 |
| 778 void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate) | 778 void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate) |
| 779 { | 779 { |
| 780 HTMLMediaElement* mediaElement = toParentMediaElement(this); | 780 HTMLMediaElement* mediaElement = toParentMediaElement(this); |
| 781 if (!mediaElement) | 781 if (!mediaElement) |
| 782 return; | 782 return; |
| 783 | 783 |
| 784 if (!document()->page()) | 784 if (!document().page()) |
| 785 return; | 785 return; |
| 786 | 786 |
| 787 IntRect videoBox; | 787 IntRect videoBox; |
| 788 | 788 |
| 789 if (!mediaElement->renderer() || !mediaElement->renderer()->isVideo()) | 789 if (!mediaElement->renderer() || !mediaElement->renderer()->isVideo()) |
| 790 return; | 790 return; |
| 791 videoBox = toRenderVideo(mediaElement->renderer())->videoBox(); | 791 videoBox = toRenderVideo(mediaElement->renderer())->videoBox(); |
| 792 | 792 |
| 793 if (!forceUpdate && m_videoDisplaySize == videoBox) | 793 if (!forceUpdate && m_videoDisplaySize == videoBox) |
| 794 return; | 794 return; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 805 CueList activeCues = mediaElement->currentlyActiveCues(); | 805 CueList activeCues = mediaElement->currentlyActiveCues(); |
| 806 for (size_t i = 0; i < activeCues.size(); ++i) { | 806 for (size_t i = 0; i < activeCues.size(); ++i) { |
| 807 TextTrackCue* cue = activeCues[i].data(); | 807 TextTrackCue* cue = activeCues[i].data(); |
| 808 cue->videoSizeDidChange(m_videoDisplaySize.size()); | 808 cue->videoSizeDidChange(m_videoDisplaySize.size()); |
| 809 } | 809 } |
| 810 } | 810 } |
| 811 | 811 |
| 812 // ---------------------------- | 812 // ---------------------------- |
| 813 | 813 |
| 814 } // namespace WebCore | 814 } // namespace WebCore |
| OLD | NEW |