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

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

Issue 2702473002: Don't allow out-of-flow positioned and floating children under LayoutMedia (Closed)
Patch Set: Fix a typo Created 3 years, 10 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 m_lastReportedPanelWidth.value() != newPanelWidth.value()) { 105 m_lastReportedPanelWidth.value() != newPanelWidth.value()) {
106 mediaElement()->mediaControls()->notifyPanelWidthChanged( 106 mediaElement()->mediaControls()->notifyPanelWidthChanged(
107 newPanelWidth.value()); 107 newPanelWidth.value());
108 // Store the last value we reported, so we know if it has changed. 108 // Store the last value we reported, so we know if it has changed.
109 m_lastReportedPanelWidth = newPanelWidth.value(); 109 m_lastReportedPanelWidth = newPanelWidth.value();
110 } 110 }
111 } 111 }
112 } 112 }
113 113
114 bool LayoutMedia::isChildAllowed(LayoutObject* child, 114 bool LayoutMedia::isChildAllowed(LayoutObject* child,
115 const ComputedStyle&) const { 115 const ComputedStyle& style) const {
116 // Two types of child layout objects are allowed: media controls 116 // Two types of child layout objects are allowed: media controls
117 // and the text track container. Filter children by node type. 117 // and the text track container. Filter children by node type.
118 ASSERT(child->node()); 118 ASSERT(child->node());
119 119
120 // Out-of-flow positioned or floating child breaks layout hierarchy.
121 // This check can be removed if ::-webkit-media-controls is made internal.
122 if (style.hasOutOfFlowPosition() || style.isFloating())
123 return false;
124
120 // The user agent stylesheet (mediaControls.css) has 125 // The user agent stylesheet (mediaControls.css) has
121 // ::-webkit-media-controls { display: flex; }. If author style 126 // ::-webkit-media-controls { display: flex; }. If author style
122 // sets display: inline we would get an inline layoutObject as a child 127 // sets display: inline we would get an inline layoutObject as a child
123 // of replaced content, which is not supposed to be possible. This 128 // of replaced content, which is not supposed to be possible. This
124 // check can be removed if ::-webkit-media-controls is made 129 // check can be removed if ::-webkit-media-controls is made
125 // internal. 130 // internal.
126 if (child->node()->isMediaControls()) 131 if (child->node()->isMediaControls())
127 return child->isFlexibleBox(); 132 return child->isFlexibleBox();
128 133
129 if (child->node()->isTextTrackContainer()) 134 if (child->node()->isTextTrackContainer())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 .x()); 169 .x());
165 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; 170 const LayoutUnit newWidth = visibleWidth - absoluteXOffset;
166 171
167 if (newWidth < 0) 172 if (newWidth < 0)
168 return mediaRect.width(); 173 return mediaRect.width();
169 174
170 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); 175 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset);
171 } 176 }
172 177
173 } // namespace blink 178 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/LayoutMediaTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698