| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2013, Opera Software ASA. 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 , m_text(text) | 222 , m_text(text) |
| 223 , m_linePosition(std::numeric_limits<float>::quiet_NaN()) | 223 , m_linePosition(std::numeric_limits<float>::quiet_NaN()) |
| 224 , m_textPosition(std::numeric_limits<float>::quiet_NaN()) | 224 , m_textPosition(std::numeric_limits<float>::quiet_NaN()) |
| 225 , m_cueSize(100) | 225 , m_cueSize(100) |
| 226 , m_writingDirection(Horizontal) | 226 , m_writingDirection(Horizontal) |
| 227 , m_cueAlignment(Middle) | 227 , m_cueAlignment(Middle) |
| 228 , m_vttNodeTree(nullptr) | 228 , m_vttNodeTree(nullptr) |
| 229 , m_cueBackgroundBox(HTMLDivElement::create(document)) | 229 , m_cueBackgroundBox(HTMLDivElement::create(document)) |
| 230 , m_snapToLines(true) | 230 , m_snapToLines(true) |
| 231 , m_displayTreeShouldChange(true) | 231 , m_displayTreeShouldChange(true) |
| 232 , m_notifyRegion(true) | |
| 233 { | 232 { |
| 234 UseCounter::count(document, UseCounter::VTTCue); | 233 UseCounter::count(document, UseCounter::VTTCue); |
| 235 } | 234 } |
| 236 | 235 |
| 237 VTTCue::~VTTCue() | 236 VTTCue::~VTTCue() |
| 238 { | 237 { |
| 239 // Using oilpan, if m_displayTree is in the document it will strongly keep | 238 // Using oilpan, if m_displayTree is in the document it will strongly keep |
| 240 // the cue alive. Thus, if the cue is dead, either m_displayTree is not in | 239 // the cue alive. Thus, if the cue is dead, either m_displayTree is not in |
| 241 // the document or the entire document is dead too. | 240 // the document or the entire document is dead too. |
| 242 #if !ENABLE(OILPAN) | 241 #if !ENABLE(OILPAN) |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 void VTTCue::setRegionId(const String& regionId) | 492 void VTTCue::setRegionId(const String& regionId) |
| 494 { | 493 { |
| 495 if (m_regionId == regionId) | 494 if (m_regionId == regionId) |
| 496 return; | 495 return; |
| 497 | 496 |
| 498 cueWillChange(); | 497 cueWillChange(); |
| 499 m_regionId = regionId; | 498 m_regionId = regionId; |
| 500 cueDidChange(); | 499 cueDidChange(); |
| 501 } | 500 } |
| 502 | 501 |
| 503 void VTTCue::notifyRegionWhenRemovingDisplayTree(bool notifyRegion) | |
| 504 { | |
| 505 m_notifyRegion = notifyRegion; | |
| 506 } | |
| 507 | |
| 508 float VTTCue::calculateComputedLinePosition() const | 502 float VTTCue::calculateComputedLinePosition() const |
| 509 { | 503 { |
| 510 // http://dev.w3.org/html5/webvtt/#dfn-text-track-cue-computed-line-position | 504 // http://dev.w3.org/html5/webvtt/#dfn-text-track-cue-computed-line-position |
| 511 // A text track cue has a text track cue computed line position whose value | 505 // A text track cue has a text track cue computed line position whose value |
| 512 // is that returned by the following algorithm, which is defined in terms | 506 // is that returned by the following algorithm, which is defined in terms |
| 513 // of the other aspects of the cue: | 507 // of the other aspects of the cue: |
| 514 | 508 |
| 515 // 1. If the text track cue line position is numeric, the text track cue | 509 // 1. If the text track cue line position is numeric, the text track cue |
| 516 // snap-to-lines flag of the text track cue is not set, and the text | 510 // snap-to-lines flag of the text track cue is not set, and the text |
| 517 // track cue line position is negative or greater than 100, then return | 511 // track cue line position is negative or greater than 100, then return |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 // normally would in CSS, it is instead forcibly wrapped at the box's edge.) | 836 // normally would in CSS, it is instead forcibly wrapped at the box's edge.) |
| 843 displayTree->applyCSSProperties(displayParameters); | 837 displayTree->applyCSSProperties(displayParameters); |
| 844 | 838 |
| 845 m_displayTreeShouldChange = false; | 839 m_displayTreeShouldChange = false; |
| 846 | 840 |
| 847 // 10.15. Let cue's text track cue display state have the CSS boxes in | 841 // 10.15. Let cue's text track cue display state have the CSS boxes in |
| 848 // boxes. | 842 // boxes. |
| 849 return displayTree.release(); | 843 return displayTree.release(); |
| 850 } | 844 } |
| 851 | 845 |
| 852 void VTTCue::removeDisplayTree() | 846 void VTTCue::removeDisplayTree(RemovalNotification removalNotification) |
| 853 { | 847 { |
| 854 if (m_notifyRegion && track()->regions()) { | 848 if (removalNotification == NotifyRegion && track()->regions()) { |
| 855 // The region needs to be informed about the cue removal. | 849 // The region needs to be informed about the cue removal. |
| 856 VTTRegion* region = track()->regions()->getRegionById(m_regionId); | 850 VTTRegion* region = track()->regions()->getRegionById(m_regionId); |
| 857 if (region) | 851 if (region) |
| 858 region->willRemoveVTTCueBox(m_displayTree.get()); | 852 region->willRemoveVTTCueBox(m_displayTree.get()); |
| 859 } | 853 } |
| 860 | 854 |
| 861 if (m_displayTree) | 855 if (m_displayTree) |
| 862 m_displayTree->remove(ASSERT_NO_EXCEPTION); | 856 m_displayTree->remove(ASSERT_NO_EXCEPTION); |
| 863 } | 857 } |
| 864 | 858 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 | 1122 |
| 1129 DEFINE_TRACE(VTTCue) | 1123 DEFINE_TRACE(VTTCue) |
| 1130 { | 1124 { |
| 1131 visitor->trace(m_vttNodeTree); | 1125 visitor->trace(m_vttNodeTree); |
| 1132 visitor->trace(m_cueBackgroundBox); | 1126 visitor->trace(m_cueBackgroundBox); |
| 1133 visitor->trace(m_displayTree); | 1127 visitor->trace(m_displayTree); |
| 1134 TextTrackCue::trace(visitor); | 1128 TextTrackCue::trace(visitor); |
| 1135 } | 1129 } |
| 1136 | 1130 |
| 1137 } // namespace blink | 1131 } // namespace blink |
| OLD | NEW |