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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp

Issue 2914723002: Fix crash in hidden <select> (Closed)
Patch Set: Remove non-working layout test Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp
index af8b879f8aa95cb684c00df08472d6ac07eb7339..f8c4eec6adeeb596d381765f435ccf89232a9bae 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp
@@ -28,6 +28,7 @@
#include "SkMatrix44.h"
#include "core/dom/AccessibleNode.h"
#include "core/html/HTMLSelectElement.h"
+#include "modules/accessibility/AXMenuList.h"
#include "modules/accessibility/AXMenuListPopup.h"
#include "modules/accessibility/AXObjectCacheImpl.h"
@@ -48,6 +49,12 @@ void AXMenuListOption::Detach() {
AXMockObject::Detach();
}
+LocalFrameView* AXMenuListOption::DocumentFrameView() const {
+ if (IsDetached())
+ return nullptr;
+ return element_->GetDocument().View();
+}
+
AccessibilityRole AXMenuListOption::RoleValue() const {
const AtomicString& aria_role =
GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRole);
@@ -72,14 +79,21 @@ AXObjectImpl* AXMenuListOption::ComputeParent() const {
if (!select)
return nullptr;
AXObjectImpl* select_ax_object = AxObjectCache().GetOrCreate(select);
- if (select_ax_object->HasChildren()) {
- const auto& child_objects = select_ax_object->Children();
- DCHECK(!child_objects.IsEmpty());
+
+ // This happens if the <select> is not rendered. Return it and move on.
+ if (!select_ax_object->IsMenuList())
+ return select_ax_object;
+
+ AXMenuList* menu_list = ToAXMenuList(select_ax_object);
+ if (menu_list->HasChildren()) {
+ const auto& child_objects = menu_list->Children();
+ if (child_objects.IsEmpty())
+ return nullptr;
DCHECK_EQ(child_objects.size(), 1UL);
DCHECK(child_objects[0]->IsMenuListPopup());
ToAXMenuListPopup(child_objects[0].Get())->UpdateChildrenIfNecessary();
} else {
- select_ax_object->UpdateChildrenIfNecessary();
+ menu_list->UpdateChildrenIfNecessary();
}
return parent_.Get();
}
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698