OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void LayoutMedia::layout() | 50 void LayoutMedia::layout() |
51 { | 51 { |
52 LayoutSize oldSize = contentBoxRect().size(); | 52 LayoutSize oldSize = contentBoxRect().size(); |
53 | 53 |
54 LayoutImage::layout(); | 54 LayoutImage::layout(); |
55 | 55 |
56 LayoutSize newSize = contentBoxRect().size(); | 56 LayoutSize newSize = contentBoxRect().size(); |
57 | 57 |
58 LayoutState state(*this, locationOffset()); | 58 LayoutState state(*this, locationOffset()); |
59 | 59 |
60 for (LayoutObject* child = m_children.firstChild(); child; child = child->ne
xtSibling()) { | 60 // Iterate the children in reverse order so that the media controls are laid |
61 ASSERT(child->node()->isMediaControls() || child->node()->isTextTrackCon
tainer()); | 61 // out before the text track container. This is to ensure that the text |
| 62 // track rendering has an up-to-date position of the media controls for |
| 63 // overlap checking, see LayoutVTTCue. |
| 64 #if ENABLE(ASSERT) |
| 65 bool seenTextTrackContainer = false; |
| 66 #endif |
| 67 for (LayoutObject* child = m_children.lastChild(); child; child = child->pre
viousSibling()) { |
| 68 #if ENABLE(ASSERT) |
| 69 if (child->node()->isMediaControls()) |
| 70 ASSERT(!seenTextTrackContainer); |
| 71 else if (child->node()->isTextTrackContainer()) |
| 72 seenTextTrackContainer = true; |
| 73 else |
| 74 ASSERT_NOT_REACHED(); |
| 75 #endif |
62 | 76 |
63 if (newSize == oldSize && !child->needsLayout()) | 77 if (newSize == oldSize && !child->needsLayout()) |
64 continue; | 78 continue; |
65 | 79 |
66 LayoutBox* layoutBox = toLayoutBox(child); | 80 LayoutBox* layoutBox = toLayoutBox(child); |
67 layoutBox->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSi
ze(paddingLeft(), paddingTop())); | 81 layoutBox->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSi
ze(paddingLeft(), paddingTop())); |
68 // TODO(philipj): Remove the mutableStyleRef() and depend on CSS | 82 // TODO(philipj): Remove the mutableStyleRef() and depend on CSS |
69 // width/height: inherit to match the media element size. | 83 // width/height: inherit to match the media element size. |
70 layoutBox->mutableStyleRef().setHeight(Length(newSize.height(), Fixed)); | 84 layoutBox->mutableStyleRef().setHeight(Length(newSize.height(), Fixed)); |
71 layoutBox->mutableStyleRef().setWidth(Length(newSize.width(), Fixed)); | 85 layoutBox->mutableStyleRef().setWidth(Length(newSize.width(), Fixed)); |
(...skipping 22 matching lines...) Expand all Loading... |
94 return true; | 108 return true; |
95 | 109 |
96 return false; | 110 return false; |
97 } | 111 } |
98 | 112 |
99 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) | 113 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) |
100 { | 114 { |
101 } | 115 } |
102 | 116 |
103 } // namespace blink | 117 } // namespace blink |
OLD | NEW |