OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) | 2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) |
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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/rendering/RenderVTTCue.h" | 27 #include "core/rendering/RenderVTTCue.h" |
28 | 28 |
29 #include "core/html/track/vtt/VTTCue.h" | 29 #include "core/html/track/vtt/VTTCue.h" |
30 #include "core/rendering/RenderView.h" | 30 #include "core/rendering/LayoutState.h" |
| 31 #include "core/rendering/RenderInline.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 RenderVTTCue::RenderVTTCue(VTTCueBox* element) | 35 RenderVTTCue::RenderVTTCue(VTTCueBox* element) |
35 : RenderBlockFlow(element) | 36 : RenderBlockFlow(element) |
36 , m_cue(element->getCue()) | 37 , m_cue(element->getCue()) |
37 { | 38 { |
38 } | 39 } |
39 | 40 |
40 void RenderVTTCue::trace(Visitor* visitor) | 41 void RenderVTTCue::trace(Visitor* visitor) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (m_cue->getWritingDirection() == VTTCue::Horizontal) { | 123 if (m_cue->getWritingDirection() == VTTCue::Horizontal) { |
123 // Horizontal: ... down by the distance given by position | 124 // Horizontal: ... down by the distance given by position |
124 setY(location().y() + position); | 125 setY(location().y() + position); |
125 } else { | 126 } else { |
126 // Vertical: ... right by the distance given by position | 127 // Vertical: ... right by the distance given by position |
127 setX(location().x() + position); | 128 setX(location().x() + position); |
128 } | 129 } |
129 | 130 |
130 // 9. Default: Remember the position of all the boxes in boxes as their | 131 // 9. Default: Remember the position of all the boxes in boxes as their |
131 // default position. | 132 // default position. |
132 // FIXME: Why the direct conversion between float and LayoutUnit? crbug.com/
350474 | 133 m_defaultPosition = location(); |
133 m_fallbackPosition = FloatPoint(location()); | |
134 | 134 |
135 // 10. Let switched be false. | 135 // 10. Let switched be false. |
136 switched = false; | 136 switched = false; |
137 } | 137 } |
138 | 138 |
139 bool RenderVTTCue::isOutside() const | 139 bool RenderVTTCue::isOutside() const |
140 { | 140 { |
141 return !containingBlock()->absoluteBoundingBoxRect().contains(absoluteConten
tBox()); | 141 return !containingBlock()->absoluteBoundingBoxRect().contains(absoluteConten
tBox()); |
142 } | 142 } |
143 | 143 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // given by step. (If step is negative, then this will actually | 193 // given by step. (If step is negative, then this will actually |
194 // result in a leftwards movement of the boxes in absolute terms.) | 194 // result in a leftwards movement of the boxes in absolute terms.) |
195 else | 195 else |
196 setX(location().x() + step); | 196 setX(location().x() + step); |
197 } | 197 } |
198 | 198 |
199 bool RenderVTTCue::switchDirection(bool& switched, LayoutUnit& step) | 199 bool RenderVTTCue::switchDirection(bool& switched, LayoutUnit& step) |
200 { | 200 { |
201 // 15. Switch direction: Move all the boxes in boxes back to their | 201 // 15. Switch direction: Move all the boxes in boxes back to their |
202 // default position as determined in the step above labeled default. | 202 // default position as determined in the step above labeled default. |
203 setX(m_fallbackPosition.x()); | 203 setLocation(m_defaultPosition); |
204 setY(m_fallbackPosition.y()); | |
205 | 204 |
206 // 16. If switched is true, jump to the step labeled done | 205 // 16. If switched is true, jump to the step labeled done |
207 // positioning below. | 206 // positioning below. |
208 if (switched) | 207 if (switched) |
209 return false; | 208 return false; |
210 | 209 |
211 // 17. Negate step. | 210 // 17. Negate step. |
212 step = -step; | 211 step = -step; |
213 | 212 |
214 // 18. Set switched to true. | 213 // 18. Set switched to true. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 265 } |
267 } | 266 } |
268 | 267 |
269 void RenderVTTCue::repositionCueSnapToLinesNotSet() | 268 void RenderVTTCue::repositionCueSnapToLinesNotSet() |
270 { | 269 { |
271 // FIXME: Implement overlapping detection when snap-to-lines is not set. htt
p://wkb.ug/84296 | 270 // FIXME: Implement overlapping detection when snap-to-lines is not set. htt
p://wkb.ug/84296 |
272 } | 271 } |
273 | 272 |
274 } // namespace blink | 273 } // namespace blink |
275 | 274 |
OLD | NEW |