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 10 matching lines...) Expand all Loading... |
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 | 27 |
28 #include "core/layout/LayoutMedia.h" | 28 #include "core/layout/LayoutMedia.h" |
29 | 29 |
30 #include "core/html/HTMLMediaElement.h" | 30 #include "core/html/HTMLMediaElement.h" |
| 31 #include "core/html/shadow/MediaControls.h" |
31 #include "core/layout/LayoutView.h" | 32 #include "core/layout/LayoutView.h" |
32 | 33 |
33 namespace blink { | 34 namespace blink { |
34 | 35 |
35 LayoutMedia::LayoutMedia(HTMLMediaElement* video) | 36 LayoutMedia::LayoutMedia(HTMLMediaElement* video) |
36 : LayoutImage(video) | 37 : LayoutImage(video) |
37 { | 38 { |
38 setImageResource(LayoutImageResource::create()); | 39 setImageResource(LayoutImageResource::create()); |
39 } | 40 } |
40 | 41 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 LayoutBox* layoutBox = toLayoutBox(child); | 81 LayoutBox* layoutBox = toLayoutBox(child); |
81 layoutBox->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSi
ze(paddingLeft(), paddingTop())); | 82 layoutBox->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSi
ze(paddingLeft(), paddingTop())); |
82 // TODO(philipj): Remove the mutableStyleRef() and depend on CSS | 83 // TODO(philipj): Remove the mutableStyleRef() and depend on CSS |
83 // width/height: inherit to match the media element size. | 84 // width/height: inherit to match the media element size. |
84 layoutBox->mutableStyleRef().setHeight(Length(newSize.height(), Fixed)); | 85 layoutBox->mutableStyleRef().setHeight(Length(newSize.height(), Fixed)); |
85 layoutBox->mutableStyleRef().setWidth(Length(newSize.width(), Fixed)); | 86 layoutBox->mutableStyleRef().setWidth(Length(newSize.width(), Fixed)); |
86 layoutBox->forceLayout(); | 87 layoutBox->forceLayout(); |
87 } | 88 } |
88 | 89 |
89 clearNeedsLayout(); | 90 clearNeedsLayout(); |
| 91 |
| 92 // Notify our MediaControls that a layout has happened. |
| 93 if (mediaElement() && mediaElement()->mediaControls() && newSize.width() !=
oldSize.width()) |
| 94 mediaElement()->mediaControls()->notifyPanelWidthChanged(newSize.width()
.toInt()); |
90 } | 95 } |
91 | 96 |
92 bool LayoutMedia::isChildAllowed(LayoutObject* child, const ComputedStyle&) cons
t | 97 bool LayoutMedia::isChildAllowed(LayoutObject* child, const ComputedStyle&) cons
t |
93 { | 98 { |
94 // Two types of child layout objects are allowed: media controls | 99 // Two types of child layout objects are allowed: media controls |
95 // and the text track container. Filter children by node type. | 100 // and the text track container. Filter children by node type. |
96 ASSERT(child->node()); | 101 ASSERT(child->node()); |
97 | 102 |
98 // The user agent stylesheet (mediaControls.css) has | 103 // The user agent stylesheet (mediaControls.css) has |
99 // ::-webkit-media-controls { display: flex; }. If author style | 104 // ::-webkit-media-controls { display: flex; }. If author style |
100 // sets display: inline we would get an inline layoutObject as a child | 105 // sets display: inline we would get an inline layoutObject as a child |
101 // of replaced content, which is not supposed to be possible. This | 106 // of replaced content, which is not supposed to be possible. This |
102 // check can be removed if ::-webkit-media-controls is made | 107 // check can be removed if ::-webkit-media-controls is made |
103 // internal. | 108 // internal. |
104 if (child->node()->isMediaControls()) | 109 if (child->node()->isMediaControls()) |
105 return child->isFlexibleBox(); | 110 return child->isFlexibleBox(); |
106 | 111 |
107 if (child->node()->isTextTrackContainer()) | 112 if (child->node()->isTextTrackContainer()) |
108 return true; | 113 return true; |
109 | 114 |
110 return false; | 115 return false; |
111 } | 116 } |
112 | 117 |
113 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) | 118 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) |
114 { | 119 { |
115 } | 120 } |
116 | 121 |
117 } // namespace blink | 122 } // namespace blink |
OLD | NEW |