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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

Issue 2828013002: Replace DCHECK with DCHECK_EQ and DCHECK_GT as appropriate in modules/accessibility (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 if (focus_node->previousSibling()) 1774 if (focus_node->previousSibling())
1775 focus_node = focus_node->previousSibling(); 1775 focus_node = focus_node->previousSibling();
1776 else 1776 else
1777 focus_node = focus_node->parentNode(); 1777 focus_node = focus_node->parentNode();
1778 } 1778 }
1779 1779
1780 if (!anchor_object || !focus_object) 1780 if (!anchor_object || !focus_object)
1781 return AXRange(); 1781 return AXRange();
1782 1782
1783 int anchor_offset = anchor_object->IndexForVisiblePosition(visible_start); 1783 int anchor_offset = anchor_object->IndexForVisiblePosition(visible_start);
1784 DCHECK(anchor_offset >= 0); 1784 DCHECK_GE(anchor_offset, 0);
1785 int focus_offset = focus_object->IndexForVisiblePosition(visible_end); 1785 int focus_offset = focus_object->IndexForVisiblePosition(visible_end);
1786 DCHECK(focus_offset >= 0); 1786 DCHECK_GE(focus_offset, 0);
1787 return AXRange(anchor_object, anchor_offset, start_affinity, focus_object, 1787 return AXRange(anchor_object, anchor_offset, start_affinity, focus_object,
1788 focus_offset, end_affinity); 1788 focus_offset, end_affinity);
1789 } 1789 }
1790 1790
1791 // Gets only the start and end offsets of the selection computed using the 1791 // Gets only the start and end offsets of the selection computed using the
1792 // current object as the starting point. Returns a null selection if there is 1792 // current object as the starting point. Returns a null selection if there is
1793 // no selection in the subtree rooted at this object. 1793 // no selection in the subtree rooted at this object.
1794 AXObject::AXRange AXLayoutObject::SelectionUnderObject() const { 1794 AXObject::AXRange AXLayoutObject::SelectionUnderObject() const {
1795 AXRange text_selection = TextControlSelection(); 1795 AXRange text_selection = TextControlSelection();
1796 if (text_selection.IsValid()) 1796 if (text_selection.IsValid())
(...skipping 14 matching lines...) Expand all
1811 // Selection is contained in node. 1811 // Selection is contained in node.
1812 || !(parent_node && 1812 || !(parent_node &&
1813 selection_range->comparePoint(parent_node, node_index, 1813 selection_range->comparePoint(parent_node, node_index,
1814 IGNORE_EXCEPTION_FOR_TESTING) < 0 && 1814 IGNORE_EXCEPTION_FOR_TESTING) < 0 &&
1815 selection_range->comparePoint(parent_node, node_index + 1, 1815 selection_range->comparePoint(parent_node, node_index + 1,
1816 IGNORE_EXCEPTION_FOR_TESTING) > 0)) { 1816 IGNORE_EXCEPTION_FOR_TESTING) > 0)) {
1817 return AXRange(); 1817 return AXRange();
1818 } 1818 }
1819 1819
1820 int start = IndexForVisiblePosition(selection.VisibleStart()); 1820 int start = IndexForVisiblePosition(selection.VisibleStart());
1821 DCHECK(start >= 0); 1821 DCHECK_GE(start, 0);
1822 int end = IndexForVisiblePosition(selection.VisibleEnd()); 1822 int end = IndexForVisiblePosition(selection.VisibleEnd());
1823 DCHECK(end >= 0); 1823 DCHECK_GE(end, 0);
1824 1824
1825 return AXRange(start, end); 1825 return AXRange(start, end);
1826 } 1826 }
1827 1827
1828 AXObject::AXRange AXLayoutObject::TextControlSelection() const { 1828 AXObject::AXRange AXLayoutObject::TextControlSelection() const {
1829 if (!GetLayoutObject()) 1829 if (!GetLayoutObject())
1830 return AXRange(); 1830 return AXRange();
1831 1831
1832 LayoutObject* layout = nullptr; 1832 LayoutObject* layout = nullptr;
1833 if (GetLayoutObject()->IsTextControl()) { 1833 if (GetLayoutObject()->IsTextControl()) {
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 2511
2512 bool AXLayoutObject::ElementAttributeValue( 2512 bool AXLayoutObject::ElementAttributeValue(
2513 const QualifiedName& attribute_name) const { 2513 const QualifiedName& attribute_name) const {
2514 if (!layout_object_) 2514 if (!layout_object_)
2515 return false; 2515 return false;
2516 2516
2517 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true"); 2517 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true");
2518 } 2518 }
2519 2519
2520 } // namespace blink 2520 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698