| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 #endif | 62 #endif |
| 63 for (LayoutObject* child = m_children.lastChild(); child; | 63 for (LayoutObject* child = m_children.lastChild(); child; |
| 64 child = child->previousSibling()) { | 64 child = child->previousSibling()) { |
| 65 #if DCHECK_IS_ON() | 65 #if DCHECK_IS_ON() |
| 66 if (child->node()->isMediaControls()) | 66 if (child->node()->isMediaControls()) |
| 67 ASSERT(!seenTextTrackContainer); | 67 DCHECK(!seenTextTrackContainer); |
| 68 else if (child->node()->isTextTrackContainer()) | 68 else if (child->node()->isTextTrackContainer()) |
| 69 seenTextTrackContainer = true; | 69 seenTextTrackContainer = true; |
| 70 else | 70 else |
| 71 NOTREACHED(); | 71 NOTREACHED(); |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 // TODO(mlamouri): we miss some layouts because needsLayout returns false in | 74 // 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 | 75 // some cases where we want to change the width of the controls because the |
| 76 // visible viewport has changed for example. | 76 // visible viewport has changed for example. |
| 77 if (newRect.size() == oldSize && !child->needsLayout()) | 77 if (newRect.size() == oldSize && !child->needsLayout()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 92 layoutBox->forceLayout(); | 92 layoutBox->forceLayout(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 clearNeedsLayout(); | 95 clearNeedsLayout(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool LayoutMedia::isChildAllowed(LayoutObject* child, | 98 bool LayoutMedia::isChildAllowed(LayoutObject* child, |
| 99 const ComputedStyle& style) const { | 99 const ComputedStyle& style) const { |
| 100 // Two types of child layout objects are allowed: media controls | 100 // Two types of child layout objects are allowed: media controls |
| 101 // and the text track container. Filter children by node type. | 101 // and the text track container. Filter children by node type. |
| 102 ASSERT(child->node()); | 102 DCHECK(child->node()); |
| 103 | 103 |
| 104 // Out-of-flow positioned or floating child breaks layout hierarchy. | 104 // Out-of-flow positioned or floating child breaks layout hierarchy. |
| 105 // This check can be removed if ::-webkit-media-controls is made internal. | 105 // This check can be removed if ::-webkit-media-controls is made internal. |
| 106 if (style.hasOutOfFlowPosition() || style.isFloating()) | 106 if (style.hasOutOfFlowPosition() || style.isFloating()) |
| 107 return false; | 107 return false; |
| 108 | 108 |
| 109 // The user agent stylesheet (mediaControls.css) has | 109 // The user agent stylesheet (mediaControls.css) has |
| 110 // ::-webkit-media-controls { display: flex; }. If author style | 110 // ::-webkit-media-controls { display: flex; }. If author style |
| 111 // sets display: inline we would get an inline layoutObject as a child | 111 // sets display: inline we would get an inline layoutObject as a child |
| 112 // of replaced content, which is not supposed to be possible. This | 112 // of replaced content, which is not supposed to be possible. This |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 .x()); | 153 .x()); |
| 154 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; | 154 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; |
| 155 | 155 |
| 156 if (newWidth < 0) | 156 if (newWidth < 0) |
| 157 return mediaRect.width(); | 157 return mediaRect.width(); |
| 158 | 158 |
| 159 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); | 159 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace blink | 162 } // namespace blink |
| OLD | NEW |