| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 208 } | 208 } | 
| 209 | 209 | 
| 210 void TextTrackRegion::updateParametersFromRegion(TextTrackRegion* region) | 210 void TextTrackRegion::updateParametersFromRegion(TextTrackRegion* region) | 
| 211 { | 211 { | 
| 212     m_heightInLines = region->height(); | 212     m_heightInLines = region->height(); | 
| 213     m_width = region->width(); | 213     m_width = region->width(); | 
| 214 | 214 | 
| 215     m_regionAnchor = FloatPoint(region->regionAnchorX(), region->regionAnchorY()
     ); | 215     m_regionAnchor = FloatPoint(region->regionAnchorX(), region->regionAnchorY()
     ); | 
| 216     m_viewportAnchor = FloatPoint(region->viewportAnchorX(), region->viewportAnc
     horY()); | 216     m_viewportAnchor = FloatPoint(region->viewportAnchorX(), region->viewportAnc
     horY()); | 
| 217 | 217 | 
| 218     setScroll(region->scroll(), ASSERT_NO_EXCEPTION_STATE); | 218     setScroll(region->scroll(), ASSERT_NO_EXCEPTION); | 
| 219 } | 219 } | 
| 220 | 220 | 
| 221 void TextTrackRegion::setRegionSettings(const String& input) | 221 void TextTrackRegion::setRegionSettings(const String& input) | 
| 222 { | 222 { | 
| 223     m_settings = input; | 223     m_settings = input; | 
| 224     unsigned position = 0; | 224     unsigned position = 0; | 
| 225 | 225 | 
| 226     while (position < input.length()) { | 226     while (position < input.length()) { | 
| 227         while (position < input.length() && WebVTTParser::isValidSettingDelimite
     r(input[position])) | 227         while (position < input.length() && WebVTTParser::isValidSettingDelimite
     r(input[position])) | 
| 228             position++; | 228             position++; | 
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 366 } | 366 } | 
| 367 | 367 | 
| 368 void TextTrackRegion::willRemoveTextTrackCueBox(TextTrackCueBox* box) | 368 void TextTrackRegion::willRemoveTextTrackCueBox(TextTrackCueBox* box) | 
| 369 { | 369 { | 
| 370     LOG(Media, "TextTrackRegion::willRemoveTextTrackCueBox"); | 370     LOG(Media, "TextTrackRegion::willRemoveTextTrackCueBox"); | 
| 371     ASSERT(m_cueContainer->contains(box)); | 371     ASSERT(m_cueContainer->contains(box)); | 
| 372 | 372 | 
| 373     double boxHeight = box->getBoundingClientRect()->bottom() - box->getBounding
     ClientRect()->top(); | 373     double boxHeight = box->getBoundingClientRect()->bottom() - box->getBounding
     ClientRect()->top(); | 
| 374     float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); | 374     float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); | 
| 375 | 375 | 
| 376     m_cueContainer->classList()->remove(textTrackCueContainerScrollingClass(), I
     GNORE_EXCEPTION_STATE); | 376     m_cueContainer->classList()->remove(textTrackCueContainerScrollingClass(), I
     GNORE_EXCEPTION); | 
| 377 | 377 | 
| 378     m_currentTop += boxHeight; | 378     m_currentTop += boxHeight; | 
| 379     m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSSPrim
     itiveValue::CSS_PX); | 379     m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSSPrim
     itiveValue::CSS_PX); | 
| 380 } | 380 } | 
| 381 | 381 | 
| 382 | 382 | 
| 383 void TextTrackRegion::appendTextTrackCueBox(PassRefPtr<TextTrackCueBox> displayB
     ox) | 383 void TextTrackRegion::appendTextTrackCueBox(PassRefPtr<TextTrackCueBox> displayB
     ox) | 
| 384 { | 384 { | 
| 385     if (m_cueContainer->contains(displayBox.get())) | 385     if (m_cueContainer->contains(displayBox.get())) | 
| 386         return; | 386         return; | 
| 387 | 387 | 
| 388     m_cueContainer->appendChild(displayBox, ASSERT_NO_EXCEPTION_STATE, AttachNow
     ); | 388     m_cueContainer->appendChild(displayBox, ASSERT_NO_EXCEPTION, AttachNow); | 
| 389     displayLastTextTrackCueBox(); | 389     displayLastTextTrackCueBox(); | 
| 390 } | 390 } | 
| 391 | 391 | 
| 392 void TextTrackRegion::displayLastTextTrackCueBox() | 392 void TextTrackRegion::displayLastTextTrackCueBox() | 
| 393 { | 393 { | 
| 394     LOG(Media, "TextTrackRegion::displayLastTextTrackCueBox"); | 394     LOG(Media, "TextTrackRegion::displayLastTextTrackCueBox"); | 
| 395     ASSERT(m_cueContainer); | 395     ASSERT(m_cueContainer); | 
| 396 | 396 | 
| 397     // The container needs to be rendered, if it is not empty and the region is 
     not currently scrolling. | 397     // The container needs to be rendered, if it is not empty and the region is 
     not currently scrolling. | 
| 398     if (!m_cueContainer->renderer() || !m_cueContainer->childNodeCount() || m_sc
     rollTimer.isActive()) | 398     if (!m_cueContainer->renderer() || !m_cueContainer->childNodeCount() || m_sc
     rollTimer.isActive()) | 
| 399         return; | 399         return; | 
| 400 | 400 | 
| 401     // If it's a scrolling region, add the scrolling class. | 401     // If it's a scrolling region, add the scrolling class. | 
| 402     if (isScrollingRegion()) | 402     if (isScrollingRegion()) | 
| 403         m_cueContainer->classList()->add(textTrackCueContainerScrollingClass(), 
     IGNORE_EXCEPTION_STATE); | 403         m_cueContainer->classList()->add(textTrackCueContainerScrollingClass(), 
     IGNORE_EXCEPTION); | 
| 404 | 404 | 
| 405     float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); | 405     float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); | 
| 406 | 406 | 
| 407     // Find first cue that is not entirely displayed and scroll it upwards. | 407     // Find first cue that is not entirely displayed and scroll it upwards. | 
| 408     for (int i = 0; i < m_cueContainer->childNodeCount() && !m_scrollTimer.isAct
     ive(); ++i) { | 408     for (int i = 0; i < m_cueContainer->childNodeCount() && !m_scrollTimer.isAct
     ive(); ++i) { | 
| 409         float childTop = static_cast<HTMLDivElement*>(m_cueContainer->childNode(
     i))->getBoundingClientRect()->top(); | 409         float childTop = static_cast<HTMLDivElement*>(m_cueContainer->childNode(
     i))->getBoundingClientRect()->top(); | 
| 410         float childBottom = static_cast<HTMLDivElement*>(m_cueContainer->childNo
     de(i))->getBoundingClientRect()->bottom(); | 410         float childBottom = static_cast<HTMLDivElement*>(m_cueContainer->childNo
     de(i))->getBoundingClientRect()->bottom(); | 
| 411 | 411 | 
| 412         if (regionBottom >= childBottom) | 412         if (regionBottom >= childBottom) | 
| 413             continue; | 413             continue; | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 498 { | 498 { | 
| 499     LOG(Media, "TextTrackRegion::scrollTimerFired"); | 499     LOG(Media, "TextTrackRegion::scrollTimerFired"); | 
| 500 | 500 | 
| 501     stopTimer(); | 501     stopTimer(); | 
| 502     displayLastTextTrackCueBox(); | 502     displayLastTextTrackCueBox(); | 
| 503 } | 503 } | 
| 504 | 504 | 
| 505 } // namespace WebCore | 505 } // namespace WebCore | 
| 506 | 506 | 
| 507 #endif | 507 #endif | 
| OLD | NEW | 
|---|