Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 | 29 |
| 30 #ifndef VTTCue_h | 30 #ifndef VTTCue_h |
| 31 #define VTTCue_h | 31 #define VTTCue_h |
| 32 | 32 |
| 33 #include "core/html/track/TextTrackCue.h" | 33 #include "core/html/track/TextTrackCue.h" |
| 34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class Document; | 38 class Document; |
| 39 class DoubleOrString; | |
| 39 class ExecutionContext; | 40 class ExecutionContext; |
| 40 class VTTCue; | 41 class VTTCue; |
| 41 class VTTScanner; | 42 class VTTScanner; |
| 42 | 43 |
| 43 class VTTCueBox final : public HTMLDivElement { | 44 class VTTCueBox final : public HTMLDivElement { |
| 44 public: | 45 public: |
| 45 static PassRefPtrWillBeRawPtr<VTTCueBox> create(Document& document, VTTCue* cue) | 46 static PassRefPtrWillBeRawPtr<VTTCueBox> create(Document& document, VTTCue* cue) |
| 46 { | 47 { |
| 47 return adoptRefWillBeNoop(new VTTCueBox(document, cue)); | 48 return adoptRefWillBeNoop(new VTTCueBox(document, cue)); |
| 48 } | 49 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 72 | 73 |
| 73 const String& vertical() const; | 74 const String& vertical() const; |
| 74 void setVertical(const String&); | 75 void setVertical(const String&); |
| 75 | 76 |
| 76 bool snapToLines() const { return m_snapToLines; } | 77 bool snapToLines() const { return m_snapToLines; } |
| 77 void setSnapToLines(bool); | 78 void setSnapToLines(bool); |
| 78 | 79 |
| 79 int line() const { return m_linePosition; } | 80 int line() const { return m_linePosition; } |
| 80 void setLine(int, ExceptionState&); | 81 void setLine(int, ExceptionState&); |
| 81 | 82 |
| 82 int position() const { return m_textPosition; } | 83 void position(DoubleOrString&) const; |
| 83 void setPosition(int, ExceptionState&); | 84 void setPosition(const DoubleOrString&, ExceptionState&); |
| 84 | 85 |
| 85 int size() const { return m_cueSize; } | 86 int size() const { return m_cueSize; } |
| 86 void setSize(int, ExceptionState&); | 87 void setSize(int, ExceptionState&); |
| 87 | 88 |
| 88 const String& align() const; | 89 const String& align() const; |
| 89 void setAlign(const String&); | 90 void setAlign(const String&); |
| 90 | 91 |
| 91 const String& text() const { return m_text; } | 92 const String& text() const { return m_text; } |
| 92 void setText(const String&); | 93 void setText(const String&); |
| 93 | 94 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 PassRefPtrWillBeRawPtr<VTTCueBox> getDisplayTree(const IntSize& videoSize); | 152 PassRefPtrWillBeRawPtr<VTTCueBox> getDisplayTree(const IntSize& videoSize); |
| 152 | 153 |
| 153 virtual void cueDidChange() override; | 154 virtual void cueDidChange() override; |
| 154 | 155 |
| 155 void createVTTNodeTree(); | 156 void createVTTNodeTree(); |
| 156 void copyVTTNodeToDOMTree(ContainerNode* vttNode, ContainerNode* root); | 157 void copyVTTNodeToDOMTree(ContainerNode* vttNode, ContainerNode* root); |
| 157 | 158 |
| 158 std::pair<double, double> getPositionCoordinates() const; | 159 std::pair<double, double> getPositionCoordinates() const; |
| 159 | 160 |
| 160 void calculateDisplayParameters(); | 161 void calculateDisplayParameters(); |
| 162 int calculateComputedTextPosition() const; | |
| 163 bool textPositionIsAuto() const; | |
| 161 | 164 |
| 162 enum CueSetting { | 165 enum CueSetting { |
| 163 None, | 166 None, |
| 164 Vertical, | 167 Vertical, |
| 165 Line, | 168 Line, |
| 166 Position, | 169 Position, |
| 167 Size, | 170 Size, |
| 168 Align, | 171 Align, |
| 169 RegionId | 172 RegionId |
| 170 }; | 173 }; |
| 171 CueSetting settingName(VTTScanner&); | 174 CueSetting settingName(VTTScanner&); |
| 172 | 175 |
| 173 String m_text; | 176 String m_text; |
| 174 int m_linePosition; | 177 int m_linePosition; |
| 175 int m_computedLinePosition; | 178 int m_computedLinePosition; |
| 176 int m_textPosition; | 179 float m_textPosition; |
|
philipj_slow
2015/01/15 09:08:57
Can you add a test that sets position to a value t
fs
2015/01/15 10:07:16
Are you saying that you want me to convert this to
philipj_slow
2015/01/19 14:44:26
I don't know what I want, in https://www.w3.org/Bu
fs
2015/01/19 15:09:05
I've gone with floats for now and added a test as
| |
| 177 int m_cueSize; | 180 int m_cueSize; |
| 178 WritingDirection m_writingDirection; | 181 WritingDirection m_writingDirection; |
| 179 CueAlignment m_cueAlignment; | 182 CueAlignment m_cueAlignment; |
| 180 String m_regionId; | 183 String m_regionId; |
| 181 | 184 |
| 182 RefPtrWillBeMember<DocumentFragment> m_vttNodeTree; | 185 RefPtrWillBeMember<DocumentFragment> m_vttNodeTree; |
| 183 RefPtrWillBeMember<HTMLDivElement> m_cueBackgroundBox; | 186 RefPtrWillBeMember<HTMLDivElement> m_cueBackgroundBox; |
| 184 RefPtrWillBeMember<VTTCueBox> m_displayTree; | 187 RefPtrWillBeMember<VTTCueBox> m_displayTree; |
| 185 | 188 |
| 186 CSSValueID m_displayDirection; | 189 CSSValueID m_displayDirection; |
| 187 int m_displaySize; | 190 int m_displaySize; |
| 188 std::pair<float, float> m_displayPosition; | 191 std::pair<float, float> m_displayPosition; |
| 189 | 192 |
| 190 bool m_snapToLines : 1; | 193 bool m_snapToLines : 1; |
| 191 bool m_displayTreeShouldChange : 1; | 194 bool m_displayTreeShouldChange : 1; |
| 192 bool m_notifyRegion : 1; | 195 bool m_notifyRegion : 1; |
| 193 }; | 196 }; |
| 194 | 197 |
| 195 // VTTCue is currently the only TextTrackCue subclass. | 198 // VTTCue is currently the only TextTrackCue subclass. |
| 196 DEFINE_TYPE_CASTS(VTTCue, TextTrackCue, cue, true, true); | 199 DEFINE_TYPE_CASTS(VTTCue, TextTrackCue, cue, true, true); |
| 197 | 200 |
| 198 } // namespace blink | 201 } // namespace blink |
| 199 | 202 |
| 200 #endif // VTTCue_h | 203 #endif // VTTCue_h |
| OLD | NEW |