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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 LayoutRect newRect = contentBoxRect(); | 52 LayoutRect newRect = contentBoxRect(); |
53 | 53 |
54 LayoutState state(*this); | 54 LayoutState state(*this); |
55 | 55 |
56 // Iterate the children in reverse order so that the media controls are laid | 56 // Iterate the children in reverse order so that the media controls are laid |
57 // out before the text track container. This is to ensure that the text | 57 // out before the text track container. This is to ensure that the text |
58 // track rendering has an up-to-date position of the media controls for | 58 // track rendering has an up-to-date position of the media controls for |
59 // overlap checking, see LayoutVTTCue. | 59 // overlap checking, see LayoutVTTCue. |
60 #if DCHECK_IS_ON() | 60 #if DCHECK_IS_ON() |
61 bool seenTextTrackContainer = false; | 61 bool seenTextTrackContainer = false; |
62 bool seenMediaRemotingInterstitial = false; | |
62 #endif | 63 #endif |
63 for (LayoutObject* child = m_children.lastChild(); child; | 64 for (LayoutObject* child = m_children.lastChild(); child; |
64 child = child->previousSibling()) { | 65 child = child->previousSibling()) { |
65 #if DCHECK_IS_ON() | 66 #if DCHECK_IS_ON() |
66 if (child->node()->isMediaControls()) | 67 if (child->node()->isMediaControls()) { |
67 ASSERT(!seenTextTrackContainer); | 68 DCHECK(!seenTextTrackContainer); |
68 else if (child->node()->isTextTrackContainer()) | 69 } else if (child->node()->isTextTrackContainer()) { |
69 seenTextTrackContainer = true; | 70 seenTextTrackContainer = true; |
70 else | 71 DCHECK(!seenMediaRemotingInterstitial); |
72 } else if (child->node()->isMediaRemotingInterstitial()) { | |
73 seenMediaRemotingInterstitial = true; | |
74 } else { | |
71 NOTREACHED(); | 75 NOTREACHED(); |
76 } | |
72 #endif | 77 #endif |
73 | 78 |
74 // TODO(mlamouri): we miss some layouts because needsLayout returns false in | 79 // TODO(mlamouri): we miss some layouts because needsLayout returns false in |
75 // some cases where we want to change the width of the controls because the | 80 // some cases where we want to change the width of the controls because the |
76 // visible viewport has changed for example. | 81 // visible viewport has changed for example. |
77 if (newRect.size() == oldSize && !child->needsLayout()) | 82 if (newRect.size() == oldSize && !child->needsLayout()) |
78 continue; | 83 continue; |
79 | 84 |
80 LayoutUnit width = newRect.width(); | 85 LayoutUnit width = newRect.width(); |
81 if (child->node()->isMediaControls()) { | 86 if (child->node()->isMediaControls() || |
87 child->node()->isMediaRemotingInterstitial()) { | |
mlamouri (slow - plz ping)
2017/04/07 13:18:37
I don't think you want this.
xjz
2017/04/07 23:07:01
Done.
| |
82 width = computePanelWidth(newRect); | 88 width = computePanelWidth(newRect); |
83 } | 89 } |
84 | 90 |
85 LayoutBox* layoutBox = toLayoutBox(child); | 91 LayoutBox* layoutBox = toLayoutBox(child); |
86 layoutBox->setLocation(newRect.location()); | 92 layoutBox->setLocation(newRect.location()); |
87 // TODO(foolip): Remove the mutableStyleRef() and depend on CSS | 93 // TODO(foolip): Remove the mutableStyleRef() and depend on CSS |
88 // width/height: inherit to match the media element size. | 94 // width/height: inherit to match the media element size. |
89 layoutBox->mutableStyleRef().setHeight(Length(newRect.height(), Fixed)); | 95 layoutBox->mutableStyleRef().setHeight(Length(newRect.height(), Fixed)); |
90 layoutBox->mutableStyleRef().setWidth(Length(width, Fixed)); | 96 layoutBox->mutableStyleRef().setWidth(Length(width, Fixed)); |
91 | 97 |
(...skipping 19 matching lines...) Expand all Loading... | |
111 // sets display: inline we would get an inline layoutObject as a child | 117 // sets display: inline we would get an inline layoutObject as a child |
112 // of replaced content, which is not supposed to be possible. This | 118 // of replaced content, which is not supposed to be possible. This |
113 // check can be removed if ::-webkit-media-controls is made | 119 // check can be removed if ::-webkit-media-controls is made |
114 // internal. | 120 // internal. |
115 if (child->node()->isMediaControls()) | 121 if (child->node()->isMediaControls()) |
116 return child->isFlexibleBox(); | 122 return child->isFlexibleBox(); |
117 | 123 |
118 if (child->node()->isTextTrackContainer()) | 124 if (child->node()->isTextTrackContainer()) |
119 return true; | 125 return true; |
120 | 126 |
127 if (child->node()->isMediaRemotingInterstitial()) | |
128 return true; | |
mlamouri (slow - plz ping)
2017/04/07 13:18:37
Can you merge this with the isTextTrackContainer()
xjz
2017/04/07 23:07:01
Done.
| |
129 | |
121 return false; | 130 return false; |
122 } | 131 } |
123 | 132 |
124 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) const {} | 133 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) const {} |
125 | 134 |
126 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { | 135 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { |
127 // TODO(mlamouri): we don't know if the main frame has an horizontal scrollbar | 136 // TODO(mlamouri): we don't know if the main frame has an horizontal scrollbar |
128 // if it is out of process. See https://crbug.com/662480 | 137 // if it is out of process. See https://crbug.com/662480 |
129 if (document().page()->mainFrame()->isRemoteFrame()) | 138 if (document().page()->mainFrame()->isRemoteFrame()) |
130 return mediaRect.width(); | 139 return mediaRect.width(); |
(...skipping 22 matching lines...) Expand all Loading... | |
153 .x()); | 162 .x()); |
154 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; | 163 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; |
155 | 164 |
156 if (newWidth < 0) | 165 if (newWidth < 0) |
157 return mediaRect.width(); | 166 return mediaRect.width(); |
158 | 167 |
159 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); | 168 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); |
160 } | 169 } |
161 | 170 |
162 } // namespace blink | 171 } // namespace blink |
OLD | NEW |