Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp |
| diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp |
| index 45baeee686422bc5e60875db56b63dcc492aa276..e5f15e50e674a5bbd47de586721d4c3893a4de92 100644 |
| --- a/third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp |
| +++ b/third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.cpp |
| @@ -33,9 +33,12 @@ |
| #include "core/CSSValueKeywords.h" |
| #include "core/HTMLNames.h" |
| #include "core/css/StylePropertySet.h" |
| +#include "core/dom/Text.h" |
| #include "core/events/MouseEvent.h" |
| +#include "core/html/HTMLLabelElement.h" |
| #include "core/html/HTMLMediaElement.h" |
| #include "core/html/shadow/MediaControls.h" |
| +#include "platform/text/PlatformLocale.h" |
| namespace blink { |
| @@ -116,10 +119,27 @@ void MediaControlElement::setDisplayType(MediaControlElementType displayType) |
| object->setShouldDoFullPaintInvalidation(); |
| } |
| +void MediaControlElement::shouldShowButtonInOverflowMenu(bool shouldShow) |
| +{ |
| + if (!hasOverflowButton()) |
| + return; |
| + |
| + if (shouldShow) |
| + m_overflowMenuElement->removeInlineStyleProperty(CSSPropertyDisplay); |
| + else |
| + m_overflowMenuElement->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| +} |
| + |
| +String MediaControlElement::getOverflowString() |
| +{ |
| + return mediaElement().locale().queryString(getOverflowStringName()); |
| +} |
| + |
| DEFINE_TRACE(MediaControlElement) |
| { |
| visitor->trace(m_mediaControls); |
| visitor->trace(m_element); |
| + visitor->trace(m_overflowMenuElement); |
| } |
| // ---------------------------- |
| @@ -149,6 +169,21 @@ bool MediaControlInputElement::isMouseFocusable() const |
| return false; |
| } |
| +HTMLElement* MediaControlInputElement::createOverflowElement(MediaControls& mediaControls) |
| +{ |
| + |
| + MediaControlInputElement* button = createOverflowButton(mediaControls); |
|
liberato (no reviews please)
2016/08/30 16:42:07
should this return null if |button| is null? eith
kdsilva
2016/08/31 00:17:05
Done.
|
| + // We don't want the button visible within the overflow menu. |
| + button->setIsWanted(false); |
| + |
| + HTMLLabelElement* element = HTMLLabelElement::create(mediaControls.document()); |
|
liberato (no reviews please)
2016/08/30 16:42:07
is clicking on the label supposed to trigger the a
whywhat
2016/08/30 20:22:05
This seems to be by the spec of HTMLLabelElement (
liberato (no reviews please)
2016/08/30 20:59:39
i had no idea that it did that.
thanks!
|
| + element->setShadowPseudoId(AtomicString("-internal-media-controls-overflow-menu-list-item")); |
| + element->appendChild(button); |
| + element->appendChild(Text::create(mediaControls.document(), button->getOverflowString())); |
| + m_overflowMenuElement = element; |
| + return element; |
| +} |
| + |
| DEFINE_TRACE(MediaControlInputElement) |
| { |
| MediaControlElement::trace(visitor); |