Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: Source/core/html/track/TextTrackCue.h

Issue 26878003: Reduce repetitive EventTarget subclassing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/MediaController.h ('k') | Source/core/html/track/TextTrackCue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 protected: 62 protected:
63 TextTrackCueBox(Document&, TextTrackCue*); 63 TextTrackCueBox(Document&, TextTrackCue*);
64 64
65 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; 65 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
66 66
67 TextTrackCue* m_cue; 67 TextTrackCue* m_cue;
68 }; 68 };
69 69
70 // ---------------------------- 70 // ----------------------------
71 71
72 class TextTrackCue : public RefCounted<TextTrackCue>, public ScriptWrappable, pu blic EventTarget { 72 class TextTrackCue : public RefCounted<TextTrackCue>, public ScriptWrappable, pu blic EventTargetWithInlineData {
73 public: 73 public:
74 static PassRefPtr<TextTrackCue> create(ScriptExecutionContext* context, doub le start, double end, const String& content) 74 static PassRefPtr<TextTrackCue> create(ScriptExecutionContext* context, doub le start, double end, const String& content)
75 { 75 {
76 return adoptRef(new TextTrackCue(context, start, end, content)); 76 return adoptRef(new TextTrackCue(context, start, end, content));
77 } 77 }
78 78
79 static const AtomicString& cueShadowPseudoId() 79 static const AtomicString& cueShadowPseudoId()
80 { 80 {
81 DEFINE_STATIC_LOCAL(const AtomicString, cue, ("cue", AtomicString::Const ructFromLiteral)); 81 DEFINE_STATIC_LOCAL(const AtomicString, cue, ("cue", AtomicString::Const ructFromLiteral));
82 return cue; 82 return cue;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool hasDisplayTree() const { return m_displayTree; } 143 bool hasDisplayTree() const { return m_displayTree; }
144 PassRefPtr<TextTrackCueBox> getDisplayTree(const IntSize& videoSize); 144 PassRefPtr<TextTrackCueBox> getDisplayTree(const IntSize& videoSize);
145 PassRefPtr<HTMLDivElement> element() const { return m_cueBackgroundBox; } 145 PassRefPtr<HTMLDivElement> element() const { return m_cueBackgroundBox; }
146 146
147 void updateDisplayTree(double); 147 void updateDisplayTree(double);
148 void removeDisplayTree(); 148 void removeDisplayTree();
149 void markFutureAndPastNodes(ContainerNode*, double, double); 149 void markFutureAndPastNodes(ContainerNode*, double, double);
150 150
151 int calculateComputedLinePosition(); 151 int calculateComputedLinePosition();
152 152
153 virtual const AtomicString& interfaceName() const; 153 virtual const AtomicString& interfaceName() const OVERRIDE;
154 virtual ScriptExecutionContext* scriptExecutionContext() const; 154 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
155 155
156 std::pair<double, double> getCSSPosition() const; 156 std::pair<double, double> getCSSPosition() const;
157 157
158 CSSValueID getCSSAlignment() const; 158 CSSValueID getCSSAlignment() const;
159 int getCSSSize() const; 159 int getCSSSize() const;
160 CSSValueID getCSSWritingDirection() const; 160 CSSValueID getCSSWritingDirection() const;
161 CSSValueID getCSSWritingMode() const; 161 CSSValueID getCSSWritingMode() const;
162 162
163 enum WritingDirection { 163 enum WritingDirection {
164 Horizontal = 0, 164 Horizontal = 0,
(...skipping 27 matching lines...) Expand all
192 }; 192 };
193 virtual CueType cueType() const { return WebVTT; } 193 virtual CueType cueType() const { return WebVTT; }
194 194
195 DEFINE_ATTRIBUTE_EVENT_LISTENER(enter); 195 DEFINE_ATTRIBUTE_EVENT_LISTENER(enter);
196 DEFINE_ATTRIBUTE_EVENT_LISTENER(exit); 196 DEFINE_ATTRIBUTE_EVENT_LISTENER(exit);
197 197
198 using RefCounted<TextTrackCue>::ref; 198 using RefCounted<TextTrackCue>::ref;
199 using RefCounted<TextTrackCue>::deref; 199 using RefCounted<TextTrackCue>::deref;
200 200
201 protected: 201 protected:
202 virtual EventTargetData* eventTargetData();
203 virtual EventTargetData* ensureEventTargetData();
204
205 TextTrackCue(ScriptExecutionContext*, double start, double end, const String & content); 202 TextTrackCue(ScriptExecutionContext*, double start, double end, const String & content);
206 203
207 Document* ownerDocument() { return toDocument(m_scriptExecutionContext); } 204 Document* ownerDocument() { return toDocument(m_scriptExecutionContext); }
208 205
209 virtual PassRefPtr<TextTrackCueBox> createDisplayTree(); 206 virtual PassRefPtr<TextTrackCueBox> createDisplayTree();
210 PassRefPtr<TextTrackCueBox> displayTreeInternal(); 207 PassRefPtr<TextTrackCueBox> displayTreeInternal();
211 208
212 private: 209 private:
213 void createWebVTTNodeTree(); 210 void createWebVTTNodeTree();
214 void copyWebVTTNodeToDOMTree(ContainerNode* WebVTTNode, ContainerNode* root) ; 211 void copyWebVTTNodeToDOMTree(ContainerNode* WebVTTNode, ContainerNode* root) ;
215 212
216 std::pair<double, double> getPositionCoordinates() const; 213 std::pair<double, double> getPositionCoordinates() const;
217 void parseSettings(const String&); 214 void parseSettings(const String&);
218 215
219 void determineTextDirection(); 216 void determineTextDirection();
220 void calculateDisplayParameters(); 217 void calculateDisplayParameters();
221 218
222 void cueWillChange(); 219 void cueWillChange();
223 void cueDidChange(); 220 void cueDidChange();
224 221
225 virtual void refEventTarget() { ref(); } 222 virtual void refEventTarget() OVERRIDE { ref(); }
226 virtual void derefEventTarget() { deref(); } 223 virtual void derefEventTarget() OVERRIDE { deref(); }
227 224
228 enum CueSetting { 225 enum CueSetting {
229 None, 226 None,
230 Vertical, 227 Vertical,
231 Line, 228 Line,
232 Position, 229 Position,
233 Size, 230 Size,
234 Align, 231 Align,
235 #if ENABLE(WEBVTT_REGIONS) 232 #if ENABLE(WEBVTT_REGIONS)
236 RegionId 233 RegionId
(...skipping 12 matching lines...) Expand all
249 int m_cueSize; 246 int m_cueSize;
250 int m_cueIndex; 247 int m_cueIndex;
251 248
252 WritingDirection m_writingDirection; 249 WritingDirection m_writingDirection;
253 250
254 CueAlignment m_cueAlignment; 251 CueAlignment m_cueAlignment;
255 252
256 RefPtr<DocumentFragment> m_webVTTNodeTree; 253 RefPtr<DocumentFragment> m_webVTTNodeTree;
257 TextTrack* m_track; 254 TextTrack* m_track;
258 255
259 EventTargetData m_eventTargetData;
260 ScriptExecutionContext* m_scriptExecutionContext; 256 ScriptExecutionContext* m_scriptExecutionContext;
261 257
262 bool m_isActive; 258 bool m_isActive;
263 bool m_pauseOnExit; 259 bool m_pauseOnExit;
264 bool m_snapToLines; 260 bool m_snapToLines;
265 261
266 RefPtr<HTMLDivElement> m_cueBackgroundBox; 262 RefPtr<HTMLDivElement> m_cueBackgroundBox;
267 263
268 bool m_displayTreeShouldChange; 264 bool m_displayTreeShouldChange;
269 RefPtr<TextTrackCueBox> m_displayTree; 265 RefPtr<TextTrackCueBox> m_displayTree;
270 266
271 CSSValueID m_displayDirection; 267 CSSValueID m_displayDirection;
272 268
273 int m_displaySize; 269 int m_displaySize;
274 270
275 std::pair<float, float> m_displayPosition; 271 std::pair<float, float> m_displayPosition;
276 #if ENABLE(WEBVTT_REGIONS) 272 #if ENABLE(WEBVTT_REGIONS)
277 String m_regionId; 273 String m_regionId;
278 #endif 274 #endif
279 }; 275 };
280 276
281 } // namespace WebCore 277 } // namespace WebCore
282 278
283 #endif 279 #endif
OLDNEW
« no previous file with comments | « Source/core/html/MediaController.h ('k') | Source/core/html/track/TextTrackCue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698