| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 timeline->setAttribute(stepAttr, "any"); | 390 timeline->setAttribute(stepAttr, "any"); |
| 391 timeline->setShadowPseudoId(AtomicString("-webkit-media-controls-timeline"))
; | 391 timeline->setShadowPseudoId(AtomicString("-webkit-media-controls-timeline"))
; |
| 392 return timeline.release(); | 392 return timeline.release(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void MediaControlTimelineElement::defaultEventHandler(Event* event) | 395 void MediaControlTimelineElement::defaultEventHandler(Event* event) |
| 396 { | 396 { |
| 397 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) | 397 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) |
| 398 return; | 398 return; |
| 399 | 399 |
| 400 if (!inDocument() || !document().isActive()) | 400 if (!inShadowIncludingDocument() || !document().isActive()) |
| 401 return; | 401 return; |
| 402 | 402 |
| 403 if (event->type() == EventTypeNames::mousedown) | 403 if (event->type() == EventTypeNames::mousedown) |
| 404 mediaControls().beginScrubbing(); | 404 mediaControls().beginScrubbing(); |
| 405 | 405 |
| 406 if (event->type() == EventTypeNames::mouseup) | 406 if (event->type() == EventTypeNames::mouseup) |
| 407 mediaControls().endScrubbing(); | 407 mediaControls().endScrubbing(); |
| 408 | 408 |
| 409 MediaControlInputElement::defaultEventHandler(event); | 409 MediaControlInputElement::defaultEventHandler(event); |
| 410 | 410 |
| 411 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) | 411 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) |
| 412 return; | 412 return; |
| 413 | 413 |
| 414 double time = value().toDouble(); | 414 double time = value().toDouble(); |
| 415 if (event->type() == EventTypeNames::input) { | 415 if (event->type() == EventTypeNames::input) { |
| 416 // FIXME: This will need to take the timeline offset into consideration | 416 // FIXME: This will need to take the timeline offset into consideration |
| 417 // once that concept is supported, see https://crbug.com/312699 | 417 // once that concept is supported, see https://crbug.com/312699 |
| 418 if (mediaElement().seekable()->contain(time)) | 418 if (mediaElement().seekable()->contain(time)) |
| 419 mediaElement().setCurrentTime(time); | 419 mediaElement().setCurrentTime(time); |
| 420 } | 420 } |
| 421 | 421 |
| 422 LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject())); | 422 LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject())); |
| 423 if (!slider.isNull() && slider.inDragMode()) | 423 if (!slider.isNull() && slider.inDragMode()) |
| 424 mediaControls().updateCurrentTimeDisplay(); | 424 mediaControls().updateCurrentTimeDisplay(); |
| 425 } | 425 } |
| 426 | 426 |
| 427 bool MediaControlTimelineElement::willRespondToMouseClickEvents() | 427 bool MediaControlTimelineElement::willRespondToMouseClickEvents() |
| 428 { | 428 { |
| 429 return inDocument() && document().isActive(); | 429 return inShadowIncludingDocument() && document().isActive(); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void MediaControlTimelineElement::setPosition(double currentTime) | 432 void MediaControlTimelineElement::setPosition(double currentTime) |
| 433 { | 433 { |
| 434 setValue(String::number(currentTime)); | 434 setValue(String::number(currentTime)); |
| 435 | 435 |
| 436 if (LayoutObject* layoutObject = this->layoutObject()) | 436 if (LayoutObject* layoutObject = this->layoutObject()) |
| 437 layoutObject->setShouldDoFullPaintInvalidation(); | 437 layoutObject->setShouldDoFullPaintInvalidation(); |
| 438 } | 438 } |
| 439 | 439 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 466 slider->setAttribute(maxAttr, "1"); | 466 slider->setAttribute(maxAttr, "1"); |
| 467 slider->setShadowPseudoId(AtomicString("-webkit-media-controls-volume-slider
")); | 467 slider->setShadowPseudoId(AtomicString("-webkit-media-controls-volume-slider
")); |
| 468 return slider.release(); | 468 return slider.release(); |
| 469 } | 469 } |
| 470 | 470 |
| 471 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) | 471 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) |
| 472 { | 472 { |
| 473 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) | 473 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) |
| 474 return; | 474 return; |
| 475 | 475 |
| 476 if (!inDocument() || !document().isActive()) | 476 if (!inShadowIncludingDocument() || !document().isActive()) |
| 477 return; | 477 return; |
| 478 | 478 |
| 479 MediaControlInputElement::defaultEventHandler(event); | 479 MediaControlInputElement::defaultEventHandler(event); |
| 480 | 480 |
| 481 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) | 481 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) |
| 482 return; | 482 return; |
| 483 | 483 |
| 484 double volume = value().toDouble(); | 484 double volume = value().toDouble(); |
| 485 mediaElement().setVolume(volume, ASSERT_NO_EXCEPTION); | 485 mediaElement().setVolume(volume, ASSERT_NO_EXCEPTION); |
| 486 mediaElement().setMuted(false); | 486 mediaElement().setMuted(false); |
| 487 } | 487 } |
| 488 | 488 |
| 489 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() | 489 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() |
| 490 { | 490 { |
| 491 if (!inDocument() || !document().isActive()) | 491 if (!inShadowIncludingDocument() || !document().isActive()) |
| 492 return false; | 492 return false; |
| 493 | 493 |
| 494 return MediaControlInputElement::willRespondToMouseMoveEvents(); | 494 return MediaControlInputElement::willRespondToMouseMoveEvents(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents() | 497 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents() |
| 498 { | 498 { |
| 499 if (!inDocument() || !document().isActive()) | 499 if (!inShadowIncludingDocument() || !document().isActive()) |
| 500 return false; | 500 return false; |
| 501 | 501 |
| 502 return MediaControlInputElement::willRespondToMouseClickEvents(); | 502 return MediaControlInputElement::willRespondToMouseClickEvents(); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void MediaControlVolumeSliderElement::setVolume(double volume) | 505 void MediaControlVolumeSliderElement::setVolume(double volume) |
| 506 { | 506 { |
| 507 if (value().toDouble() != volume) | 507 if (value().toDouble() != volume) |
| 508 setValue(String::number(volume)); | 508 setValue(String::number(volume)); |
| 509 } | 509 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 656 } |
| 657 | 657 |
| 658 RawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurrentTimeDisplayElem
ent::create(MediaControls& mediaControls) | 658 RawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurrentTimeDisplayElem
ent::create(MediaControls& mediaControls) |
| 659 { | 659 { |
| 660 RawPtr<MediaControlCurrentTimeDisplayElement> element = new MediaControlCurr
entTimeDisplayElement(mediaControls); | 660 RawPtr<MediaControlCurrentTimeDisplayElement> element = new MediaControlCurr
entTimeDisplayElement(mediaControls); |
| 661 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display")); | 661 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display")); |
| 662 return element.release(); | 662 return element.release(); |
| 663 } | 663 } |
| 664 | 664 |
| 665 } // namespace blink | 665 } // namespace blink |
| OLD | NEW |