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 28 matching lines...) Expand all Loading... |
39 #include "core/html/HTMLDivElement.h" | 39 #include "core/html/HTMLDivElement.h" |
40 #include "core/html/track/vtt/VTTParser.h" | 40 #include "core/html/track/vtt/VTTParser.h" |
41 #include "core/html/track/vtt/VTTScanner.h" | 41 #include "core/html/track/vtt/VTTScanner.h" |
42 #include "wtf/MathExtras.h" | 42 #include "wtf/MathExtras.h" |
43 #include "wtf/text/StringBuilder.h" | 43 #include "wtf/text/StringBuilder.h" |
44 | 44 |
45 #define VTT_LOG_LEVEL 3 | 45 #define VTT_LOG_LEVEL 3 |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 // The following values default values are defined within the WebVTT Regions Spe
c. | 49 // The following values default values are defined within the WebVTT Regions |
| 50 // Spec. |
50 // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/region.html | 51 // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/region.html |
51 | 52 |
52 // The region occupies by default 100% of the width of the video viewport. | 53 // The region occupies by default 100% of the width of the video viewport. |
53 static const float defaultWidth = 100; | 54 static const float defaultWidth = 100; |
54 | 55 |
55 // The region has, by default, 3 lines of text. | 56 // The region has, by default, 3 lines of text. |
56 static const long defaultHeightInLines = 3; | 57 static const long defaultHeightInLines = 3; |
57 | 58 |
58 // The region and viewport are anchored in the bottom left corner. | 59 // The region and viewport are anchored in the bottom left corner. |
59 static const float defaultAnchorPointX = 0; | 60 static const float defaultAnchorPointX = 0; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 return; | 346 return; |
346 | 347 |
347 m_cueContainer->appendChild(displayBox); | 348 m_cueContainer->appendChild(displayBox); |
348 displayLastVTTCueBox(); | 349 displayLastVTTCueBox(); |
349 } | 350 } |
350 | 351 |
351 void VTTRegion::displayLastVTTCueBox() { | 352 void VTTRegion::displayLastVTTCueBox() { |
352 DVLOG(VTT_LOG_LEVEL) << "displayLastVTTCueBox"; | 353 DVLOG(VTT_LOG_LEVEL) << "displayLastVTTCueBox"; |
353 DCHECK(m_cueContainer); | 354 DCHECK(m_cueContainer); |
354 | 355 |
355 // FIXME: This should not be causing recalc styles in a loop to set the "top"
css | 356 // FIXME: This should not be causing recalc styles in a loop to set the "top" |
356 // property to move elements. We should just scroll the text track cues on the | 357 // css property to move elements. We should just scroll the text track cues on |
357 // compositor with an animation. | 358 // the compositor with an animation. |
358 | 359 |
359 if (m_scrollTimer.isActive()) | 360 if (m_scrollTimer.isActive()) |
360 return; | 361 return; |
361 | 362 |
362 // If it's a scrolling region, add the scrolling class. | 363 // If it's a scrolling region, add the scrolling class. |
363 if (isScrollingRegion()) | 364 if (isScrollingRegion()) |
364 m_cueContainer->classList().add(textTrackCueContainerScrollingClass(), | 365 m_cueContainer->classList().add(textTrackCueContainerScrollingClass(), |
365 ASSERT_NO_EXCEPTION); | 366 ASSERT_NO_EXCEPTION); |
366 | 367 |
367 float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); | 368 float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 displayLastVTTCueBox(); | 463 displayLastVTTCueBox(); |
463 } | 464 } |
464 | 465 |
465 DEFINE_TRACE(VTTRegion) { | 466 DEFINE_TRACE(VTTRegion) { |
466 visitor->trace(m_cueContainer); | 467 visitor->trace(m_cueContainer); |
467 visitor->trace(m_regionDisplayTree); | 468 visitor->trace(m_regionDisplayTree); |
468 visitor->trace(m_track); | 469 visitor->trace(m_track); |
469 } | 470 } |
470 | 471 |
471 } // namespace blink | 472 } // namespace blink |
OLD | NEW |