| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) | 2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) |
| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return nullptr; | 72 return nullptr; |
| 73 return toLayoutInline(m_cueBox.firstChild())->firstLineBox(); | 73 return toLayoutInline(m_cueBox.firstChild())->firstLineBox(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 LayoutUnit SnapToLinesLayouter::computeInitialPositionAdjustment(LayoutUnit& ste
p) const | 76 LayoutUnit SnapToLinesLayouter::computeInitialPositionAdjustment(LayoutUnit& ste
p) const |
| 77 { | 77 { |
| 78 ASSERT(std::isfinite(m_cueBox.snapToLinesPosition())); | 78 ASSERT(std::isfinite(m_cueBox.snapToLinesPosition())); |
| 79 | 79 |
| 80 // 6. Let line be cue's computed line. | 80 // 6. Let line be cue's computed line. |
| 81 // 7. Round line to an integer by adding 0.5 and then flooring it. | 81 // 7. Round line to an integer by adding 0.5 and then flooring it. |
| 82 LayoutUnit linePosition = floorf(m_cueBox.snapToLinesPosition() + 0.5f); | 82 LayoutUnit linePosition(floorf(m_cueBox.snapToLinesPosition() + 0.5f)); |
| 83 | 83 |
| 84 WritingMode writingMode = m_cueBox.style()->writingMode(); | 84 WritingMode writingMode = m_cueBox.style()->writingMode(); |
| 85 // 8. Vertical Growing Left: Add one to line then negate it. | 85 // 8. Vertical Growing Left: Add one to line then negate it. |
| 86 if (writingMode == RightToLeftWritingMode) | 86 if (writingMode == RightToLeftWritingMode) |
| 87 linePosition = -(linePosition + 1); | 87 linePosition = -(linePosition + 1); |
| 88 | 88 |
| 89 // 9. Let position be the result of multiplying step and line offset. | 89 // 9. Let position be the result of multiplying step and line offset. |
| 90 LayoutUnit position = step * linePosition; | 90 LayoutUnit position = step * linePosition; |
| 91 | 91 |
| 92 // 10. Vertical Growing Left: Decrease position by the width of the | 92 // 10. Vertical Growing Left: Decrease position by the width of the |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 294 } |
| 295 | 295 |
| 296 // http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13. | 296 // http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13. |
| 297 if (!std::isnan(m_snapToLinesPosition)) | 297 if (!std::isnan(m_snapToLinesPosition)) |
| 298 SnapToLinesLayouter(*this, controlsRect).layout(); | 298 SnapToLinesLayouter(*this, controlsRect).layout(); |
| 299 else | 299 else |
| 300 repositionCueSnapToLinesNotSet(); | 300 repositionCueSnapToLinesNotSet(); |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace blink | 303 } // namespace blink |
| OLD | NEW |