Chromium Code Reviews| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 } | 152 } |
| 153 | 153 |
| 154 void LayoutMedia::setRequestPositionUpdates(bool want) { | 154 void LayoutMedia::setRequestPositionUpdates(bool want) { |
| 155 if (want) | 155 if (want) |
| 156 view()->registerMediaForPositionChangeNotification(*this); | 156 view()->registerMediaForPositionChangeNotification(*this); |
| 157 else | 157 else |
| 158 view()->unregisterMediaForPositionChangeNotification(*this); | 158 view()->unregisterMediaForPositionChangeNotification(*this); |
| 159 } | 159 } |
| 160 | 160 |
| 161 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { | 161 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { |
| 162 // We don't know if the main frame has an horizontal scrollbar if it is out of | |
| 163 // process. | |
| 164 if (document().page()->mainFrame()->isRemoteFrame()) | |
|
dcheng
2016/11/04 16:48:36
What breaks if we don't go through the rest of thi
mlamouri (slow - plz ping)
2016/11/04 17:00:56
The feature is meant to make the default controls
mlamouri (slow - plz ping)
2016/11/04 18:17:55
Do you want me to file a bug and add a TODO?
| |
| 165 return mediaRect.width(); | |
| 166 | |
| 162 FrameHost* frameHost = document().frameHost(); | 167 FrameHost* frameHost = document().frameHost(); |
| 163 LocalFrame* mainFrame = document().page()->deprecatedLocalMainFrame(); | 168 LocalFrame* mainFrame = document().page()->deprecatedLocalMainFrame(); |
| 164 FrameView* pageView = mainFrame ? mainFrame->view() : nullptr; | 169 FrameView* pageView = mainFrame ? mainFrame->view() : nullptr; |
| 165 if (!frameHost || !mainFrame || !pageView) | 170 if (!frameHost || !mainFrame || !pageView) |
| 166 return mediaRect.width(); | 171 return mediaRect.width(); |
| 167 | 172 |
| 168 if (pageView->horizontalScrollbarMode() != ScrollbarAlwaysOff) | 173 if (pageView->horizontalScrollbarMode() != ScrollbarAlwaysOff) |
| 169 return mediaRect.width(); | 174 return mediaRect.width(); |
| 170 | 175 |
| 171 // On desktop, this will include scrollbars when they stay visible. | 176 // On desktop, this will include scrollbars when they stay visible. |
| 172 const LayoutUnit visibleWidth(frameHost->visualViewport().visibleWidth()); | 177 const LayoutUnit visibleWidth(frameHost->visualViewport().visibleWidth()); |
| 173 const LayoutUnit absoluteXOffset( | 178 const LayoutUnit absoluteXOffset( |
| 174 localToAbsolute( | 179 localToAbsolute( |
| 175 FloatPoint(mediaRect.location()), | 180 FloatPoint(mediaRect.location()), |
| 176 UseTransforms | ApplyContainerFlip | TraverseDocumentBoundaries) | 181 UseTransforms | ApplyContainerFlip | TraverseDocumentBoundaries) |
| 177 .x()); | 182 .x()); |
| 178 DCHECK_GE(visibleWidth - absoluteXOffset, 0); | 183 DCHECK_GE(visibleWidth - absoluteXOffset, 0); |
| 179 | 184 |
| 180 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); | 185 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); |
| 181 } | 186 } |
| 182 | 187 |
| 183 } // namespace blink | 188 } // namespace blink |
| OLD | NEW |