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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "core/rendering/RenderVTTCue.h" | 49 #include "core/rendering/RenderVTTCue.h" |
50 #include "platform/FloatConversion.h" | 50 #include "platform/FloatConversion.h" |
51 #include "platform/RuntimeEnabledFeatures.h" | 51 #include "platform/RuntimeEnabledFeatures.h" |
52 #include "platform/text/BidiResolver.h" | 52 #include "platform/text/BidiResolver.h" |
53 #include "platform/text/TextRunIterator.h" | 53 #include "platform/text/TextRunIterator.h" |
54 #include "wtf/MathExtras.h" | 54 #include "wtf/MathExtras.h" |
55 #include "wtf/text/StringBuilder.h" | 55 #include "wtf/text/StringBuilder.h" |
56 | 56 |
57 namespace blink { | 57 namespace blink { |
58 | 58 |
59 static const float undefinedSize = -1; | |
60 | |
61 static const CSSValueID displayWritingModeMap[] = { | 59 static const CSSValueID displayWritingModeMap[] = { |
62 CSSValueHorizontalTb, CSSValueVerticalRl, CSSValueVerticalLr | 60 CSSValueHorizontalTb, CSSValueVerticalRl, CSSValueVerticalLr |
63 }; | 61 }; |
64 static_assert(WTF_ARRAY_LENGTH(displayWritingModeMap) == VTTCue::NumberOfWriting
Directions, | 62 static_assert(WTF_ARRAY_LENGTH(displayWritingModeMap) == VTTCue::NumberOfWriting
Directions, |
65 "displayWritingModeMap should have the same number of elements as VTTCue::Nu
mberOfWritingDirections"); | 63 "displayWritingModeMap should have the same number of elements as VTTCue::Nu
mberOfWritingDirections"); |
66 | 64 |
67 static const CSSValueID displayAlignmentMap[] = { | 65 static const CSSValueID displayAlignmentMap[] = { |
68 CSSValueStart, CSSValueCenter, CSSValueEnd, CSSValueLeft, CSSValueRight | 66 CSSValueStart, CSSValueCenter, CSSValueEnd, CSSValueLeft, CSSValueRight |
69 }; | 67 }; |
70 static_assert(WTF_ARRAY_LENGTH(displayAlignmentMap) == VTTCue::NumberOfAlignment
s, | 68 static_assert(WTF_ARRAY_LENGTH(displayAlignmentMap) == VTTCue::NumberOfAlignment
s, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 , m_text(text) | 222 , m_text(text) |
225 , m_linePosition(std::numeric_limits<float>::quiet_NaN()) | 223 , m_linePosition(std::numeric_limits<float>::quiet_NaN()) |
226 , m_computedLinePosition(std::numeric_limits<float>::quiet_NaN()) | 224 , m_computedLinePosition(std::numeric_limits<float>::quiet_NaN()) |
227 , m_textPosition(50) | 225 , m_textPosition(50) |
228 , m_cueSize(100) | 226 , m_cueSize(100) |
229 , m_writingDirection(Horizontal) | 227 , m_writingDirection(Horizontal) |
230 , m_cueAlignment(Middle) | 228 , m_cueAlignment(Middle) |
231 , m_vttNodeTree(nullptr) | 229 , m_vttNodeTree(nullptr) |
232 , m_cueBackgroundBox(HTMLDivElement::create(document)) | 230 , m_cueBackgroundBox(HTMLDivElement::create(document)) |
233 , m_displayDirection(CSSValueLtr) | 231 , m_displayDirection(CSSValueLtr) |
234 , m_displaySize(undefinedSize) | 232 , m_displaySize(std::numeric_limits<float>::quiet_NaN()) |
235 , m_snapToLines(true) | 233 , m_snapToLines(true) |
236 , m_displayTreeShouldChange(true) | 234 , m_displayTreeShouldChange(true) |
237 , m_notifyRegion(true) | 235 , m_notifyRegion(true) |
238 { | 236 { |
239 UseCounter::count(document, UseCounter::VTTCue); | 237 UseCounter::count(document, UseCounter::VTTCue); |
240 } | 238 } |
241 | 239 |
242 VTTCue::~VTTCue() | 240 VTTCue::~VTTCue() |
243 { | 241 { |
244 // Using oilpan, if m_displayTree is in the document it will strongly keep | 242 // Using oilpan, if m_displayTree is in the document it will strongly keep |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 return m_displayDirection; | 1096 return m_displayDirection; |
1099 } | 1097 } |
1100 | 1098 |
1101 CSSValueID VTTCue::getCSSWritingMode() const | 1099 CSSValueID VTTCue::getCSSWritingMode() const |
1102 { | 1100 { |
1103 return displayWritingModeMap[m_writingDirection]; | 1101 return displayWritingModeMap[m_writingDirection]; |
1104 } | 1102 } |
1105 | 1103 |
1106 float VTTCue::getCSSSize() const | 1104 float VTTCue::getCSSSize() const |
1107 { | 1105 { |
1108 ASSERT(m_displaySize != undefinedSize); | 1106 ASSERT(std::isfinite(m_displaySize)); |
1109 return m_displaySize; | 1107 return m_displaySize; |
1110 } | 1108 } |
1111 | 1109 |
1112 FloatPoint VTTCue::getCSSPosition() const | 1110 FloatPoint VTTCue::getCSSPosition() const |
1113 { | 1111 { |
1114 if (!m_snapToLines) | 1112 if (!m_snapToLines) |
1115 return getPositionCoordinates(); | 1113 return getPositionCoordinates(); |
1116 | 1114 |
1117 return m_displayPosition; | 1115 return m_displayPosition; |
1118 } | 1116 } |
(...skipping 12 matching lines...) Expand all Loading... |
1131 | 1129 |
1132 void VTTCue::trace(Visitor* visitor) | 1130 void VTTCue::trace(Visitor* visitor) |
1133 { | 1131 { |
1134 visitor->trace(m_vttNodeTree); | 1132 visitor->trace(m_vttNodeTree); |
1135 visitor->trace(m_cueBackgroundBox); | 1133 visitor->trace(m_cueBackgroundBox); |
1136 visitor->trace(m_displayTree); | 1134 visitor->trace(m_displayTree); |
1137 TextTrackCue::trace(visitor); | 1135 TextTrackCue::trace(visitor); |
1138 } | 1136 } |
1139 | 1137 |
1140 } // namespace blink | 1138 } // namespace blink |
OLD | NEW |