Chromium Code Reviews| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 | 140 |
| 141 m_opaque = false; | 141 m_opaque = false; |
| 142 startTimer(); | 142 startTimer(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void MediaControlPanelElement::setIsDisplayed(bool isDisplayed) | 145 void MediaControlPanelElement::setIsDisplayed(bool isDisplayed) |
| 146 { | 146 { |
| 147 m_isDisplayed = isDisplayed; | 147 m_isDisplayed = isDisplayed; |
| 148 } | 148 } |
| 149 | 149 |
| 150 bool MediaControlPanelElement::keepEventInShadowDOM(Event* event) | |
| 151 { | |
| 152 const AtomicString& type = event->type(); | |
|
philipj_slow
2014/07/29 11:31:07
This logic is repeated once, so a static bool isUs
aberent
2014/07/31 10:52:47
Done.
| |
| 153 return type == EventTypeNames::mousedown | |
| 154 || type == EventTypeNames::mouseup | |
| 155 || type == EventTypeNames::click | |
| 156 || type == EventTypeNames::dblclick | |
| 157 || event->isKeyboardEvent() | |
| 158 || event->isTouchEvent(); | |
| 159 } | |
| 160 | |
| 150 // ---------------------------- | 161 // ---------------------------- |
| 151 | 162 |
| 152 MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(MediaContro ls& mediaControls) | 163 MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(MediaContro ls& mediaControls) |
| 153 // Mapping onto same MediaControlElementType as panel element, since it has similar properties. | 164 // Mapping onto same MediaControlElementType as panel element, since it has similar properties. |
| 154 : MediaControlDivElement(mediaControls, MediaControlsPanel) | 165 : MediaControlDivElement(mediaControls, MediaControlsPanel) |
| 155 { | 166 { |
| 156 } | 167 } |
| 157 | 168 |
| 158 PassRefPtrWillBeRawPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclo sureElement::create(MediaControls& mediaControls) | 169 PassRefPtrWillBeRawPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclo sureElement::create(MediaControls& mediaControls) |
| 159 { | 170 { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 } else | 299 } else |
| 289 hide(); | 300 hide(); |
| 290 } | 301 } |
| 291 | 302 |
| 292 const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const | 303 const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const |
| 293 { | 304 { |
| 294 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-play- button", AtomicString::ConstructFromLiteral)); | 305 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-play- button", AtomicString::ConstructFromLiteral)); |
| 295 return id; | 306 return id; |
| 296 } | 307 } |
| 297 | 308 |
| 309 bool MediaControlOverlayPlayButtonElement::keepEventInShadowDOM(Event* event) | |
| 310 { | |
| 311 const AtomicString& type = event->type(); | |
| 312 return type == EventTypeNames::mousedown | |
| 313 || type == EventTypeNames::mouseup | |
| 314 || type == EventTypeNames::click | |
| 315 || type == EventTypeNames::dblclick | |
| 316 || event->isKeyboardEvent() | |
| 317 || event->isTouchEvent(); | |
| 318 } | |
| 319 | |
| 298 | 320 |
| 299 // ---------------------------- | 321 // ---------------------------- |
| 300 | 322 |
| 301 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB uttonElement(MediaControls& mediaControls) | 323 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB uttonElement(MediaControls& mediaControls) |
| 302 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) | 324 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) |
| 303 { | 325 { |
| 304 } | 326 } |
| 305 | 327 |
| 306 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) | 328 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) |
| 307 { | 329 { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 setFloatingPointAttribute(maxAttr, std::isfinite(duration) ? duration : 0); | 424 setFloatingPointAttribute(maxAttr, std::isfinite(duration) ? duration : 0); |
| 403 } | 425 } |
| 404 | 426 |
| 405 | 427 |
| 406 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const | 428 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const |
| 407 { | 429 { |
| 408 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At omicString::ConstructFromLiteral)); | 430 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At omicString::ConstructFromLiteral)); |
| 409 return id; | 431 return id; |
| 410 } | 432 } |
| 411 | 433 |
| 434 bool MediaControlTimelineElement::keepEventInShadowDOM(Event* event) | |
| 435 { | |
| 436 // Capture some additional event types in the shadow DOM when on the slider. Note that MediaControlPanelElement::keepEventInShadowDOM | |
| 437 // will also be called in this case, so those events will also be captured. | |
| 438 const AtomicString& type = event->type(); | |
|
philipj_slow
2014/07/29 11:31:07
Same here, maybe isUserInteractionEventForSlider()
aberent
2014/07/31 10:52:47
Done.
| |
| 439 return type == EventTypeNames::mouseover | |
| 440 || type == EventTypeNames::mouseout | |
| 441 || type == EventTypeNames::mousemove; | |
| 442 } | |
| 443 | |
| 412 // ---------------------------- | 444 // ---------------------------- |
| 413 | 445 |
| 414 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls& mediaControls) | 446 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls& mediaControls) |
| 415 : MediaControlInputElement(mediaControls, MediaVolumeSlider) | 447 : MediaControlInputElement(mediaControls, MediaVolumeSlider) |
| 416 { | 448 { |
| 417 } | 449 } |
| 418 | 450 |
| 419 PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> MediaControlVolumeSlider Element::create(MediaControls& mediaControls) | 451 PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> MediaControlVolumeSlider Element::create(MediaControls& mediaControls) |
| 420 { | 452 { |
| 421 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = adoptRefWillBeN oop(new MediaControlVolumeSliderElement(mediaControls)); | 453 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = adoptRefWillBeN oop(new MediaControlVolumeSliderElement(mediaControls)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 if (value().toDouble() != volume) | 497 if (value().toDouble() != volume) |
| 466 setValue(String::number(volume)); | 498 setValue(String::number(volume)); |
| 467 } | 499 } |
| 468 | 500 |
| 469 const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const | 501 const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const |
| 470 { | 502 { |
| 471 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider ", AtomicString::ConstructFromLiteral)); | 503 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider ", AtomicString::ConstructFromLiteral)); |
| 472 return id; | 504 return id; |
| 473 } | 505 } |
| 474 | 506 |
| 507 bool MediaControlVolumeSliderElement::keepEventInShadowDOM(Event* event) | |
| 508 { | |
| 509 // Capture some additional event types in the shadow DOM when on the slider. Note that MediaControlPanelElement::keepEventInShadowDOM | |
| 510 // will also be called in this case, so those events will also be captured. | |
| 511 const AtomicString& type = event->type(); | |
| 512 return type == EventTypeNames::mouseover | |
| 513 || type == EventTypeNames::mouseout | |
| 514 || type == EventTypeNames::mousemove; | |
| 515 } | |
| 516 | |
| 475 // ---------------------------- | 517 // ---------------------------- |
| 476 | 518 |
| 477 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo ntrols& mediaControls) | 519 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo ntrols& mediaControls) |
| 478 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) | 520 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) |
| 479 { | 521 { |
| 480 } | 522 } |
| 481 | 523 |
| 482 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre enButtonElement::create(MediaControls& mediaControls) | 524 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre enButtonElement::create(MediaControls& mediaControls) |
| 483 { | 525 { |
| 484 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); | 526 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 float fontSize = smallestDimension * 0.05f; | 717 float fontSize = smallestDimension * 0.05f; |
| 676 if (fontSize != m_fontSize) { | 718 if (fontSize != m_fontSize) { |
| 677 m_fontSize = fontSize; | 719 m_fontSize = fontSize; |
| 678 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); | 720 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); |
| 679 } | 721 } |
| 680 } | 722 } |
| 681 | 723 |
| 682 // ---------------------------- | 724 // ---------------------------- |
| 683 | 725 |
| 684 } // namespace blink | 726 } // namespace blink |
| OLD | NEW |