Commit 6648272c authored by pilgrim's avatar pilgrim Committed by Commit bot

Replace ASSERT with DCHECK in modules/accessibility

BUG=707651

Review-Url: https://codereview.chromium.org/2804383002
Cr-Commit-Position: refs/heads/master@{#463037}
parent 60a7c584
......@@ -75,8 +75,8 @@ bool AXARIAGrid::addTableRowChild(AXObject* child,
}
void AXARIAGrid::addChildren() {
ASSERT(!isDetached());
ASSERT(!m_haveChildren);
DCHECK(!isDetached());
DCHECK(!m_haveChildren);
if (!isAXTable()) {
AXLayoutObject::addChildren();
......
......@@ -58,7 +58,7 @@ HTMLMapElement* AXImageMapLink::mapElement() const {
}
AXObject* AXImageMapLink::computeParent() const {
ASSERT(!isDetached());
DCHECK(!isDetached());
if (m_parent)
return m_parent;
......
......@@ -100,7 +100,7 @@ void AXInlineTextBox::textCharacterOffsets(Vector<int>& offsets) const {
unsigned len = m_inlineTextBox->len();
Vector<float> widths;
m_inlineTextBox->characterWidths(widths);
ASSERT(widths.size() == len);
DCHECK(widths.size() == len);
offsets.resize(len);
float widthSoFar = 0;
......@@ -132,7 +132,7 @@ String AXInlineTextBox::name(AXNameFrom& nameFrom,
}
AXObject* AXInlineTextBox::computeParent() const {
ASSERT(!isDetached());
DCHECK(!isDetached());
if (!m_inlineTextBox || !m_axObjectCache)
return 0;
......
......@@ -168,7 +168,7 @@ static inline LayoutObject* endOfContinuations(LayoutObject* layoutObject) {
prev = cur;
if (cur->isLayoutInline()) {
cur = toLayoutInline(cur)->inlineElementContinuation();
ASSERT(cur || !toLayoutInline(prev)->continuation());
DCHECK(cur || !toLayoutInline(prev)->continuation());
} else {
cur = toLayoutBlockFlow(cur)->inlineElementContinuation();
}
......@@ -183,7 +183,7 @@ static inline bool lastChildHasContinuation(LayoutObject* layoutObject) {
}
static LayoutBoxModelObject* nextContinuation(LayoutObject* layoutObject) {
ASSERT(layoutObject);
DCHECK(layoutObject);
if (layoutObject->isLayoutInline() && !layoutObject->isAtomicInlineLevel())
return toLayoutInline(layoutObject)->continuation();
if (layoutObject->isLayoutBlockFlow())
......@@ -206,7 +206,7 @@ AXLayoutObject* AXLayoutObject::create(LayoutObject* layoutObject,
}
AXLayoutObject::~AXLayoutObject() {
ASSERT(isDetached());
DCHECK(isDetached());
}
LayoutBoxModelObject* AXLayoutObject::getLayoutBoxModelObject() const {
......@@ -395,7 +395,7 @@ bool AXLayoutObject::isLoaded() const {
}
bool AXLayoutObject::isOffScreen() const {
ASSERT(m_layoutObject);
DCHECK(m_layoutObject);
IntRect contentRect =
pixelSnappedIntRect(m_layoutObject->absoluteVisualRect());
FrameView* view = m_layoutObject->frame()->view();
......@@ -405,7 +405,7 @@ bool AXLayoutObject::isOffScreen() const {
}
bool AXLayoutObject::isReadOnly() const {
ASSERT(m_layoutObject);
DCHECK(m_layoutObject);
if (isWebArea()) {
Document& document = m_layoutObject->document();
......@@ -506,7 +506,7 @@ AXObjectInclusion AXLayoutObject::defaultObjectInclusion(
bool AXLayoutObject::computeAccessibilityIsIgnored(
IgnoredReasons* ignoredReasons) const {
#if DCHECK_IS_ON()
ASSERT(m_initialized);
DCHECK(m_initialized);
#endif
if (!m_layoutObject)
......@@ -1449,7 +1449,7 @@ AXObject* AXLayoutObject::elementAccessibilityHitTest(
//
AXObject* AXLayoutObject::computeParent() const {
ASSERT(!isDetached());
DCHECK(!isDetached());
if (!m_layoutObject)
return 0;
......@@ -1579,11 +1579,11 @@ AXObject* AXLayoutObject::rawNextSibling() const {
}
void AXLayoutObject::addChildren() {
ASSERT(!isDetached());
DCHECK(!isDetached());
// If the need to add more children in addition to existing children arises,
// childrenChanged should have been called, leaving the object with no
// children.
ASSERT(!m_haveChildren);
DCHECK(!m_haveChildren);
m_haveChildren = true;
......@@ -1743,7 +1743,7 @@ AXObject::AXRange AXLayoutObject::selection() const {
TextAffinity endAffinity = visibleEnd.affinity();
Node* anchorNode = start.anchorNode();
ASSERT(anchorNode);
DCHECK(anchorNode);
AXLayoutObject* anchorObject = nullptr;
// Find the closest node that has a corresponding AXObject.
......@@ -1761,7 +1761,7 @@ AXObject::AXRange AXLayoutObject::selection() const {
}
Node* focusNode = end.anchorNode();
ASSERT(focusNode);
DCHECK(focusNode);
AXLayoutObject* focusObject = nullptr;
while (focusNode) {
......@@ -1779,9 +1779,9 @@ AXObject::AXRange AXLayoutObject::selection() const {
return AXRange();
int anchorOffset = anchorObject->indexForVisiblePosition(visibleStart);
ASSERT(anchorOffset >= 0);
DCHECK(anchorOffset >= 0);
int focusOffset = focusObject->indexForVisiblePosition(visibleEnd);
ASSERT(focusOffset >= 0);
DCHECK(focusOffset >= 0);
return AXRange(anchorObject, anchorOffset, startAffinity, focusObject,
focusOffset, endAffinity);
}
......@@ -1817,9 +1817,9 @@ AXObject::AXRange AXLayoutObject::selectionUnderObject() const {
}
int start = indexForVisiblePosition(selection.visibleStart());
ASSERT(start >= 0);
DCHECK(start >= 0);
int end = indexForVisiblePosition(selection.visibleEnd());
ASSERT(end >= 0);
DCHECK(end >= 0);
return AXRange(start, end);
}
......@@ -1849,7 +1849,7 @@ AXObject::AXRange AXLayoutObject::textControlSelection() const {
layout->frame()->selection().computeVisibleSelectionInDOMTreeDeprecated();
TextControlElement* textControl =
toLayoutTextControl(layout)->textControlElement();
ASSERT(textControl);
DCHECK(textControl);
int start = textControl->selectionStart();
int end = textControl->selectionEnd();
......@@ -2459,7 +2459,7 @@ void AXLayoutObject::addImageMapChildren() {
if (obj) {
AXImageMapLink* areaObject = toAXImageMapLink(obj);
areaObject->setParent(this);
ASSERT(areaObject->axObjectID() != 0);
DCHECK(areaObject->axObjectID() != 0);
if (!areaObject->accessibilityIsIgnored())
m_children.push_back(areaObject);
else
......@@ -2475,7 +2475,7 @@ void AXLayoutObject::addCanvasChildren() {
// If it's a canvas, it won't have laid out children, but it might have
// accessible fallback content. Clear m_haveChildren because
// AXNodeObject::addChildren will expect it to be false.
ASSERT(!m_children.size());
DCHECK(!m_children.size());
m_haveChildren = false;
AXNodeObject::addChildren();
}
......
......@@ -138,7 +138,7 @@ String AXListBoxOption::textAlternative(bool recursive,
// If nameSources is non-null, relatedObjects is used in filling it in, so it
// must be non-null as well.
if (nameSources)
ASSERT(relatedObjects);
DCHECK(relatedObjects);
if (!getNode())
return String();
......
......@@ -48,7 +48,7 @@ AccessibilityMediaControl::AccessibilityMediaControl(
AXObject* AccessibilityMediaControl::create(LayoutObject* layoutObject,
AXObjectCacheImpl& axObjectCache) {
ASSERT(layoutObject->node());
DCHECK(layoutObject->node());
switch (mediaControlElementType(layoutObject->node())) {
case MediaSlider:
......
......@@ -67,7 +67,7 @@ void AXMenuList::clearChildren() {
// There's no reason to clear our AXMenuListPopup child. If we get a
// call to clearChildren, it's because the options might have changed,
// so call it on our popup.
ASSERT(m_children.size() == 1);
DCHECK(m_children.size() == 1);
m_children[0]->clearChildren();
m_childrenDirty = false;
}
......@@ -77,7 +77,7 @@ bool AXMenuList::nameFromContents() const {
}
void AXMenuList::addChildren() {
ASSERT(!isDetached());
DCHECK(!isDetached());
m_haveChildren = true;
AXObjectCacheImpl& cache = axObjectCache();
......@@ -123,8 +123,8 @@ bool AXMenuList::canSetFocusAttribute() const {
void AXMenuList::didUpdateActiveOption(int optionIndex) {
const auto& childObjects = children();
if (!childObjects.isEmpty()) {
ASSERT(childObjects.size() == 1);
ASSERT(childObjects[0]->isMenuListPopup());
DCHECK(childObjects.size() == 1);
DCHECK(childObjects[0]->isMenuListPopup());
if (childObjects[0]->isMenuListPopup()) {
if (AXMenuListPopup* popup = toAXMenuListPopup(childObjects[0].get()))
......
......@@ -39,7 +39,7 @@ AXMenuListOption::AXMenuListOption(HTMLOptionElement* element,
: AXMockObject(axObjectCache), m_element(element) {}
AXMenuListOption::~AXMenuListOption() {
ASSERT(!m_element);
DCHECK(!m_element);
}
void AXMenuListOption::detach() {
......@@ -117,12 +117,12 @@ void AXMenuListOption::getRelativeBounds(
AXObject* parent = parentObject();
if (!parent)
return;
ASSERT(parent->isMenuListPopup());
DCHECK(parent->isMenuListPopup());
AXObject* grandparent = parent->parentObject();
if (!grandparent)
return;
ASSERT(grandparent->isMenuList());
DCHECK(grandparent->isMenuList());
grandparent->getRelativeBounds(outContainer, outBoundsInContainer,
outContainerTransform);
}
......@@ -136,7 +136,7 @@ String AXMenuListOption::textAlternative(bool recursive,
// If nameSources is non-null, relatedObjects is used in filling it in, so it
// must be non-null as well.
if (nameSources)
ASSERT(relatedObjects);
DCHECK(relatedObjects);
if (!getNode())
return String();
......
......@@ -61,7 +61,7 @@ bool AXMenuListPopup::computeAccessibilityIsIgnored(
AXMenuListOption* AXMenuListPopup::menuListOptionAXObject(
HTMLElement* element) const {
ASSERT(element);
DCHECK(element);
if (!isHTMLOptionElement(*element))
return 0;
......@@ -93,7 +93,7 @@ bool AXMenuListPopup::press() {
}
void AXMenuListPopup::addChildren() {
ASSERT(!isDetached());
DCHECK(!isDetached());
if (!m_parent)
return;
......
......@@ -227,7 +227,7 @@ AXNodeObject* AXNodeObject::create(Node* node,
}
AXNodeObject::~AXNodeObject() {
ASSERT(!m_node);
DCHECK(!m_node);
}
void AXNodeObject::alterSliderValue(bool increase) {
......@@ -268,7 +268,7 @@ bool AXNodeObject::computeAccessibilityIsIgnored(
#if DCHECK_IS_ON()
// Double-check that an AXObject is never accessed before
// it's been initialized.
ASSERT(m_initialized);
DCHECK(m_initialized);
#endif
// If this element is within a parent that cannot have children, it should not
......@@ -904,7 +904,7 @@ AccessibilityRole AXNodeObject::remapAriaRoleDueToParent(
void AXNodeObject::init() {
#if DCHECK_IS_ON()
ASSERT(!m_initialized);
DCHECK(!m_initialized);
m_initialized = true;
#endif
m_role = determineAccessibilityRole();
......@@ -1876,7 +1876,7 @@ String AXNodeObject::textAlternative(bool recursive,
// If nameSources is non-null, relatedObjects is used in filling it in, so it
// must be non-null as well.
if (nameSources)
ASSERT(relatedObjects);
DCHECK(relatedObjects);
bool foundTextAlternative = false;
......@@ -2163,7 +2163,7 @@ static Node* getParentNodeForComputeParent(Node* node) {
}
AXObject* AXNodeObject::computeParent() const {
ASSERT(!isDetached());
DCHECK(!isDetached());
if (Node* parentNode = getParentNodeForComputeParent(getNode()))
return axObjectCache().getOrCreate(parentNode);
......@@ -2201,11 +2201,11 @@ AXObject* AXNodeObject::rawNextSibling() const {
}
void AXNodeObject::addChildren() {
ASSERT(!isDetached());
DCHECK(!isDetached());
// If the need to add more children in addition to existing children arises,
// childrenChanged should have been called, leaving the object with no
// children.
ASSERT(!m_haveChildren);
DCHECK(!m_haveChildren);
if (!m_node)
return;
......@@ -2254,7 +2254,7 @@ void AXNodeObject::insertChild(AXObject* child, unsigned index) {
for (size_t i = 0; i < length; ++i)
m_children.insert(index + i, children[i]);
} else {
ASSERT(child->parentObject() == this);
DCHECK(child->parentObject() == this);
m_children.insert(index, child);
}
}
......@@ -2571,7 +2571,7 @@ String AXNodeObject::nativeTextAlternative(
// If nameSources is non-null, relatedObjects is used in filling it in, so it
// must be non-null as well.
if (nameSources)
ASSERT(relatedObjects);
DCHECK(relatedObjects);
String textAlternative;
AXRelatedObjectVector localRelatedObjects;
......@@ -2907,7 +2907,7 @@ String AXNodeObject::nativeTextAlternative(
nameSources->back().type = nameFrom;
nameSources->back().nativeSource = AXTextFromNativeHTMLTitleElement;
}
ASSERT(getNode()->isContainerNode());
DCHECK(getNode()->isContainerNode());
Element* title = ElementTraversal::firstChild(
toContainerNode(*(getNode())), HasTagName(SVGNames::titleTag));
......@@ -3054,7 +3054,7 @@ String AXNodeObject::description(AXNameFrom nameFrom,
// If descriptionSources is non-null, relatedObjects is used in filling it in,
// so it must be non-null as well.
if (descriptionSources)
ASSERT(relatedObjects);
DCHECK(relatedObjects);
if (!getNode())
return String();
......
......@@ -364,7 +364,7 @@ AXObject::AXObject(AXObjectCacheImpl& axObjectCache)
}
AXObject::~AXObject() {
ASSERT(isDetached());
DCHECK(isDetached());
--s_numberOfLiveAXObjects;
}
......@@ -1672,7 +1672,7 @@ bool AXObject::isARIAInput(AccessibilityRole ariaRole) {
}
AccessibilityRole AXObject::ariaRoleToWebCoreRole(const String& value) {
ASSERT(!value.isEmpty());
DCHECK(!value.isEmpty());
static const ARIARoleMap* roleMap = createARIARoleMap();
......
......@@ -596,7 +596,7 @@ class MODULES_EXPORT AXObject : public GarbageCollectedFinalized<AXObject> {
// The AXObjectCacheImpl that owns this object, and its unique ID within this
// cache.
AXObjectCacheImpl& axObjectCache() const {
ASSERT(m_axObjectCache);
DCHECK(m_axObjectCache);
return *m_axObjectCache;
}
......
......@@ -53,7 +53,7 @@ void AXSVGRoot::setParent(AXObject* parent) {
}
AXObject* AXSVGRoot::computeParent() const {
ASSERT(!isDetached());
DCHECK(!isDetached());
// If a parent was set because this is a remote SVG resource, use that
// but otherwise, we should rely on the standard layout tree for the parent.
if (m_parent)
......
......@@ -80,8 +80,8 @@ AccessibilityOrientation AXSlider::orientation() const {
}
void AXSlider::addChildren() {
ASSERT(!isDetached());
ASSERT(!m_haveChildren);
DCHECK(!isDetached());
DCHECK(!m_haveChildren);
m_haveChildren = true;
......@@ -101,7 +101,7 @@ void AXSlider::addChildren() {
AXObject* AXSlider::elementAccessibilityHitTest(const IntPoint& point) const {
if (m_children.size()) {
ASSERT(m_children.size() == 1);
DCHECK(m_children.size() == 1);
if (m_children[0]->getBoundsInFrameCoordinates().contains(point))
return m_children[0].get();
}
......
......@@ -38,7 +38,7 @@ AXSpinButton::AXSpinButton(AXObjectCacheImpl& axObjectCache)
: AXMockObject(axObjectCache), m_spinButtonElement(nullptr) {}
AXSpinButton::~AXSpinButton() {
ASSERT(!m_spinButtonElement);
DCHECK(!m_spinButtonElement);
}
DEFINE_TRACE(AXSpinButton) {
......@@ -68,7 +68,7 @@ AccessibilityRole AXSpinButton::roleValue() const {
}
void AXSpinButton::addChildren() {
ASSERT(!isDetached());
DCHECK(!isDetached());
m_haveChildren = true;
AXSpinButtonPart* incrementor =
......@@ -85,7 +85,7 @@ void AXSpinButton::addChildren() {
}
void AXSpinButton::step(int amount) {
ASSERT(m_spinButtonElement);
DCHECK(m_spinButtonElement);
if (!m_spinButtonElement)
return;
......
......@@ -364,13 +364,13 @@ void AXTable::clearChildren() {
}
void AXTable::addChildren() {
ASSERT(!isDetached());
DCHECK(!isDetached());
if (!isAXTable()) {
AXLayoutObject::addChildren();
return;
}
ASSERT(!m_haveChildren);
DCHECK(!m_haveChildren);
m_haveChildren = true;
if (!m_layoutObject || !m_layoutObject->isTable())
......
......@@ -121,8 +121,8 @@ bool AXTableColumn::computeAccessibilityIsIgnored(
}
void AXTableColumn::addChildren() {
ASSERT(!isDetached());
ASSERT(!m_haveChildren);
DCHECK(!isDetached());
DCHECK(!m_haveChildren);
m_haveChildren = true;
if (!m_parent || !m_parent->isAXTable())
......
......@@ -57,8 +57,8 @@ bool AXTableHeaderContainer::computeAccessibilityIsIgnored(
}
void AXTableHeaderContainer::addChildren() {
ASSERT(!isDetached());
ASSERT(!m_haveChildren);
DCHECK(!isDetached());
DCHECK(!m_haveChildren);
m_haveChildren = true;
if (!m_parent || !m_parent->isAXTable())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment