| 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 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void MediaControlPanelElement::makeTransparent() | 249 void MediaControlPanelElement::makeTransparent() |
| 250 { | 250 { |
| 251 if (!m_opaque) | 251 if (!m_opaque) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 setInlineStyleProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpaci
ty); | 254 setInlineStyleProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpaci
ty); |
| 255 setInlineStyleProperty(CSSPropertyWebkitTransitionDuration, document()->page
()->theme()->mediaControlsFadeOutDuration(), CSSPrimitiveValue::CSS_S); | 255 setInlineStyleProperty(CSSPropertyWebkitTransitionDuration, document()->page
()->theme()->mediaControlsFadeOutDuration(), CSSPrimitiveValue::CSS_S); |
| 256 setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBE
R); | 256 setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBE
R); |
| 257 | 257 |
| 258 m_opaque = false; | 258 m_opaque = false; |
| 259 | |
| 260 startTimer(); | |
| 261 } | 259 } |
| 262 | 260 |
| 263 void MediaControlPanelElement::defaultEventHandler(Event* event) | 261 void MediaControlPanelElement::defaultEventHandler(Event* event) |
| 264 { | 262 { |
| 265 MediaControlElement::defaultEventHandler(event); | 263 MediaControlElement::defaultEventHandler(event); |
| 266 | 264 |
| 267 if (event->isMouseEvent()) { | 265 if (event->isMouseEvent()) { |
| 268 LayoutPoint location = static_cast<MouseEvent*>(event)->absoluteLocation
(); | 266 LayoutPoint location = static_cast<MouseEvent*>(event)->absoluteLocation
(); |
| 269 if (event->type() == eventNames().mousedownEvent && event->target() == t
his) { | 267 if (event->type() == eventNames().mousedownEvent && event->target() == t
his) { |
| 270 startDrag(location); | 268 startDrag(location); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 313 } |
| 316 | 314 |
| 317 const AtomicString& MediaControlTimelineContainerElement::shadowPseudoId() const | 315 const AtomicString& MediaControlTimelineContainerElement::shadowPseudoId() const |
| 318 { | 316 { |
| 319 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline-cont
ainer")); | 317 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline-cont
ainer")); |
| 320 return id; | 318 return id; |
| 321 } | 319 } |
| 322 | 320 |
| 323 // ---------------------------- | 321 // ---------------------------- |
| 324 | 322 |
| 323 class RenderMediaVolumeSliderContainer : public RenderBlock { |
| 324 public: |
| 325 RenderMediaVolumeSliderContainer(Node*); |
| 326 |
| 327 private: |
| 328 virtual void layout(); |
| 329 }; |
| 330 |
| 331 RenderMediaVolumeSliderContainer::RenderMediaVolumeSliderContainer(Node* node) |
| 332 : RenderBlock(node) |
| 333 { |
| 334 } |
| 335 |
| 336 void RenderMediaVolumeSliderContainer::layout() |
| 337 { |
| 338 RenderBlock::layout(); |
| 339 |
| 340 if (style()->display() == NONE || !nextSibling() || !nextSibling()->isBox()) |
| 341 return; |
| 342 |
| 343 RenderBox* buttonBox = toRenderBox(nextSibling()); |
| 344 int absoluteOffsetTop = buttonBox->localToAbsolute(FloatPoint(0, -size().hei
ght())).y(); |
| 345 |
| 346 LayoutStateDisabler layoutStateDisabler(view()); |
| 347 |
| 348 // If the slider would be rendered outside the page, it should be moved belo
w the controls. |
| 349 if (UNLIKELY(absoluteOffsetTop < 0)) |
| 350 setY(buttonBox->offsetTop() + theme()->volumeSliderOffsetFromMuteButton(
buttonBox, pixelSnappedSize()).y()); |
| 351 } |
| 352 |
| 325 inline MediaControlVolumeSliderContainerElement::MediaControlVolumeSliderContain
erElement(Document* document) | 353 inline MediaControlVolumeSliderContainerElement::MediaControlVolumeSliderContain
erElement(Document* document) |
| 326 : MediaControlElement(document) | 354 : MediaControlElement(document) |
| 327 { | 355 { |
| 328 } | 356 } |
| 329 | 357 |
| 330 PassRefPtr<MediaControlVolumeSliderContainerElement> MediaControlVolumeSliderCon
tainerElement::create(Document* document) | 358 PassRefPtr<MediaControlVolumeSliderContainerElement> MediaControlVolumeSliderCon
tainerElement::create(Document* document) |
| 331 { | 359 { |
| 332 RefPtr<MediaControlVolumeSliderContainerElement> element = adoptRef(new Medi
aControlVolumeSliderContainerElement(document)); | 360 RefPtr<MediaControlVolumeSliderContainerElement> element = adoptRef(new Medi
aControlVolumeSliderContainerElement(document)); |
| 333 element->hide(); | 361 element->hide(); |
| 334 return element.release(); | 362 return element.release(); |
| 335 } | 363 } |
| 336 | 364 |
| 365 RenderObject* MediaControlVolumeSliderContainerElement::createRenderer(RenderAre
na* arena, RenderStyle*) |
| 366 { |
| 367 return new (arena) RenderMediaVolumeSliderContainer(this); |
| 368 } |
| 369 |
| 337 void MediaControlVolumeSliderContainerElement::defaultEventHandler(Event* event) | 370 void MediaControlVolumeSliderContainerElement::defaultEventHandler(Event* event) |
| 338 { | 371 { |
| 339 if (!event->isMouseEvent() || event->type() != eventNames().mouseoutEvent) | 372 if (!event->isMouseEvent() || event->type() != eventNames().mouseoutEvent) |
| 340 return; | 373 return; |
| 341 | 374 |
| 342 // Poor man's mouseleave event detection. | 375 // Poor man's mouseleave event detection. |
| 343 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); | 376 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); |
| 344 if (!mouseEvent->relatedTarget() || !mouseEvent->relatedTarget()->toNode()) | 377 if (!mouseEvent->relatedTarget() || !mouseEvent->relatedTarget()->toNode()) |
| 345 return; | 378 return; |
| 346 | 379 |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 } | 1326 } |
| 1294 } | 1327 } |
| 1295 | 1328 |
| 1296 #endif // ENABLE(VIDEO_TRACK) | 1329 #endif // ENABLE(VIDEO_TRACK) |
| 1297 | 1330 |
| 1298 // ---------------------------- | 1331 // ---------------------------- |
| 1299 | 1332 |
| 1300 } // namespace WebCore | 1333 } // namespace WebCore |
| 1301 | 1334 |
| 1302 #endif // ENABLE(VIDEO) | 1335 #endif // ENABLE(VIDEO) |
| OLD | NEW |