Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(849)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutMedia.cpp

Issue 2767823002: Media Remoting: Add interstitial elements to media element shadow dom. (Closed)
Patch Set: Rebased. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
52 LayoutRect new_rect = ContentBoxRect(); 52 LayoutRect new_rect = 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 seen_text_track_container = false; 61 bool seen_text_track_container = false;
62 bool seen_media_remoting_interstitial = false;
62 #endif 63 #endif
63 for (LayoutObject* child = children_.LastChild(); child; 64 for (LayoutObject* child = children_.LastChild(); child;
64 child = child->PreviousSibling()) { 65 child = child->PreviousSibling()) {
65 #if DCHECK_IS_ON() 66 #if DCHECK_IS_ON()
66 if (child->GetNode()->IsMediaControls()) 67 if (child->GetNode()->IsMediaControls()) {
67 DCHECK(!seen_text_track_container); 68 DCHECK(!seen_text_track_container);
68 else if (child->GetNode()->IsTextTrackContainer()) 69 DCHECK(!seen_media_remoting_interstitial);
70 } else if (child->GetNode()->IsTextTrackContainer()) {
69 seen_text_track_container = true; 71 seen_text_track_container = true;
70 else 72 DCHECK(!seen_media_remoting_interstitial);
73 } else if (child->GetNode()->IsMediaRemotingInterstitial()) {
74 seen_media_remoting_interstitial = true;
75 } else {
71 NOTREACHED(); 76 NOTREACHED();
77 }
72 #endif 78 #endif
73 79
74 // TODO(mlamouri): we miss some layouts because needsLayout returns false in 80 // 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 81 // some cases where we want to change the width of the controls because the
76 // visible viewport has changed for example. 82 // visible viewport has changed for example.
77 if (new_rect.Size() == old_size && !child->NeedsLayout()) 83 if (new_rect.Size() == old_size && !child->NeedsLayout())
78 continue; 84 continue;
79 85
80 LayoutUnit width = new_rect.Width(); 86 LayoutUnit width = new_rect.Width();
81 if (child->GetNode()->IsMediaControls()) { 87 if (child->GetNode()->IsMediaControls()) {
(...skipping 26 matching lines...) Expand all
108 114
109 // The user agent stylesheet (mediaControls.css) has 115 // The user agent stylesheet (mediaControls.css) has
110 // ::-webkit-media-controls { display: flex; }. If author style 116 // ::-webkit-media-controls { display: flex; }. If author style
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->GetNode()->IsMediaControls()) 121 if (child->GetNode()->IsMediaControls())
116 return child->IsFlexibleBox(); 122 return child->IsFlexibleBox();
117 123
118 if (child->GetNode()->IsTextTrackContainer()) 124 if (child->GetNode()->IsTextTrackContainer() ||
125 child->GetNode()->IsMediaRemotingInterstitial())
119 return true; 126 return true;
120 127
121 return false; 128 return false;
122 } 129 }
123 130
124 void LayoutMedia::PaintReplaced(const PaintInfo&, const LayoutPoint&) const {} 131 void LayoutMedia::PaintReplaced(const PaintInfo&, const LayoutPoint&) const {}
125 132
126 LayoutUnit LayoutMedia::ComputePanelWidth(const LayoutRect& media_rect) const { 133 LayoutUnit LayoutMedia::ComputePanelWidth(const LayoutRect& media_rect) const {
127 // TODO(mlamouri): we don't know if the main frame has an horizontal scrollbar 134 // 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 135 // if it is out of process. See https://crbug.com/662480
(...skipping 24 matching lines...) Expand all
153 .X()); 160 .X());
154 const LayoutUnit new_width = visible_width - absolute_x_offset; 161 const LayoutUnit new_width = visible_width - absolute_x_offset;
155 162
156 if (new_width < 0) 163 if (new_width < 0)
157 return media_rect.Width(); 164 return media_rect.Width();
158 165
159 return std::min(media_rect.Width(), visible_width - absolute_x_offset); 166 return std::min(media_rect.Width(), visible_width - absolute_x_offset);
160 } 167 }
161 168
162 } // namespace blink 169 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698