OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. | 2 * Copyright (C) 2009 Apple Inc. |
3 * Copyright (C) 2009 Google Inc. | 3 * Copyright (C) 2009 Google Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 165 |
166 if (!hasSource(mediaElement) || !mediaElement->togglePlayStateWillPlay()) | 166 if (!hasSource(mediaElement) || !mediaElement->togglePlayStateWillPlay()) |
167 return false; | 167 return false; |
168 | 168 |
169 static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay", | 169 static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay", |
170 "mediaplayerOverlayPlayNew"); | 170 "mediaplayerOverlayPlayNew"); |
171 | 171 |
172 IntRect buttonRect(rect); | 172 IntRect buttonRect(rect); |
173 if (RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) { | 173 if (RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) { |
174 // Overlay play button covers the entire player, so center and draw a | 174 // Overlay play button covers the entire player, so center and draw a |
175 // smaller button. Center in the entire element. | 175 // smaller button. Center in the entire element. Do not trigger |
176 int mediaHeight = mediaElement->clientHeight(); | 176 // a relayout here. |
177 const LayoutSize& layoutSize = mediaElement->cachedLayoutSize(); | |
178 if (layoutSize.isEmpty()) | |
179 return false; | |
180 int mediaHeight = layoutSize.height(); | |
181 | |
182 // Adjust for effective zoom. | |
183 if (mediaElement->layoutObject() && mediaElement->layoutObject()->style( )) | |
fs
2015/08/18 07:39:41
I'm not sure in what cases mediaElement wouldn't h
liberato (no reviews please)
2015/08/18 16:26:41
all of this code has been removed.
| |
184 mediaHeight = ceil(mediaHeight / mediaElement->layoutObject()->style ()->effectiveZoom()); | |
185 | |
177 buttonRect.setX(rect.center().x() - mediaOverlayPlayButtonWidthNew / 2); | 186 buttonRect.setX(rect.center().x() - mediaOverlayPlayButtonWidthNew / 2); |
178 buttonRect.setY(rect.center().y() - mediaOverlayPlayButtonHeightNew / 2 | 187 buttonRect.setY(rect.center().y() - mediaOverlayPlayButtonHeightNew / 2 |
179 + (mediaHeight - rect.height()) / 2); | 188 + (mediaHeight - rect.height()) / 2); |
180 buttonRect.setWidth(mediaOverlayPlayButtonWidthNew); | 189 buttonRect.setWidth(mediaOverlayPlayButtonWidthNew); |
181 buttonRect.setHeight(mediaOverlayPlayButtonHeightNew); | 190 buttonRect.setHeight(mediaOverlayPlayButtonHeightNew); |
182 } | 191 } |
183 | 192 |
184 return paintMediaButton(paintInfo.context, buttonRect, mediaOverlayPlay); | 193 return paintMediaButton(paintInfo.context, buttonRect, mediaOverlayPlay); |
185 } | 194 } |
186 | 195 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 } | 576 } |
568 | 577 |
569 float zoomLevel = style.effectiveZoom(); | 578 float zoomLevel = style.effectiveZoom(); |
570 if (thumbImage) { | 579 if (thumbImage) { |
571 style.setWidth(Length(static_cast<int>(width * zoomLevel), Fixed)); | 580 style.setWidth(Length(static_cast<int>(width * zoomLevel), Fixed)); |
572 style.setHeight(Length(static_cast<int>(height * zoomLevel), Fixed)); | 581 style.setHeight(Length(static_cast<int>(height * zoomLevel), Fixed)); |
573 } | 582 } |
574 } | 583 } |
575 | 584 |
576 } // namespace blink | 585 } // namespace blink |
OLD | NEW |