| Index: Source/core/html/shadow/PickerIndicatorElement.cpp
|
| diff --git a/Source/core/html/shadow/PickerIndicatorElement.cpp b/Source/core/html/shadow/PickerIndicatorElement.cpp
|
| index 17115a47ea6152a2fa426085993a61f91d619ff6..342a19ecfca2822ff74cb625cb0c1f6f91031304 100644
|
| --- a/Source/core/html/shadow/PickerIndicatorElement.cpp
|
| +++ b/Source/core/html/shadow/PickerIndicatorElement.cpp
|
| @@ -33,10 +33,15 @@
|
| #include "core/html/shadow/PickerIndicatorElement.h"
|
|
|
| #include "core/events/Event.h"
|
| +#include "core/events/KeyboardEvent.h"
|
| +#include "core/frame/Settings.h"
|
| #include "core/html/shadow/ShadowElementNames.h"
|
| #include "core/page/Chrome.h"
|
| #include "core/page/Page.h"
|
| #include "core/rendering/RenderDetailsMarker.h"
|
| +#include "platform/LayoutTestSupport.h"
|
| +#include "platform/text/PlatformLocale.h"
|
| +#include "public/platform/WebLocalizedString.h"
|
| #include "wtf/TemporaryChange.h"
|
|
|
| using namespace WTF::Unicode;
|
| @@ -81,6 +86,12 @@ void PickerIndicatorElement::defaultEventHandler(Event* event)
|
| if (event->type() == EventTypeNames::click) {
|
| openPopup();
|
| event->setDefaultHandled();
|
| + } else if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) {
|
| + int charCode = toKeyboardEvent(event)->charCode();
|
| + if (charCode == ' ' || charCode == '\r') {
|
| + openPopup();
|
| + event->setDefaultHandled();
|
| + }
|
| }
|
|
|
| if (!event->defaultHandled())
|
| @@ -162,6 +173,26 @@ bool PickerIndicatorElement::isPickerIndicatorElement() const
|
| return true;
|
| }
|
|
|
| +Node::InsertionNotificationRequest PickerIndicatorElement::insertedInto(ContainerNode* insertionPoint)
|
| +{
|
| + HTMLDivElement::insertedInto(insertionPoint);
|
| + return InsertionShouldCallDidNotifySubtreeInsertions;
|
| +}
|
| +
|
| +void PickerIndicatorElement::didNotifySubtreeInsertionsToDocument()
|
| +{
|
| + if (!document().settings() || !document().settings()->accessibilityEnabled())
|
| + return;
|
| + // Don't make this focusable if we are in layout tests in order to avoid to
|
| + // break existing tests.
|
| + // FIXME: We should have a way to disable accessibility in layout tests.
|
| + if (LayoutTestSupport::isRunningLayoutTest())
|
| + return;
|
| + setAttribute(tabindexAttr, "0");
|
| + setAttribute(aria_labelAttr, AtomicString(locale().queryString(WebLocalizedString::AXShowPickerButton)));
|
| + setAttribute(roleAttr, "button");
|
| +}
|
| +
|
| void PickerIndicatorElement::trace(Visitor* visitor)
|
| {
|
| visitor->trace(m_pickerIndicatorOwner);
|
|
|