| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return child->isFlexibleBox(); | 123 return child->isFlexibleBox(); |
| 124 | 124 |
| 125 if (child->node()->isTextTrackContainer()) | 125 if (child->node()->isTextTrackContainer()) |
| 126 return true; | 126 return true; |
| 127 | 127 |
| 128 return false; | 128 return false; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) const {} | 131 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) const {} |
| 132 | 132 |
| 133 void LayoutMedia::willBeDestroyed() { | |
| 134 if (view()) | |
| 135 view()->unregisterMediaForPositionChangeNotification(*this); | |
| 136 LayoutImage::willBeDestroyed(); | |
| 137 } | |
| 138 | |
| 139 void LayoutMedia::insertedIntoTree() { | |
| 140 LayoutImage::insertedIntoTree(); | |
| 141 | |
| 142 // Note that if we don't want them and aren't registered, then this | |
| 143 // will do nothing. | |
| 144 if (HTMLMediaElement* element = mediaElement()) | |
| 145 element->updatePositionNotificationRegistration(); | |
| 146 } | |
| 147 | |
| 148 void LayoutMedia::notifyPositionMayHaveChanged(const IntRect& visibleRect) { | |
| 149 // Tell our element about it. | |
| 150 if (HTMLMediaElement* element = mediaElement()) | |
| 151 element->notifyPositionMayHaveChanged(visibleRect); | |
| 152 } | |
| 153 | |
| 154 void LayoutMedia::setRequestPositionUpdates(bool want) { | |
| 155 if (want) | |
| 156 view()->registerMediaForPositionChangeNotification(*this); | |
| 157 else | |
| 158 view()->unregisterMediaForPositionChangeNotification(*this); | |
| 159 } | |
| 160 | |
| 161 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { | 133 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { |
| 162 // 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 |
| 163 // if it is out of process. See https://crbug.com/662480 | 135 // if it is out of process. See https://crbug.com/662480 |
| 164 if (document().page()->mainFrame()->isRemoteFrame()) | 136 if (document().page()->mainFrame()->isRemoteFrame()) |
| 165 return mediaRect.width(); | 137 return mediaRect.width(); |
| 166 | 138 |
| 167 FrameHost* frameHost = document().frameHost(); | 139 FrameHost* frameHost = document().frameHost(); |
| 168 LocalFrame* mainFrame = document().page()->deprecatedLocalMainFrame(); | 140 LocalFrame* mainFrame = document().page()->deprecatedLocalMainFrame(); |
| 169 FrameView* pageView = mainFrame ? mainFrame->view() : nullptr; | 141 FrameView* pageView = mainFrame ? mainFrame->view() : nullptr; |
| 170 if (!frameHost || !mainFrame || !pageView) | 142 if (!frameHost || !mainFrame || !pageView) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 182 .x()); | 154 .x()); |
| 183 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; | 155 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; |
| 184 | 156 |
| 185 if (newWidth < 0) | 157 if (newWidth < 0) |
| 186 return mediaRect.width(); | 158 return mediaRect.width(); |
| 187 | 159 |
| 188 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); | 160 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); |
| 189 } | 161 } |
| 190 | 162 |
| 191 } // namespace blink | 163 } // namespace blink |
| OLD | NEW |