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

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

Issue 1072273006: Oilpan: Prepare moving AXObject to heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 | « Source/modules/accessibility/AXMenuListOption.h ('k') | Source/modules/accessibility/AXMenuListPopup.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXMenuListOption.cpp
diff --git a/Source/modules/accessibility/AXMenuListOption.cpp b/Source/modules/accessibility/AXMenuListOption.cpp
index b0dd501d21779e21bcb0826c548ecb40b0e10766..d684fb2e9e4a4c97b9e40e0d1e344ca71b298c6a 100644
--- a/Source/modules/accessibility/AXMenuListOption.cpp
+++ b/Source/modules/accessibility/AXMenuListOption.cpp
@@ -39,6 +39,11 @@ AXMenuListOption::AXMenuListOption(HTMLOptionElement* element, AXObjectCacheImpl
{
}
+AXMenuListOption::~AXMenuListOption()
+{
+ ASSERT(!m_element);
+}
+
void AXMenuListOption::detach()
{
m_element = nullptr;
@@ -54,7 +59,7 @@ bool AXMenuListOption::isEnabled() const
{
// isDisabledFormControl() returns true if the parent <select> element is disabled,
// which we don't want.
- return !m_element->ownElementDisabled();
+ return m_element && !m_element->ownElementDisabled();
}
bool AXMenuListOption::isVisible() const
@@ -78,12 +83,12 @@ bool AXMenuListOption::isSelected() const
AXMenuListPopup* parent = static_cast<AXMenuListPopup*>(parentObject());
if (parent && !parent->isOffScreen())
return parent->activeChild() == this;
- return m_element->selected();
+ return m_element && m_element->selected();
}
void AXMenuListOption::setSelected(bool b)
{
- if (!canSetSelectedAttribute())
+ if (!m_element || !canSetSelectedAttribute())
return;
m_element->setSelected(b);
@@ -116,7 +121,13 @@ LayoutRect AXMenuListOption::elementRect() const
String AXMenuListOption::stringValue() const
{
- return m_element->text();
+ return m_element ? m_element->text() : String();
+}
+
+DEFINE_TRACE(AXMenuListOption)
+{
+ visitor->trace(m_element);
+ AXMockObject::trace(visitor);
}
} // namespace blink
« no previous file with comments | « Source/modules/accessibility/AXMenuListOption.h ('k') | Source/modules/accessibility/AXMenuListPopup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698