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()) { |
(...skipping 26 matching lines...) Expand all Loading... |
108 | 113 |
109 // The user agent stylesheet (mediaControls.css) has | 114 // The user agent stylesheet (mediaControls.css) has |
110 // ::-webkit-media-controls { display: flex; }. If author style | 115 // ::-webkit-media-controls { display: flex; }. If author style |
111 // sets display: inline we would get an inline layoutObject as a child | 116 // sets display: inline we would get an inline layoutObject as a child |
112 // of replaced content, which is not supposed to be possible. This | 117 // of replaced content, which is not supposed to be possible. This |
113 // check can be removed if ::-webkit-media-controls is made | 118 // check can be removed if ::-webkit-media-controls is made |
114 // internal. | 119 // internal. |
115 if (child->node()->isMediaControls()) | 120 if (child->node()->isMediaControls()) |
116 return child->isFlexibleBox(); | 121 return child->isFlexibleBox(); |
117 | 122 |
118 if (child->node()->isTextTrackContainer()) | 123 if (child->node()->isTextTrackContainer() || |
| 124 child->node()->isMediaRemotingInterstitial()) |
119 return true; | 125 return true; |
120 | 126 |
121 return false; | 127 return false; |
122 } | 128 } |
123 | 129 |
124 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) const {} | 130 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) const {} |
125 | 131 |
126 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { | 132 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { |
127 // TODO(mlamouri): we don't know if the main frame has an horizontal scrollbar | 133 // 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 | 134 // if it is out of process. See https://crbug.com/662480 |
(...skipping 24 matching lines...) Expand all Loading... |
153 .x()); | 159 .x()); |
154 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; | 160 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; |
155 | 161 |
156 if (newWidth < 0) | 162 if (newWidth < 0) |
157 return mediaRect.width(); | 163 return mediaRect.width(); |
158 | 164 |
159 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); | 165 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); |
160 } | 166 } |
161 | 167 |
162 } // namespace blink | 168 } // namespace blink |
OLD | NEW |