| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 if (m_scrollTimer.isActive()) | 368 if (m_scrollTimer.isActive()) |
| 369 return; | 369 return; |
| 370 | 370 |
| 371 // If it's a scrolling region, add the scrolling class. | 371 // If it's a scrolling region, add the scrolling class. |
| 372 if (isScrollingRegion()) | 372 if (isScrollingRegion()) |
| 373 m_cueContainer->classList()->add(textTrackCueContainerScrollingClass(),
ASSERT_NO_EXCEPTION); | 373 m_cueContainer->classList()->add(textTrackCueContainerScrollingClass(),
ASSERT_NO_EXCEPTION); |
| 374 | 374 |
| 375 float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); | 375 float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); |
| 376 | 376 |
| 377 // Find first cue that is not entirely displayed and scroll it upwards. | 377 // Find first cue that is not entirely displayed and scroll it upwards. |
| 378 for (size_t i = 0; i < m_cueContainer->childNodeCount() && !m_scrollTimer.is
Active(); ++i) { | 378 for (Element* child = ElementTraversal::firstWithin(*m_cueContainer); child
&& !m_scrollTimer.isActive(); child = ElementTraversal::nextSibling(*child)) { |
| 379 float childTop = toHTMLDivElement(m_cueContainer->childNode(i))->getBoun
dingClientRect()->top(); | 379 float childTop = toHTMLDivElement(child)->getBoundingClientRect()->top()
; |
| 380 float childBottom = toHTMLDivElement(m_cueContainer->childNode(i))->getB
oundingClientRect()->bottom(); | 380 float childBottom = toHTMLDivElement(child)->getBoundingClientRect()->bo
ttom(); |
| 381 | 381 |
| 382 if (regionBottom >= childBottom) | 382 if (regionBottom >= childBottom) |
| 383 continue; | 383 continue; |
| 384 | 384 |
| 385 float height = childBottom - childTop; | 385 float height = childBottom - childTop; |
| 386 | 386 |
| 387 m_currentTop -= std::min(height, childBottom - regionBottom); | 387 m_currentTop -= std::min(height, childBottom - regionBottom); |
| 388 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS
PrimitiveValue::CSS_PX); | 388 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS
PrimitiveValue::CSS_PX); |
| 389 | 389 |
| 390 startTimer(); | 390 startTimer(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 465 |
| 466 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) | 466 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) |
| 467 { | 467 { |
| 468 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); | 468 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); |
| 469 | 469 |
| 470 stopTimer(); | 470 stopTimer(); |
| 471 displayLastVTTCueBox(); | 471 displayLastVTTCueBox(); |
| 472 } | 472 } |
| 473 | 473 |
| 474 } // namespace WebCore | 474 } // namespace WebCore |
| OLD | NEW |