Chromium Code Reviews| 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 cast button size. | |
| 60 static const int MediaRemotingCastIconWidth = 88; | |
| 61 static const int MediaRemotingCastIconHeight = 72; | |
|
kinuko
2017/04/04 03:18:05
The naming looks inconsistent here and above, woul
xjz
2017/04/04 20:56:27
Done.
| |
| 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::paintMediaRemotingCastIcon( | |
| 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* mediaremotingCast = platformResource("mediaremotingCast"); | |
| 219 | |
| 220 const int buttonWidth = std::min(rect.width(), MediaRemotingCastIconWidth); | |
| 221 const int buttonHeight = std::min(rect.height(), MediaRemotingCastIconHeight); | |
| 222 | |
| 223 return paintMediaButton(paintInfo.context, | |
| 224 IntRect(rect.x() + (rect.width() - buttonWidth) / 2, | |
| 225 rect.y() + (rect.height() - buttonHeight) / 2, | |
| 226 buttonWidth, buttonHeight), | |
| 227 mediaremotingCast); | |
| 228 } | |
| 229 | |
| 206 static void paintRoundedSliderBackground(const IntRect& rect, | 230 static void paintRoundedSliderBackground(const IntRect& rect, |
| 207 const ComputedStyle& style, | 231 const ComputedStyle& style, |
| 208 GraphicsContext& context, | 232 GraphicsContext& context, |
| 209 Color sliderBackgroundColor) { | 233 Color sliderBackgroundColor) { |
| 210 float borderRadius = rect.height() / 2; | 234 float borderRadius = rect.height() / 2; |
| 211 FloatSize radii(borderRadius, borderRadius); | 235 FloatSize radii(borderRadius, borderRadius); |
| 212 | 236 |
| 213 context.fillRoundedRect(FloatRoundedRect(rect, radii, radii, radii, radii), | 237 context.fillRoundedRect(FloatRoundedRect(rect, radii, radii, radii, radii), |
| 214 sliderBackgroundColor); | 238 sliderBackgroundColor); |
| 215 } | 239 } |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) { | 627 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) { |
| 604 const float zoomLevel = style.effectiveZoom(); | 628 const float zoomLevel = style.effectiveZoom(); |
| 605 | 629 |
| 606 style.setWidth( | 630 style.setWidth( |
| 607 Length(static_cast<int>(mediaSliderThumbTouchWidth * zoomLevel), Fixed)); | 631 Length(static_cast<int>(mediaSliderThumbTouchWidth * zoomLevel), Fixed)); |
| 608 style.setHeight( | 632 style.setHeight( |
| 609 Length(static_cast<int>(mediaSliderThumbTouchHeight * zoomLevel), Fixed)); | 633 Length(static_cast<int>(mediaSliderThumbTouchHeight * zoomLevel), Fixed)); |
| 610 } | 634 } |
| 611 | 635 |
| 612 } // namespace blink | 636 } // namespace blink |
| OLD | NEW |