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

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 1948363004: Use media controls play button's width rather than hard-coded 48px. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@crbug585078_playbutton
Patch Set: rebased. Created 4 years, 7 months 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) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 m_fullScreenButton.get(), 693 m_fullScreenButton.get(),
694 m_timeline.get(), 694 m_timeline.get(),
695 m_currentTimeDisplay.get(), 695 m_currentTimeDisplay.get(),
696 m_volumeSlider.get(), 696 m_volumeSlider.get(),
697 m_castButton.get(), 697 m_castButton.get(),
698 m_muteButton.get(), 698 m_muteButton.get(),
699 m_durationDisplay.get(), 699 m_durationDisplay.get(),
700 }; 700 };
701 701
702 int usedWidth = 0; 702 int usedWidth = 0;
703 // Assume that all controls require 48px. Ideally, we could get this from 703
704 // the computed style, but that requires the controls to be shown. 704 // Assume that all controls require 48px, unless we can get the computed
705 const int minimumWidth = 48; 705 // style for the play button. Since the play button is always shown, it
706 // should be available the first time we're called after layout. This will
707 // also be the first time we have m_panelWidth!=0, so it won't matter if
708 // we get this wrong before that.
709 int minimumWidth = (m_playButton->layoutObject() && m_playButton->layoutObje ct()->style())
710 ? m_playButton->layoutObject()->style()->width().pixels()
711 : 48;
706 712
707 // Special-case the play button; it always fits. 713 // Special-case the play button; it always fits.
708 if (m_playButton->isWanted()) { 714 if (m_playButton->isWanted()) {
709 m_playButton->setDoesFit(true); 715 m_playButton->setDoesFit(true);
710 usedWidth += minimumWidth; 716 usedWidth += minimumWidth;
711 } 717 }
712 718
713 if (!m_panelWidth) { 719 if (!m_panelWidth) {
714 // No layout yet -- hide everything, then make them show up later. 720 // No layout yet -- hide everything, then make them show up later.
715 // This prevents the wrong controls from being shown briefly 721 // This prevents the wrong controls from being shown briefly
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 visitor->trace(m_fullScreenButton); 797 visitor->trace(m_fullScreenButton);
792 visitor->trace(m_durationDisplay); 798 visitor->trace(m_durationDisplay);
793 visitor->trace(m_enclosure); 799 visitor->trace(m_enclosure);
794 visitor->trace(m_textTrackList); 800 visitor->trace(m_textTrackList);
795 visitor->trace(m_castButton); 801 visitor->trace(m_castButton);
796 visitor->trace(m_overlayCastButton); 802 visitor->trace(m_overlayCastButton);
797 HTMLDivElement::trace(visitor); 803 HTMLDivElement::trace(visitor);
798 } 804 }
799 805
800 } // namespace blink 806 } // 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