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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 static const int kMediaSliderThumbTouchWidth = 36; // Touch zone size. | 50 static const int kMediaSliderThumbTouchWidth = 36; // Touch zone size. |
| 51 static const int kMediaSliderThumbTouchHeight = 48; | 51 static const int kMediaSliderThumbTouchHeight = 48; |
| 52 static const int kMediaSliderThumbPaintWidth = 12; // Painted area. | 52 static const int kMediaSliderThumbPaintWidth = 12; // Painted area. |
| 53 static const int kMediaSliderThumbPaintHeight = 12; | 53 static const int kMediaSliderThumbPaintHeight = 12; |
| 54 | 54 |
| 55 // Overlay play button size. If this changes, it must also be changed in | 55 // Overlay play button size. If this changes, it must also be changed in |
| 56 // core/html/shadow/MediaControls.cpp. | 56 // core/html/shadow/MediaControls.cpp. |
| 57 static const int kMediaOverlayPlayButtonWidth = 48; | 57 static const int kMediaOverlayPlayButtonWidth = 48; |
| 58 static const int kMediaOverlayPlayButtonHeight = 48; | 58 static const int kMediaOverlayPlayButtonHeight = 48; |
| 59 | 59 |
| 60 // Overlay media remoting cast button size. | |
| 61 static const int kMediaRemotingCastIconWidth = 44; | |
| 62 static const int kMediaRemotingCastIconHeight = 36; | |
| 63 | |
| 60 // Alpha for disabled elements. | 64 // Alpha for disabled elements. |
| 61 static const float kDisabledAlpha = 0.4; | 65 static const float kDisabledAlpha = 0.4; |
| 62 | 66 |
| 63 static Image* PlatformResource(const char* name) { | 67 static Image* PlatformResource(const char* name) { |
| 64 if (!g_media_control_image_map) | 68 if (!g_media_control_image_map) |
| 65 g_media_control_image_map = new MediaControlImageMap(); | 69 g_media_control_image_map = new MediaControlImageMap(); |
| 66 if (Image* image = g_media_control_image_map->at(name)) | 70 if (Image* image = g_media_control_image_map->at(name)) |
| 67 return image; | 71 return image; |
| 68 if (Image* image = Image::LoadPlatformResource(name).LeakRef()) { | 72 if (Image* image = Image::LoadPlatformResource(name).LeakRef()) { |
| 69 g_media_control_image_map->Set(name, image); | 73 g_media_control_image_map->Set(name, image); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 const ComputedStyle& style, | 214 const ComputedStyle& style, |
| 211 GraphicsContext& context, | 215 GraphicsContext& context, |
| 212 Color slider_background_color) { | 216 Color slider_background_color) { |
| 213 float border_radius = rect.Height() / 2; | 217 float border_radius = rect.Height() / 2; |
| 214 FloatSize radii(border_radius, border_radius); | 218 FloatSize radii(border_radius, border_radius); |
| 215 | 219 |
| 216 context.FillRoundedRect(FloatRoundedRect(rect, radii, radii, radii, radii), | 220 context.FillRoundedRect(FloatRoundedRect(rect, radii, radii, radii, radii), |
| 217 slider_background_color); | 221 slider_background_color); |
| 218 } | 222 } |
| 219 | 223 |
| 224 bool MediaControlsPainter::PaintMediaRemotingCastIcon( | |
| 225 const LayoutObject& object, | |
| 226 const PaintInfo& paintInfo, | |
| 227 const IntRect& rect) { | |
| 228 const HTMLMediaElement* media_element = ToParentMediaElement(object); | |
| 229 if (!media_element) | |
| 230 return false; | |
| 231 | |
| 232 static Image* cast_icon = PlatformResource("mediaremotingCast"); | |
| 233 | |
| 234 const int button_width = std::min(rect.Width(), kMediaRemotingCastIconWidth); | |
|
liberato (no reviews please)
2017/04/12 21:57:44
what size box do you see here? from the css, it l
xjz
2017/04/13 00:08:48
Done.
| |
| 235 const int button_height = | |
| 236 std::min(rect.Height(), kMediaRemotingCastIconHeight); | |
| 237 | |
| 238 return PaintMediaButton( | |
| 239 paintInfo.context, | |
| 240 IntRect(rect.X() + (rect.Width() - button_width) / 2, | |
| 241 rect.Y() + (rect.Height() - button_height) / 2, button_width, | |
| 242 button_height), | |
| 243 cast_icon); | |
| 244 } | |
| 245 | |
| 220 static void PaintSliderRangeHighlight(const IntRect& rect, | 246 static void PaintSliderRangeHighlight(const IntRect& rect, |
| 221 const ComputedStyle& style, | 247 const ComputedStyle& style, |
| 222 GraphicsContext& context, | 248 GraphicsContext& context, |
| 223 int start_position, | 249 int start_position, |
| 224 int end_position, | 250 int end_position, |
| 225 Color start_color, | 251 Color start_color, |
| 226 Color end_color) { | 252 Color end_color) { |
| 227 // Calculate border radius; need to avoid being smaller than half the slider | 253 // Calculate border radius; need to avoid being smaller than half the slider |
| 228 // height because of https://bugs.webkit.org/show_bug.cgi?id=30143. | 254 // height because of https://bugs.webkit.org/show_bug.cgi?id=30143. |
| 229 float border_radius = rect.Height() / 2.0f; | 255 float border_radius = rect.Height() / 2.0f; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 610 void MediaControlsPainter::AdjustMediaSliderThumbSize(ComputedStyle& style) { | 636 void MediaControlsPainter::AdjustMediaSliderThumbSize(ComputedStyle& style) { |
| 611 const float zoom_level = style.EffectiveZoom(); | 637 const float zoom_level = style.EffectiveZoom(); |
| 612 | 638 |
| 613 style.SetWidth(Length( | 639 style.SetWidth(Length( |
| 614 static_cast<int>(kMediaSliderThumbTouchWidth * zoom_level), kFixed)); | 640 static_cast<int>(kMediaSliderThumbTouchWidth * zoom_level), kFixed)); |
| 615 style.SetHeight(Length( | 641 style.SetHeight(Length( |
| 616 static_cast<int>(kMediaSliderThumbTouchHeight * zoom_level), kFixed)); | 642 static_cast<int>(kMediaSliderThumbTouchHeight * zoom_level), kFixed)); |
| 617 } | 643 } |
| 618 | 644 |
| 619 } // namespace blink | 645 } // namespace blink |
| OLD | NEW |