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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 static const int mediaSliderThumbTouchWidth = 36; // Touch zone size. | 49 static const int mediaSliderThumbTouchWidth = 36; // Touch zone size. |
50 static const int mediaSliderThumbTouchHeight = 48; | 50 static const int mediaSliderThumbTouchHeight = 48; |
51 static const int mediaSliderThumbPaintWidth = 12; // Painted area. | 51 static const int mediaSliderThumbPaintWidth = 12; // Painted area. |
52 static const int mediaSliderThumbPaintHeight = 12; | 52 static const int mediaSliderThumbPaintHeight = 12; |
53 | 53 |
54 // Overlay play button size. If this changes, it must also be changed in | 54 // Overlay play button size. If this changes, it must also be changed in |
55 // core/html/shadow/MediaControls.cpp. | 55 // core/html/shadow/MediaControls.cpp. |
56 static const int mediaOverlayPlayButtonWidth = 48; | 56 static const int mediaOverlayPlayButtonWidth = 48; |
57 static const int mediaOverlayPlayButtonHeight = 48; | 57 static const int mediaOverlayPlayButtonHeight = 48; |
58 | 58 |
59 // Overlay media remoting disable button size. | |
60 static const int mediaremotingDisableButtonWidth = 24; | |
61 static const int mediaremotingDisableButtonHeight = 24; | |
62 | |
59 // Alpha for disabled elements. | 63 // Alpha for disabled elements. |
60 static const float kDisabledAlpha = 0.4; | 64 static const float kDisabledAlpha = 0.4; |
61 | 65 |
62 static Image* platformResource(const char* name) { | 66 static Image* platformResource(const char* name) { |
63 if (!gMediaControlImageMap) | 67 if (!gMediaControlImageMap) |
64 gMediaControlImageMap = new MediaControlImageMap(); | 68 gMediaControlImageMap = new MediaControlImageMap(); |
65 if (Image* image = gMediaControlImageMap->at(name)) | 69 if (Image* image = gMediaControlImageMap->at(name)) |
66 return image; | 70 return image; |
67 if (Image* image = Image::loadPlatformResource(name).leakRef()) { | 71 if (Image* image = Image::loadPlatformResource(name).leakRef()) { |
68 gMediaControlImageMap->set(name, image); | 72 gMediaControlImageMap->set(name, image); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 int mediaPanelHeight = panelElement ? panelElement->clientHeight() : 0; | 200 int mediaPanelHeight = panelElement ? panelElement->clientHeight() : 0; |
197 buttonRect.setX(rect.center().x() - mediaOverlayPlayButtonWidth / 2); | 201 buttonRect.setX(rect.center().x() - mediaOverlayPlayButtonWidth / 2); |
198 buttonRect.setY(rect.center().y() - mediaOverlayPlayButtonHeight / 2 + | 202 buttonRect.setY(rect.center().y() - mediaOverlayPlayButtonHeight / 2 + |
199 (mediaHeight - rect.height() - mediaPanelHeight) / 2); | 203 (mediaHeight - rect.height() - mediaPanelHeight) / 2); |
200 buttonRect.setWidth(mediaOverlayPlayButtonWidth); | 204 buttonRect.setWidth(mediaOverlayPlayButtonWidth); |
201 buttonRect.setHeight(mediaOverlayPlayButtonHeight); | 205 buttonRect.setHeight(mediaOverlayPlayButtonHeight); |
202 | 206 |
203 return paintMediaButton(paintInfo.context, buttonRect, mediaOverlayPlay); | 207 return paintMediaButton(paintInfo.context, buttonRect, mediaOverlayPlay); |
204 } | 208 } |
205 | 209 |
210 bool MediaControlsPainter::paintMediaRemotingDisableButton( | |
211 const LayoutObject& object, | |
212 const PaintInfo& paintInfo, | |
213 const IntRect& rect) { | |
214 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | |
215 if (!mediaElement) | |
216 return false; | |
217 | |
218 static Image* mediaremotingDisable = platformResource("mediaremotingDisable"); | |
219 | |
220 IntRect buttonRect(rect); | |
miu
2017/03/22 21:26:48
nit:
const IntRect buttonRect(rect.center().x()
xjz
2017/03/22 22:25:09
Done.
| |
221 buttonRect.setX(rect.center().x()); | |
222 buttonRect.setY(rect.center().y()); | |
223 buttonRect.setWidth(mediaremotingDisableButtonWidth); | |
224 buttonRect.setHeight(mediaremotingDisableButtonHeight); | |
225 | |
226 return paintMediaButton(paintInfo.context, buttonRect, mediaremotingDisable); | |
227 } | |
228 | |
206 static void paintRoundedSliderBackground(const IntRect& rect, | 229 static void paintRoundedSliderBackground(const IntRect& rect, |
207 const ComputedStyle& style, | 230 const ComputedStyle& style, |
208 GraphicsContext& context, | 231 GraphicsContext& context, |
209 Color sliderBackgroundColor) { | 232 Color sliderBackgroundColor) { |
210 float borderRadius = rect.height() / 2; | 233 float borderRadius = rect.height() / 2; |
211 FloatSize radii(borderRadius, borderRadius); | 234 FloatSize radii(borderRadius, borderRadius); |
212 | 235 |
213 context.fillRoundedRect(FloatRoundedRect(rect, radii, radii, radii, radii), | 236 context.fillRoundedRect(FloatRoundedRect(rect, radii, radii, radii, radii), |
214 sliderBackgroundColor); | 237 sliderBackgroundColor); |
215 } | 238 } |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
603 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) { | 626 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) { |
604 const float zoomLevel = style.effectiveZoom(); | 627 const float zoomLevel = style.effectiveZoom(); |
605 | 628 |
606 style.setWidth( | 629 style.setWidth( |
607 Length(static_cast<int>(mediaSliderThumbTouchWidth * zoomLevel), Fixed)); | 630 Length(static_cast<int>(mediaSliderThumbTouchWidth * zoomLevel), Fixed)); |
608 style.setHeight( | 631 style.setHeight( |
609 Length(static_cast<int>(mediaSliderThumbTouchHeight * zoomLevel), Fixed)); | 632 Length(static_cast<int>(mediaSliderThumbTouchHeight * zoomLevel), Fixed)); |
610 } | 633 } |
611 | 634 |
612 } // namespace blink | 635 } // namespace blink |
OLD | NEW |