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

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

Issue 2550423003: Media Controls: don't try to cut the controls when the element is fullscreen. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const { 133 LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const {
134 // 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
135 // if it is out of process. See https://crbug.com/662480 135 // if it is out of process. See https://crbug.com/662480
136 if (document().page()->mainFrame()->isRemoteFrame()) 136 if (document().page()->mainFrame()->isRemoteFrame())
137 return mediaRect.width(); 137 return mediaRect.width();
138 138
139 // TODO(foolip): when going fullscreen, the animation sometimes does not clear
140 // up properly and the last `absoluteXOffset` received is incorrect. This is
141 // a shortcut that we could ideally avoid. See https://crbug.com/663680
142 if (mediaElement() && mediaElement()->isFullscreen())
143 return mediaRect.width();
144
139 FrameHost* frameHost = document().frameHost(); 145 FrameHost* frameHost = document().frameHost();
140 LocalFrame* mainFrame = document().page()->deprecatedLocalMainFrame(); 146 LocalFrame* mainFrame = document().page()->deprecatedLocalMainFrame();
141 FrameView* pageView = mainFrame ? mainFrame->view() : nullptr; 147 FrameView* pageView = mainFrame ? mainFrame->view() : nullptr;
142 if (!frameHost || !mainFrame || !pageView) 148 if (!frameHost || !mainFrame || !pageView)
143 return mediaRect.width(); 149 return mediaRect.width();
144 150
145 if (pageView->horizontalScrollbarMode() != ScrollbarAlwaysOff) 151 if (pageView->horizontalScrollbarMode() != ScrollbarAlwaysOff)
146 return mediaRect.width(); 152 return mediaRect.width();
147 153
148 // On desktop, this will include scrollbars when they stay visible. 154 // On desktop, this will include scrollbars when they stay visible.
149 const LayoutUnit visibleWidth(frameHost->visualViewport().visibleWidth()); 155 const LayoutUnit visibleWidth(frameHost->visualViewport().visibleWidth());
150 const LayoutUnit absoluteXOffset( 156 const LayoutUnit absoluteXOffset(
151 localToAbsolute( 157 localToAbsolute(
152 FloatPoint(mediaRect.location()), 158 FloatPoint(mediaRect.location()),
153 UseTransforms | ApplyContainerFlip | TraverseDocumentBoundaries) 159 UseTransforms | ApplyContainerFlip | TraverseDocumentBoundaries)
154 .x()); 160 .x());
155 const LayoutUnit newWidth = visibleWidth - absoluteXOffset; 161 const LayoutUnit newWidth = visibleWidth - absoluteXOffset;
156 162
157 if (newWidth < 0) 163 if (newWidth < 0)
158 return mediaRect.width(); 164 return mediaRect.width();
159 165
160 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset); 166 return std::min(mediaRect.width(), visibleWidth - absoluteXOffset);
161 } 167 }
162 168
163 } // namespace blink 169 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698