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

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

Issue 55653003: Rename TextTrackRegion/TextTrackRegionList to VTTRegion/VTTRegionList (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update test expectations Created 7 years, 1 month 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
« no previous file with comments | « Source/core/html/track/TextTrackCue.cpp ('k') | Source/core/html/track/TextTrackRegion.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef TextTrackRegion_h
32 #define TextTrackRegion_h
33
34 #include "core/dom/ContextLifecycleObserver.h"
35 #include "core/html/track/TextTrack.h"
36 #include "platform/Timer.h"
37 #include "platform/geometry/FloatPoint.h"
38 #include "wtf/PassOwnPtr.h"
39 #include "wtf/RefCounted.h"
40
41 namespace WebCore {
42
43 class ExceptionState;
44 class HTMLDivElement;
45 class TextTrackCueBox;
46
47 class TextTrackRegion : public RefCounted<TextTrackRegion> {
48 public:
49 static PassRefPtr<TextTrackRegion> create()
50 {
51 return adoptRef(new TextTrackRegion());
52 }
53
54 virtual ~TextTrackRegion();
55
56 TextTrack* track() const { return m_track; }
57 void setTrack(TextTrack*);
58
59 const String& id() const { return m_id; }
60 void setId(const String&);
61
62 double width() const { return m_width; }
63 void setWidth(double, ExceptionState&);
64
65 long height() const { return m_heightInLines; }
66 void setHeight(long, ExceptionState&);
67
68 double regionAnchorX() const { return m_regionAnchor.x(); }
69 void setRegionAnchorX(double, ExceptionState&);
70
71 double regionAnchorY() const { return m_regionAnchor.y(); }
72 void setRegionAnchorY(double, ExceptionState&);
73
74 double viewportAnchorX() const { return m_viewportAnchor.x(); }
75 void setViewportAnchorX(double, ExceptionState&);
76
77 double viewportAnchorY() const { return m_viewportAnchor.y(); }
78 void setViewportAnchorY(double, ExceptionState&);
79
80 const AtomicString scroll() const;
81 void setScroll(const AtomicString&, ExceptionState&);
82
83 void updateParametersFromRegion(TextTrackRegion*);
84
85 const String& regionSettings() const { return m_settings; }
86 void setRegionSettings(const String&);
87
88 bool isScrollingRegion() { return m_scroll; }
89
90 PassRefPtr<HTMLDivElement> getDisplayTree(Document&);
91
92 void appendTextTrackCueBox(PassRefPtr<TextTrackCueBox>);
93 void displayLastTextTrackCueBox();
94 void willRemoveTextTrackCueBox(TextTrackCueBox*);
95
96 private:
97 TextTrackRegion();
98
99 void prepareRegionDisplayTree();
100
101 // The timer is needed to continue processing when cue scrolling ended.
102 void startTimer();
103 void stopTimer();
104 void scrollTimerFired(Timer<TextTrackRegion>*);
105
106 enum RegionSetting {
107 None,
108 Id,
109 Width,
110 Height,
111 RegionAnchor,
112 ViewportAnchor,
113 Scroll
114 };
115 RegionSetting getSettingFromString(const String&);
116 void parseSettingValue(RegionSetting, const String&);
117 void parseSetting(const String&, unsigned*);
118
119 static const AtomicString& textTrackCueContainerShadowPseudoId();
120 static const AtomicString& textTrackCueContainerScrollingClass();
121 static const AtomicString& textTrackRegionShadowPseudoId();
122
123 String m_id;
124 String m_settings;
125 double m_width;
126 unsigned m_heightInLines;
127 FloatPoint m_regionAnchor;
128 FloatPoint m_viewportAnchor;
129 bool m_scroll;
130
131 // The cue container is the container that is scrolled up to obtain the
132 // effect of scrolling cues when this is enabled for the regions.
133 RefPtr<HTMLDivElement> m_cueContainer;
134 RefPtr<HTMLDivElement> m_regionDisplayTree;
135
136 // The member variable track can be a raw pointer as it will never
137 // reference a destroyed TextTrack, as this member variable
138 // is cleared in the TextTrack destructor and it is generally
139 // set/reset within the addRegion and removeRegion methods.
140 TextTrack* m_track;
141
142 // Keep track of the current numeric value of the css "top" property.
143 double m_currentTop;
144
145 // The timer is used to display the next cue line after the current one has
146 // been displayed. It's main use is for scrolling regions and it triggers as
147 // soon as the animation for rolling out one line has finished, but
148 // currently it is used also for non-scrolling regions to use a single
149 // code path.
150 Timer<TextTrackRegion> m_scrollTimer;
151 };
152
153 } // namespace WebCore
154 #endif
OLDNEW
« no previous file with comments | « Source/core/html/track/TextTrackCue.cpp ('k') | Source/core/html/track/TextTrackRegion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698