| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 timeline->setAttribute(stepAttr, "any"); | 568 timeline->setAttribute(stepAttr, "any"); |
| 569 timeline->setShadowPseudoId(AtomicString("-webkit-media-controls-timeline"))
; | 569 timeline->setShadowPseudoId(AtomicString("-webkit-media-controls-timeline"))
; |
| 570 return timeline; | 570 return timeline; |
| 571 } | 571 } |
| 572 | 572 |
| 573 void MediaControlTimelineElement::defaultEventHandler(Event* event) | 573 void MediaControlTimelineElement::defaultEventHandler(Event* event) |
| 574 { | 574 { |
| 575 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) | 575 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) |
| 576 return; | 576 return; |
| 577 | 577 |
| 578 if (!inShadowIncludingDocument() || !document().isActive()) | 578 if (!isConnected() || !document().isActive()) |
| 579 return; | 579 return; |
| 580 | 580 |
| 581 if (event->type() == EventTypeNames::mousedown) { | 581 if (event->type() == EventTypeNames::mousedown) { |
| 582 Platform::current()->recordAction(UserMetricsAction("Media.Controls.Scru
bbingBegin")); | 582 Platform::current()->recordAction(UserMetricsAction("Media.Controls.Scru
bbingBegin")); |
| 583 mediaControls().beginScrubbing(); | 583 mediaControls().beginScrubbing(); |
| 584 } | 584 } |
| 585 | 585 |
| 586 if (event->type() == EventTypeNames::mouseup) { | 586 if (event->type() == EventTypeNames::mouseup) { |
| 587 Platform::current()->recordAction(UserMetricsAction("Media.Controls.Scru
bbingEnd")); | 587 Platform::current()->recordAction(UserMetricsAction("Media.Controls.Scru
bbingEnd")); |
| 588 mediaControls().endScrubbing(); | 588 mediaControls().endScrubbing(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 601 mediaElement().setCurrentTime(time); | 601 mediaElement().setCurrentTime(time); |
| 602 } | 602 } |
| 603 | 603 |
| 604 LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject())); | 604 LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject())); |
| 605 if (!slider.isNull() && slider.inDragMode()) | 605 if (!slider.isNull() && slider.inDragMode()) |
| 606 mediaControls().updateCurrentTimeDisplay(); | 606 mediaControls().updateCurrentTimeDisplay(); |
| 607 } | 607 } |
| 608 | 608 |
| 609 bool MediaControlTimelineElement::willRespondToMouseClickEvents() | 609 bool MediaControlTimelineElement::willRespondToMouseClickEvents() |
| 610 { | 610 { |
| 611 return inShadowIncludingDocument() && document().isActive(); | 611 return isConnected() && document().isActive(); |
| 612 } | 612 } |
| 613 | 613 |
| 614 void MediaControlTimelineElement::setPosition(double currentTime) | 614 void MediaControlTimelineElement::setPosition(double currentTime) |
| 615 { | 615 { |
| 616 setValue(String::number(currentTime)); | 616 setValue(String::number(currentTime)); |
| 617 | 617 |
| 618 if (LayoutObject* layoutObject = this->layoutObject()) | 618 if (LayoutObject* layoutObject = this->layoutObject()) |
| 619 layoutObject->setShouldDoFullPaintInvalidation(); | 619 layoutObject->setShouldDoFullPaintInvalidation(); |
| 620 } | 620 } |
| 621 | 621 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 648 slider->setAttribute(maxAttr, "1"); | 648 slider->setAttribute(maxAttr, "1"); |
| 649 slider->setShadowPseudoId(AtomicString("-webkit-media-controls-volume-slider
")); | 649 slider->setShadowPseudoId(AtomicString("-webkit-media-controls-volume-slider
")); |
| 650 return slider; | 650 return slider; |
| 651 } | 651 } |
| 652 | 652 |
| 653 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) | 653 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) |
| 654 { | 654 { |
| 655 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) | 655 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) |
| 656 return; | 656 return; |
| 657 | 657 |
| 658 if (!inShadowIncludingDocument() || !document().isActive()) | 658 if (!isConnected() || !document().isActive()) |
| 659 return; | 659 return; |
| 660 | 660 |
| 661 MediaControlInputElement::defaultEventHandler(event); | 661 MediaControlInputElement::defaultEventHandler(event); |
| 662 | 662 |
| 663 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) | 663 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) |
| 664 return; | 664 return; |
| 665 | 665 |
| 666 if (event->type() == EventTypeNames::mousedown) | 666 if (event->type() == EventTypeNames::mousedown) |
| 667 Platform::current()->recordAction(UserMetricsAction("Media.Controls.Volu
meChangeBegin")); | 667 Platform::current()->recordAction(UserMetricsAction("Media.Controls.Volu
meChangeBegin")); |
| 668 | 668 |
| 669 if (event->type() == EventTypeNames::mouseup) | 669 if (event->type() == EventTypeNames::mouseup) |
| 670 Platform::current()->recordAction(UserMetricsAction("Media.Controls.Volu
meChangeEnd")); | 670 Platform::current()->recordAction(UserMetricsAction("Media.Controls.Volu
meChangeEnd")); |
| 671 | 671 |
| 672 double volume = value().toDouble(); | 672 double volume = value().toDouble(); |
| 673 mediaElement().setVolume(volume, ASSERT_NO_EXCEPTION); | 673 mediaElement().setVolume(volume, ASSERT_NO_EXCEPTION); |
| 674 mediaElement().setMuted(false); | 674 mediaElement().setMuted(false); |
| 675 } | 675 } |
| 676 | 676 |
| 677 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() | 677 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() |
| 678 { | 678 { |
| 679 if (!inShadowIncludingDocument() || !document().isActive()) | 679 if (!isConnected() || !document().isActive()) |
| 680 return false; | 680 return false; |
| 681 | 681 |
| 682 return MediaControlInputElement::willRespondToMouseMoveEvents(); | 682 return MediaControlInputElement::willRespondToMouseMoveEvents(); |
| 683 } | 683 } |
| 684 | 684 |
| 685 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents() | 685 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents() |
| 686 { | 686 { |
| 687 if (!inShadowIncludingDocument() || !document().isActive()) | 687 if (!isConnected() || !document().isActive()) |
| 688 return false; | 688 return false; |
| 689 | 689 |
| 690 return MediaControlInputElement::willRespondToMouseClickEvents(); | 690 return MediaControlInputElement::willRespondToMouseClickEvents(); |
| 691 } | 691 } |
| 692 | 692 |
| 693 void MediaControlVolumeSliderElement::setVolume(double volume) | 693 void MediaControlVolumeSliderElement::setVolume(double volume) |
| 694 { | 694 { |
| 695 if (value().toDouble() != volume) | 695 if (value().toDouble() != volume) |
| 696 setValue(String::number(volume)); | 696 setValue(String::number(volume)); |
| 697 } | 697 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 } | 852 } |
| 853 | 853 |
| 854 MediaControlCurrentTimeDisplayElement* MediaControlCurrentTimeDisplayElement::cr
eate(MediaControls& mediaControls) | 854 MediaControlCurrentTimeDisplayElement* MediaControlCurrentTimeDisplayElement::cr
eate(MediaControls& mediaControls) |
| 855 { | 855 { |
| 856 MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTime
DisplayElement(mediaControls); | 856 MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTime
DisplayElement(mediaControls); |
| 857 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display")); | 857 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display")); |
| 858 return element; | 858 return element; |
| 859 } | 859 } |
| 860 | 860 |
| 861 } // namespace blink | 861 } // namespace blink |
| OLD | NEW |