| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 m_regionDisplayTree = HTMLDivElement::create(document); | 326 m_regionDisplayTree = HTMLDivElement::create(document); |
| 327 prepareRegionDisplayTree(); | 327 prepareRegionDisplayTree(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 return m_regionDisplayTree; | 330 return m_regionDisplayTree; |
| 331 } | 331 } |
| 332 | 332 |
| 333 void VTTRegion::willRemoveVTTCueBox(VTTCueBox* box) | 333 void VTTRegion::willRemoveVTTCueBox(VTTCueBox* box) |
| 334 { | 334 { |
| 335 DVLOG(VTT_LOG_LEVEL) << "willRemoveVTTCueBox"; | 335 DVLOG(VTT_LOG_LEVEL) << "willRemoveVTTCueBox"; |
| 336 ASSERT(m_cueContainer->contains(box)); | 336 DCHECK(m_cueContainer->contains(box)); |
| 337 | 337 |
| 338 double boxHeight = box->getBoundingClientRect()->bottom() - box->getBounding
ClientRect()->top(); | 338 double boxHeight = box->getBoundingClientRect()->bottom() - box->getBounding
ClientRect()->top(); |
| 339 | 339 |
| 340 m_cueContainer->classList().remove(textTrackCueContainerScrollingClass(), AS
SERT_NO_EXCEPTION); | 340 m_cueContainer->classList().remove(textTrackCueContainerScrollingClass(), AS
SERT_NO_EXCEPTION); |
| 341 | 341 |
| 342 m_currentTop += boxHeight; | 342 m_currentTop += boxHeight; |
| 343 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSSPrim
itiveValue::UnitType::Pixels); | 343 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSSPrim
itiveValue::UnitType::Pixels); |
| 344 } | 344 } |
| 345 | 345 |
| 346 void VTTRegion::appendVTTCueBox(VTTCueBox* displayBox) | 346 void VTTRegion::appendVTTCueBox(VTTCueBox* displayBox) |
| 347 { | 347 { |
| 348 ASSERT(m_cueContainer); | 348 DCHECK(m_cueContainer); |
| 349 | 349 |
| 350 if (m_cueContainer->contains(displayBox)) | 350 if (m_cueContainer->contains(displayBox)) |
| 351 return; | 351 return; |
| 352 | 352 |
| 353 m_cueContainer->appendChild(displayBox); | 353 m_cueContainer->appendChild(displayBox); |
| 354 displayLastVTTCueBox(); | 354 displayLastVTTCueBox(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 void VTTRegion::displayLastVTTCueBox() | 357 void VTTRegion::displayLastVTTCueBox() |
| 358 { | 358 { |
| 359 DVLOG(VTT_LOG_LEVEL) << "displayLastVTTCueBox"; | 359 DVLOG(VTT_LOG_LEVEL) << "displayLastVTTCueBox"; |
| 360 ASSERT(m_cueContainer); | 360 DCHECK(m_cueContainer); |
| 361 | 361 |
| 362 // FIXME: This should not be causing recalc styles in a loop to set the "top
" css | 362 // FIXME: This should not be causing recalc styles in a loop to set the "top
" css |
| 363 // property to move elements. We should just scroll the text track cues on t
he | 363 // property to move elements. We should just scroll the text track cues on t
he |
| 364 // compositor with an animation. | 364 // compositor with an animation. |
| 365 | 365 |
| 366 if (m_scrollTimer.isActive()) | 366 if (m_scrollTimer.isActive()) |
| 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()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 385 | 385 |
| 386 m_currentTop -= std::min(height, childBottom - regionBottom); | 386 m_currentTop -= std::min(height, childBottom - regionBottom); |
| 387 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS
PrimitiveValue::UnitType::Pixels); | 387 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS
PrimitiveValue::UnitType::Pixels); |
| 388 | 388 |
| 389 startTimer(); | 389 startTimer(); |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| 393 void VTTRegion::prepareRegionDisplayTree() | 393 void VTTRegion::prepareRegionDisplayTree() |
| 394 { | 394 { |
| 395 ASSERT(m_regionDisplayTree); | 395 DCHECK(m_regionDisplayTree); |
| 396 | 396 |
| 397 // 7.2 Prepare region CSS boxes | 397 // 7.2 Prepare region CSS boxes |
| 398 | 398 |
| 399 // FIXME: Change the code below to use viewport units when | 399 // FIXME: Change the code below to use viewport units when |
| 400 // http://crbug/244618 is fixed. | 400 // http://crbug/244618 is fixed. |
| 401 | 401 |
| 402 // Let regionWidth be the text track region width. | 402 // Let regionWidth be the text track region width. |
| 403 // Let width be 'regionWidth vw' ('vw' is a CSS unit) | 403 // Let width be 'regionWidth vw' ('vw' is a CSS unit) |
| 404 m_regionDisplayTree->setInlineStyleProperty(CSSPropertyWidth, | 404 m_regionDisplayTree->setInlineStyleProperty(CSSPropertyWidth, |
| 405 m_width, CSSPrimitiveValue::UnitType::Percentage); | 405 m_width, CSSPrimitiveValue::UnitType::Percentage); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 471 } |
| 472 | 472 |
| 473 DEFINE_TRACE(VTTRegion) | 473 DEFINE_TRACE(VTTRegion) |
| 474 { | 474 { |
| 475 visitor->trace(m_cueContainer); | 475 visitor->trace(m_cueContainer); |
| 476 visitor->trace(m_regionDisplayTree); | 476 visitor->trace(m_regionDisplayTree); |
| 477 visitor->trace(m_track); | 477 visitor->trace(m_track); |
| 478 } | 478 } |
| 479 | 479 |
| 480 } // namespace blink | 480 } // namespace blink |
| OLD | NEW |