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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/html/track/vtt/VTTScanner.h" | 47 #include "core/html/track/vtt/VTTScanner.h" |
48 #include "core/rendering/RenderVTTCue.h" | 48 #include "core/rendering/RenderVTTCue.h" |
49 #include "platform/text/BidiResolver.h" | 49 #include "platform/text/BidiResolver.h" |
50 #include "platform/text/TextRunIterator.h" | 50 #include "platform/text/TextRunIterator.h" |
51 #include "wtf/MathExtras.h" | 51 #include "wtf/MathExtras.h" |
52 #include "wtf/text/StringBuilder.h" | 52 #include "wtf/text/StringBuilder.h" |
53 | 53 |
54 namespace WebCore { | 54 namespace WebCore { |
55 | 55 |
56 static const int undefinedPosition = -1; | 56 static const int undefinedPosition = -1; |
| 57 static const int undefinedSize = -1; |
57 | 58 |
58 static const CSSValueID displayWritingModeMap[] = { | 59 static const CSSValueID displayWritingModeMap[] = { |
59 CSSValueHorizontalTb, CSSValueVerticalRl, CSSValueVerticalLr | 60 CSSValueHorizontalTb, CSSValueVerticalRl, CSSValueVerticalLr |
60 }; | 61 }; |
61 COMPILE_ASSERT(WTF_ARRAY_LENGTH(displayWritingModeMap) == VTTCue::NumberOfWritin
gDirections, | 62 COMPILE_ASSERT(WTF_ARRAY_LENGTH(displayWritingModeMap) == VTTCue::NumberOfWritin
gDirections, |
62 displayWritingModeMap_has_wrong_size); | 63 displayWritingModeMap_has_wrong_size); |
63 | 64 |
64 static const CSSValueID displayAlignmentMap[] = { | 65 static const CSSValueID displayAlignmentMap[] = { |
65 CSSValueStart, CSSValueCenter, CSSValueEnd, CSSValueLeft, CSSValueRight | 66 CSSValueStart, CSSValueCenter, CSSValueEnd, CSSValueLeft, CSSValueRight |
66 }; | 67 }; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 , m_text(text) | 206 , m_text(text) |
206 , m_linePosition(undefinedPosition) | 207 , m_linePosition(undefinedPosition) |
207 , m_computedLinePosition(undefinedPosition) | 208 , m_computedLinePosition(undefinedPosition) |
208 , m_textPosition(50) | 209 , m_textPosition(50) |
209 , m_cueSize(100) | 210 , m_cueSize(100) |
210 , m_writingDirection(Horizontal) | 211 , m_writingDirection(Horizontal) |
211 , m_cueAlignment(Middle) | 212 , m_cueAlignment(Middle) |
212 , m_vttNodeTree(0) | 213 , m_vttNodeTree(0) |
213 , m_cueBackgroundBox(HTMLDivElement::create(document)) | 214 , m_cueBackgroundBox(HTMLDivElement::create(document)) |
214 , m_displayDirection(CSSValueLtr) | 215 , m_displayDirection(CSSValueLtr) |
| 216 , m_displaySize(undefinedSize) |
215 , m_snapToLines(true) | 217 , m_snapToLines(true) |
216 , m_displayTreeShouldChange(true) | 218 , m_displayTreeShouldChange(true) |
217 , m_notifyRegion(true) | 219 , m_notifyRegion(true) |
218 { | 220 { |
219 ScriptWrappable::init(this); | 221 ScriptWrappable::init(this); |
220 } | 222 } |
221 | 223 |
222 VTTCue::~VTTCue() | 224 VTTCue::~VTTCue() |
223 { | 225 { |
224 displayTreeInternal()->remove(ASSERT_NO_EXCEPTION); | 226 displayTreeInternal()->remove(ASSERT_NO_EXCEPTION); |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 return m_displayDirection; | 1040 return m_displayDirection; |
1039 } | 1041 } |
1040 | 1042 |
1041 CSSValueID VTTCue::getCSSWritingMode() const | 1043 CSSValueID VTTCue::getCSSWritingMode() const |
1042 { | 1044 { |
1043 return displayWritingModeMap[m_writingDirection]; | 1045 return displayWritingModeMap[m_writingDirection]; |
1044 } | 1046 } |
1045 | 1047 |
1046 int VTTCue::getCSSSize() const | 1048 int VTTCue::getCSSSize() const |
1047 { | 1049 { |
| 1050 ASSERT(m_displaySize != undefinedSize); |
1048 return m_displaySize; | 1051 return m_displaySize; |
1049 } | 1052 } |
1050 | 1053 |
1051 std::pair<double, double> VTTCue::getCSSPosition() const | 1054 std::pair<double, double> VTTCue::getCSSPosition() const |
1052 { | 1055 { |
1053 if (!m_snapToLines) | 1056 if (!m_snapToLines) |
1054 return getPositionCoordinates(); | 1057 return getPositionCoordinates(); |
1055 | 1058 |
1056 return m_displayPosition; | 1059 return m_displayPosition; |
1057 } | 1060 } |
1058 | 1061 |
1059 ExecutionContext* VTTCue::executionContext() const | 1062 ExecutionContext* VTTCue::executionContext() const |
1060 { | 1063 { |
1061 ASSERT(m_cueBackgroundBox); | 1064 ASSERT(m_cueBackgroundBox); |
1062 return m_cueBackgroundBox->executionContext(); | 1065 return m_cueBackgroundBox->executionContext(); |
1063 } | 1066 } |
1064 | 1067 |
1065 Document& VTTCue::document() const | 1068 Document& VTTCue::document() const |
1066 { | 1069 { |
1067 ASSERT(m_cueBackgroundBox); | 1070 ASSERT(m_cueBackgroundBox); |
1068 return m_cueBackgroundBox->document(); | 1071 return m_cueBackgroundBox->document(); |
1069 } | 1072 } |
1070 | 1073 |
1071 } // namespace WebCore | 1074 } // namespace WebCore |
OLD | NEW |