void VTTCue::removeDisplayTree() { if (m_notifyRegion && track()->regions()) { // The region needs to be informed about the cue removal. VTTRegion* region = track()->regions()->getRegionById(m_regionId); if (region) region->willRemoveVTTCueBox(m_displayTree.get()); } displayTreeInternal()->remove(ASSERT_NO_EXCEPTION); }
void VTTCue::updateDisplay(HTMLDivElement& container) { ASSERT(track() && track()->isRendered() && isActive()); UseCounter::count(document(), UseCounter::VTTCueRender); if (m_writingDirection != Horizontal) UseCounter::count(document(), UseCounter::VTTCueRenderVertical); if (!m_snapToLines) UseCounter::count(document(), UseCounter::VTTCueRenderSnapToLinesFalse); if (!lineIsAuto()) UseCounter::count(document(), UseCounter::VTTCueRenderLineNotAuto); if (textPositionIsAuto()) UseCounter::count(document(), UseCounter::VTTCueRenderPositionNot50); if (m_cueSize != 100) UseCounter::count(document(), UseCounter::VTTCueRenderSizeNot100); if (m_cueAlignment != Middle) UseCounter::count(document(), UseCounter::VTTCueRenderAlignNotMiddle); VTTCueBox* displayBox = getDisplayTree(); VTTRegion* region = 0; if (track()->regions()) region = track()->regions()->getRegionById(regionId()); if (!region) { // If cue has an empty region identifier or there is no WebVTT region // whose region identifier is identical to cue's region identifier, run // the following substeps: if (displayBox->hasChildren() && !container.contains(displayBox)) { // Note: the display tree of a cue is removed when the active flag of the cue is unset. container.appendChild(displayBox); } } else { // Let region be the WebVTT region whose region identifier matches the // region identifier of cue. HTMLDivElement* regionNode = region->getDisplayTree(document()); // Append the region to the viewport, if it was not already. if (!container.contains(regionNode)) container.appendChild(regionNode); region->appendVTTCueBox(displayBox); } }
void VTTCue::updateDisplay(const IntSize& videoSize, HTMLDivElement& container) { UseCounter::count(document(), UseCounter::VTTCueRender); if (m_writingDirection != Horizontal) UseCounter::count(document(), UseCounter::VTTCueRenderVertical); if (!m_snapToLines) UseCounter::count(document(), UseCounter::VTTCueRenderSnapToLinesFalse); if (m_linePosition != undefinedPosition) UseCounter::count(document(), UseCounter::VTTCueRenderLineNotAuto); if (m_textPosition != 50) UseCounter::count(document(), UseCounter::VTTCueRenderPositionNot50); if (m_cueSize != 100) UseCounter::count(document(), UseCounter::VTTCueRenderSizeNot100); if (m_cueAlignment != Middle) UseCounter::count(document(), UseCounter::VTTCueRenderAlignNotMiddle); RefPtrWillBeRawPtr<VTTCueBox> displayBox = getDisplayTree(videoSize); VTTRegion* region = 0; if (track()->regions()) region = track()->regions()->getRegionById(regionId()); if (!region) { // If cue has an empty text track cue region identifier or there is no // WebVTT region whose region identifier is identical to cue's text // track cue region identifier, run the following substeps: if (displayBox->hasChildren() && !container.contains(displayBox.get())) { // Note: the display tree of a cue is removed when the active flag of the cue is unset. container.appendChild(displayBox); } } else { // Let region be the WebVTT region whose region identifier // matches the text track cue region identifier of cue. RefPtrWillBeRawPtr<HTMLDivElement> regionNode = region->getDisplayTree(document()); // Append the region to the viewport, if it was not already. if (!container.contains(regionNode.get())) container.appendChild(regionNode); region->appendVTTCueBox(displayBox); } }
void VTTParser::createNewRegion(const String& headerValue) { if (headerValue.isEmpty()) return; // Steps 12.5.1 - 12.5.9 - Construct and initialize a WebVTT Region object. VTTRegion* region = VTTRegion::create(); region->setRegionSettings(headerValue); // Step 12.5.10 If the text track list of regions regions contains a region // with the same region identifier value as region, remove that region. for (size_t i = 0; i < m_regionList.size(); ++i) { if (m_regionList[i]->id() == region->id()) { m_regionList.remove(i); break; } } // Step 12.5.11 m_regionList.append(region); }