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 29 matching lines...) Expand all Loading... |
40 class ExecutionContext; | 40 class ExecutionContext; |
41 class VTTCue; | 41 class VTTCue; |
42 class VTTScanner; | 42 class VTTScanner; |
43 | 43 |
44 struct VTTDisplayParameters { | 44 struct VTTDisplayParameters { |
45 VTTDisplayParameters(); | 45 VTTDisplayParameters(); |
46 | 46 |
47 FloatPoint position; | 47 FloatPoint position; |
48 float size; | 48 float size; |
49 CSSValueID direction; | 49 CSSValueID direction; |
| 50 CSSValueID textAlign; |
50 CSSValueID writingMode; | 51 CSSValueID writingMode; |
| 52 |
| 53 float snapToLinesPosition; |
51 }; | 54 }; |
52 | 55 |
53 class VTTCueBox final : public HTMLDivElement { | 56 class VTTCueBox final : public HTMLDivElement { |
54 public: | 57 public: |
55 static PassRefPtrWillBeRawPtr<VTTCueBox> create(Document& document, VTTCue*
cue) | 58 static PassRefPtrWillBeRawPtr<VTTCueBox> create(Document& document) |
56 { | 59 { |
57 return adoptRefWillBeNoop(new VTTCueBox(document, cue)); | 60 return adoptRefWillBeNoop(new VTTCueBox(document)); |
58 } | 61 } |
59 | 62 |
60 VTTCue* getCue() const { return m_cue; } | |
61 void applyCSSProperties(const VTTDisplayParameters&); | 63 void applyCSSProperties(const VTTDisplayParameters&); |
62 | 64 |
63 DECLARE_VIRTUAL_TRACE(); | |
64 | |
65 private: | 65 private: |
66 VTTCueBox(Document&, VTTCue*); | 66 VTTCueBox(Document&); |
67 | 67 |
68 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 68 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
69 | 69 |
70 RawPtrWillBeMember<VTTCue> m_cue; | 70 // The computed line position for snap-to-lines layout, and NaN for |
| 71 // non-snap-to-lines layout where no adjustment should take place. |
| 72 // This is set in applyCSSProperties and propagated to LayoutVTTCue. |
| 73 float m_snapToLinesPosition; |
71 }; | 74 }; |
72 | 75 |
73 class VTTCue final : public TextTrackCue { | 76 class VTTCue final : public TextTrackCue { |
74 DEFINE_WRAPPERTYPEINFO(); | 77 DEFINE_WRAPPERTYPEINFO(); |
75 public: | 78 public: |
76 static PassRefPtrWillBeRawPtr<VTTCue> create(Document& document, double star
tTime, double endTime, const String& text) | 79 static PassRefPtrWillBeRawPtr<VTTCue> create(Document& document, double star
tTime, double endTime, const String& text) |
77 { | 80 { |
78 return adoptRefWillBeNoop(new VTTCue(document, startTime, endTime, text)
); | 81 return adoptRefWillBeNoop(new VTTCue(document, startTime, endTime, text)
); |
79 } | 82 } |
80 | 83 |
81 ~VTTCue() override; | |
82 | |
83 const String& vertical() const; | 84 const String& vertical() const; |
84 void setVertical(const String&); | 85 void setVertical(const String&); |
85 | 86 |
86 bool snapToLines() const { return m_snapToLines; } | 87 bool snapToLines() const { return m_snapToLines; } |
87 void setSnapToLines(bool); | 88 void setSnapToLines(bool); |
88 | 89 |
89 void line(DoubleOrAutoKeyword&) const; | 90 void line(DoubleOrAutoKeyword&) const; |
90 void setLine(const DoubleOrAutoKeyword&); | 91 void setLine(const DoubleOrAutoKeyword&); |
91 | 92 |
92 void position(DoubleOrAutoKeyword&) const; | 93 void position(DoubleOrAutoKeyword&) const; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 bool m_snapToLines : 1; | 191 bool m_snapToLines : 1; |
191 bool m_displayTreeShouldChange : 1; | 192 bool m_displayTreeShouldChange : 1; |
192 }; | 193 }; |
193 | 194 |
194 // VTTCue is currently the only TextTrackCue subclass. | 195 // VTTCue is currently the only TextTrackCue subclass. |
195 DEFINE_TYPE_CASTS(VTTCue, TextTrackCue, cue, true, true); | 196 DEFINE_TYPE_CASTS(VTTCue, TextTrackCue, cue, true, true); |
196 | 197 |
197 } // namespace blink | 198 } // namespace blink |
198 | 199 |
199 #endif // VTTCue_h | 200 #endif // VTTCue_h |
OLD | NEW |