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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 return; | 367 return; |
368 | 368 |
369 // If it's a scrolling region, add the scrolling class. | 369 // If it's a scrolling region, add the scrolling class. |
370 if (isScrollingRegion()) | 370 if (isScrollingRegion()) |
371 m_cueContainer->classList().add(textTrackCueContainerScrollingClass(), A
SSERT_NO_EXCEPTION); | 371 m_cueContainer->classList().add(textTrackCueContainerScrollingClass(), A
SSERT_NO_EXCEPTION); |
372 | 372 |
373 float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); | 373 float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); |
374 | 374 |
375 // Find first cue that is not entirely displayed and scroll it upwards. | 375 // Find first cue that is not entirely displayed and scroll it upwards. |
376 for (Element* child = ElementTraversal::firstChild(*m_cueContainer); child &
& !m_scrollTimer.isActive(); child = ElementTraversal::nextSibling(*child)) { | 376 for (Element* child = ElementTraversal::firstChild(*m_cueContainer); child &
& !m_scrollTimer.isActive(); child = ElementTraversal::nextSibling(*child)) { |
377 float childTop = toHTMLDivElement(child)->getBoundingClientRect()->top()
; | 377 RefPtrWillBeRawPtr<ClientRect> clientRect = child->getBoundingClientRect
(); |
378 float childBottom = toHTMLDivElement(child)->getBoundingClientRect()->bo
ttom(); | 378 float childTop = clientRect->top(); |
| 379 float childBottom = clientRect->bottom(); |
379 | 380 |
380 if (regionBottom >= childBottom) | 381 if (regionBottom >= childBottom) |
381 continue; | 382 continue; |
382 | 383 |
383 float height = childBottom - childTop; | 384 float height = childBottom - childTop; |
384 | 385 |
385 m_currentTop -= std::min(height, childBottom - regionBottom); | 386 m_currentTop -= std::min(height, childBottom - regionBottom); |
386 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS
PrimitiveValue::CSS_PX); | 387 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS
PrimitiveValue::CSS_PX); |
387 | 388 |
388 startTimer(); | 389 startTimer(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 471 } |
471 | 472 |
472 void VTTRegion::trace(Visitor* visitor) | 473 void VTTRegion::trace(Visitor* visitor) |
473 { | 474 { |
474 visitor->trace(m_cueContainer); | 475 visitor->trace(m_cueContainer); |
475 visitor->trace(m_regionDisplayTree); | 476 visitor->trace(m_regionDisplayTree); |
476 visitor->trace(m_track); | 477 visitor->trace(m_track); |
477 } | 478 } |
478 | 479 |
479 } // namespace blink | 480 } // namespace blink |
OLD | NEW |