| 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 19 matching lines...) Expand all Loading... |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 | 31 |
| 32 #if ENABLE(VIDEO) | 32 #if ENABLE(VIDEO) |
| 33 #include "MediaControlElements.h" | 33 #include "MediaControlElements.h" |
| 34 | 34 |
| 35 #include "CaptionUserPreferences.h" | 35 #include "CaptionUserPreferences.h" |
| 36 #include "DOMTokenList.h" | 36 #include "DOMTokenList.h" |
| 37 #include "EventNames.h" | 37 #include "EventNames.h" |
| 38 #include "EventTarget.h" | 38 #include "EventTarget.h" |
| 39 #include "ExceptionCodePlaceholder.h" | 39 #include "ExceptionCodePlaceholder.h" |
| 40 #include "FloatConversion.h" | |
| 41 #include "Frame.h" | 40 #include "Frame.h" |
| 42 #include "GraphicsContext.h" | 41 #include "GraphicsContext.h" |
| 43 #include "HTMLVideoElement.h" | 42 #include "HTMLVideoElement.h" |
| 44 #include "Language.h" | 43 #include "Language.h" |
| 45 #include "LocalizedStrings.h" | 44 #include "LocalizedStrings.h" |
| 46 #include "MediaControls.h" | 45 #include "MediaControls.h" |
| 47 #include "MouseEvent.h" | 46 #include "MouseEvent.h" |
| 48 #include "Page.h" | 47 #include "Page.h" |
| 49 #include "PageGroup.h" | 48 #include "PageGroup.h" |
| 50 #include "RenderLayer.h" | 49 #include "RenderLayer.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 { | 625 { |
| 627 RefPtr<MediaControlRewindButtonElement> button = adoptRef(new MediaControlRe
windButtonElement(document)); | 626 RefPtr<MediaControlRewindButtonElement> button = adoptRef(new MediaControlRe
windButtonElement(document)); |
| 628 button->ensureUserAgentShadowRoot(); | 627 button->ensureUserAgentShadowRoot(); |
| 629 button->setType("button"); | 628 button->setType("button"); |
| 630 return button.release(); | 629 return button.release(); |
| 631 } | 630 } |
| 632 | 631 |
| 633 void MediaControlRewindButtonElement::defaultEventHandler(Event* event) | 632 void MediaControlRewindButtonElement::defaultEventHandler(Event* event) |
| 634 { | 633 { |
| 635 if (event->type() == eventNames().clickEvent) { | 634 if (event->type() == eventNames().clickEvent) { |
| 636 mediaController()->setCurrentTime(max(0.0f, mediaController()->currentTi
me() - 30), IGNORE_EXCEPTION); | 635 mediaController()->setCurrentTime(max(0.0, mediaController()->currentTim
e() - 30), IGNORE_EXCEPTION); |
| 637 event->setDefaultHandled(); | 636 event->setDefaultHandled(); |
| 638 } | 637 } |
| 639 HTMLInputElement::defaultEventHandler(event); | 638 HTMLInputElement::defaultEventHandler(event); |
| 640 } | 639 } |
| 641 | 640 |
| 642 const AtomicString& MediaControlRewindButtonElement::shadowPseudoId() const | 641 const AtomicString& MediaControlRewindButtonElement::shadowPseudoId() const |
| 643 { | 642 { |
| 644 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-rewind-button
", AtomicString::ConstructFromLiteral)); | 643 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-rewind-button
", AtomicString::ConstructFromLiteral)); |
| 645 return id; | 644 return id; |
| 646 } | 645 } |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 mediaController()->beginScrubbing(); | 957 mediaController()->beginScrubbing(); |
| 959 | 958 |
| 960 if (event->type() == eventNames().mouseupEvent) | 959 if (event->type() == eventNames().mouseupEvent) |
| 961 mediaController()->endScrubbing(); | 960 mediaController()->endScrubbing(); |
| 962 | 961 |
| 963 MediaControlInputElement::defaultEventHandler(event); | 962 MediaControlInputElement::defaultEventHandler(event); |
| 964 | 963 |
| 965 if (event->type() == eventNames().mouseoverEvent || event->type() == eventNa
mes().mouseoutEvent || event->type() == eventNames().mousemoveEvent) | 964 if (event->type() == eventNames().mouseoverEvent || event->type() == eventNa
mes().mouseoutEvent || event->type() == eventNames().mousemoveEvent) |
| 966 return; | 965 return; |
| 967 | 966 |
| 968 float time = narrowPrecisionToFloat(value().toDouble()); | 967 double time = value().toDouble(); |
| 969 if (event->type() == eventNames().inputEvent && time != mediaController()->c
urrentTime()) | 968 if (event->type() == eventNames().inputEvent && time != mediaController()->c
urrentTime()) |
| 970 mediaController()->setCurrentTime(time, IGNORE_EXCEPTION); | 969 mediaController()->setCurrentTime(time, IGNORE_EXCEPTION); |
| 971 | 970 |
| 972 RenderSlider* slider = toRenderSlider(renderer()); | 971 RenderSlider* slider = toRenderSlider(renderer()); |
| 973 if (slider && slider->inDragMode()) | 972 if (slider && slider->inDragMode()) |
| 974 m_controls->updateCurrentTimeDisplay(); | 973 m_controls->updateCurrentTimeDisplay(); |
| 975 } | 974 } |
| 976 | 975 |
| 977 bool MediaControlTimelineElement::willRespondToMouseClickEvents() | 976 bool MediaControlTimelineElement::willRespondToMouseClickEvents() |
| 978 { | 977 { |
| 979 if (!attached()) | 978 if (!attached()) |
| 980 return false; | 979 return false; |
| 981 | 980 |
| 982 return true; | 981 return true; |
| 983 } | 982 } |
| 984 | 983 |
| 985 void MediaControlTimelineElement::setPosition(float currentTime) | 984 void MediaControlTimelineElement::setPosition(double currentTime) |
| 986 { | 985 { |
| 987 setValue(String::number(currentTime)); | 986 setValue(String::number(currentTime)); |
| 988 } | 987 } |
| 989 | 988 |
| 990 void MediaControlTimelineElement::setDuration(float duration) | 989 void MediaControlTimelineElement::setDuration(double duration) |
| 991 { | 990 { |
| 992 setAttribute(maxAttr, String::number(std::isfinite(duration) ? duration : 0)
); | 991 setAttribute(maxAttr, String::number(std::isfinite(duration) ? duration : 0)
); |
| 993 } | 992 } |
| 994 | 993 |
| 995 | 994 |
| 996 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const | 995 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const |
| 997 { | 996 { |
| 998 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At
omicString::ConstructFromLiteral)); | 997 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At
omicString::ConstructFromLiteral)); |
| 999 return id; | 998 return id; |
| 1000 } | 999 } |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 { | 1405 { |
| 1407 updateSizes(); | 1406 updateSizes(); |
| 1408 } | 1407 } |
| 1409 #endif // ENABLE(VIDEO_TRACK) | 1408 #endif // ENABLE(VIDEO_TRACK) |
| 1410 | 1409 |
| 1411 // ---------------------------- | 1410 // ---------------------------- |
| 1412 | 1411 |
| 1413 } // namespace WebCore | 1412 } // namespace WebCore |
| 1414 | 1413 |
| 1415 #endif // ENABLE(VIDEO) | 1414 #endif // ENABLE(VIDEO) |
| OLD | NEW |